Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mig 12.0 l10n br delivery #967

Merged
merged 116 commits into from
Dec 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
116 commits
Select commit Hold shift + click to select a range
5530a8d
Adicionado módulo l10n_br_delivery dependende do modulo delivery do a…
renatonlima Aug 31, 2010
6823515
atualizando o commit anterior
renatonlima Aug 31, 2010
67ea903
Removido o campo weight_net do objeto stock.picking do modulo l10n_br…
renatonlima Sep 8, 2010
69eef43
Incluido o campo Descontar imposto para os impostos que são incluidos…
renatonlima Sep 28, 2010
bfdc7c5
concertado a visões herdadas do modulo stock
renatonlima Oct 14, 2010
772dda7
[REF] extracted l10n_br_base, l10n_sale and l10n_stock from l10n_br; …
rvalyi Oct 25, 2010
a375423
Módulo l10n_br_delivery: Alterado o campo volume para number_of_packa…
renatonlima Oct 28, 2010
9f6763f
Acertada visão do modulo l10n_br_delivery
renatonlima Oct 28, 2010
883f2b6
Adicionado integração com NFe v2.00 feita através de arquivos XML ou …
renatonlima Nov 29, 2010
b5b3907
Atualização das rotinas NFe, para tirar acentuações, e informar os ca…
renatonlima Nov 30, 2010
41cdbb5
Corrigido a classe vehicle do modulo l10n_br_delivery
renatonlima Dec 3, 2010
6f26340
Adicionado customizações nos calculos dos tributos e beneficios fisca…
renatonlima Dec 9, 2010
d95b343
Adicionado o campo amount_freight no objeto account.invoice do modulo…
renatonlima Jan 10, 2011
83eb098
l10n_br_delivery - Adicionado campos Tipo do Frete, Veículo, Total do…
renatonlima Jan 14, 2011
7d05402
l10n_br_account - Adicionado o regime tributário na empresa (exigido …
renatonlima Jan 24, 2011
7972321
Alteração para permitir um pedido de venda, separação e nota fiscal o…
renatonlima Feb 3, 2011
467fe56
l10n_br_stock, concertado bug ao criar nota fiscal apartir do picking
renatonlima Feb 4, 2011
a999070
l10n_br_base - Filtro de CNPJ na visão de parceiros, adição da chave …
renatonlima Feb 28, 2011
6f17646
l10n_br_account - Resolução da nota fiscal de serviço.
renatonlima Apr 12, 2011
7bf9cb2
[IMP] moved delivery data NFe validation to l10n_br_delivery so there…
rvalyi Apr 24, 2011
cea9e38
Alterado o nome do campo city_id no objeto res.partner.address para l…
renatonlima May 9, 2011
288ba83
Renomeado o campo city_id para o l10n_br_city_id no objeto l10n_br_ba…
renatonlima May 11, 2011
df26013
l10n_br_account: extendido o wizard do plano de contas para copiar o …
renatonlima May 17, 2011
939b377
removido o módulo l10n_br_fp_rule_sale_link, pois foi resolvido o pro…
renatonlima May 24, 2011
ae49138
l10n_br_account: implementados filtros na visão da nota fiscal, de pr…
renatonlima Jun 10, 2011
adee2bb
l10n_br_account alterada a rotina de nfe para pegar o valor do código…
renatonlima Jul 18, 2011
c150324
deixar explicito a licença da localização
renatonlima Jul 18, 2011
213cb78
l10n_br_delivery corrigida visão herdada do l10n_br_account
renatonlima Sep 27, 2011
4bdb718
l10n_br_account: alterada a visão dos dados adicionais da nota fiscal…
renatonlima Nov 14, 2011
9f87875
l10n_br_sale e l10n_br_delivery: Resolvido compatibilidade entre os m…
renatonlima Nov 15, 2011
f2cc8b5
alterado comentários dos arquivos *.py e mudado estilo de codificação…
renatonlima Nov 23, 2011
9229f8d
Removido '\' do código
renatonlima Nov 23, 2011
ccb1ca3
l10n_br_delivery corrigido importação
renatonlima Nov 23, 2011
8bdbdb8
l10n_br_stock: Adicionado nas condições de entregas o campo de despes…
renatonlima Jan 26, 2012
c1ed2aa
[REF] more empty lines removal
rvalyi Mar 18, 2012
801128d
[IMP] l10n_br_delivery: do not blow out in case of missing fiscal par…
rvalyi Mar 22, 2012
b01471b
l10n_br_delivery: limpeza e formatação do código
renatonlima Oct 30, 2012
5e6012f
Transferido os campos obrigatórios no documento fiscal implementado n…
renatonlima Nov 8, 2012
f505207
Transferido os campos obrigatórios no documento fiscal implementado n…
renatonlima Nov 8, 2012
c4b7b16
[FIX] l10n_br_delivery, l10n_br_account: adicionado filtro nas regras…
renatonlima Dec 12, 2012
efab405
[FIX] Alterado métodos de criação de nota fiscal no módulo l10n_br_de…
renatonlima Dec 14, 2012
08f40bd
[FIX] removed fiscal_operation_id field
renatonlima Dec 18, 2012
738b267
formatação do código PEP8
renatonlima Jan 29, 2013
1c63bc8
[MIGR] migração do modulo l10n_br_delivery
renatonlima Feb 6, 2013
9913f29
[MIGR] trocadas chaves update_xml, init_xml por data e demo_xml por d…
renatonlima Feb 11, 2013
f25b9b7
[MERGE] migração do módulo l10n_br_data_delivery para versão 7.0
renatonlima Apr 16, 2013
ef5eb97
[FIX] rotina de validação da NFe do módulo l10n_br_delivery
renatonlima May 25, 2013
a975d19
Alterado o nome de alguns módulos para deixar mais legível
renatonlima Aug 30, 2013
9874384
Adicionado arquivos de tradução vazios pt_BR.po para evitar mensagens…
renatonlima Dec 12, 2013
492d508
Atualização das versões dos módulos
renatonlima Dec 12, 2013
ba26406
[REF] Refatorado aquivos no módulo l10n_br_delivery
renatonlima Dec 13, 2013
0bcb0d6
[REF] Refatorado aquivos de visões no módulo l10n_br_delivery
renatonlima Dec 13, 2013
cb89db8
[MIG] Migração do desconto e frete na branch develop, arquivos do l10…
mileo Jan 20, 2014
1bcc3e1
Revert "[MIG] Frete e desconto l10n_br_account"
mileo Jan 20, 2014
d9566d9
[FIX][REF] PEP8 class name, linha removida incorretamente
mileo Jan 20, 2014
aba5eed
[FIX] Class name
mileo Jan 20, 2014
e51166e
[FIX] Alguns refactoring para concertar a geração da fatura quando nã…
renatonlima Jan 25, 2014
0f32751
[FIX] corrigido nome da classe errado
renatonlima Jan 27, 2014
96f1ea3
Corrigido erros de digitação e adicionado traduções aos módulos
danimaribeiro Mar 12, 2014
869087c
Inicio da extração dos campos e métodos do módulo l10n_br_sale para o…
renatonlima Mar 15, 2014
403ec22
Inicio da extração dos campos e métodos do módulo l10n_br_delivery pa…
renatonlima Mar 15, 2014
01d67a2
Extraido métodos do módulo l10n_br_delivery para o novo módulo l10n_b…
renatonlima Mar 15, 2014
1d3bbfa
Movido objetos herdados da empresa do módulo l10n_br_delivery para o …
renatonlima Mar 15, 2014
2bc7c81
Concluído a criação do módulo l10n_br_sale_product
renatonlima Mar 15, 2014
d43d77c
Adicionados arquivos README.md para descrição dos módulos
renatonlima Oct 22, 2014
842898c
[MIGRATION] initial commit to new branch 8.0 before migration
renatonlima Oct 22, 2014
7963d52
[MOV] move addons out of __unported__ (they remain not installable)
sbidoul Oct 13, 2015
3d46a7c
[FIX] CamelCase Classes
mileo Nov 15, 2015
022da8e
[REF] Removing active tag from __openerp__.py
mileo Nov 15, 2015
b8c4334
[FIX] PEP8
mileo Nov 15, 2015
9c6aa38
update metadata info
renatonlima Oct 27, 2014
41afa69
migrate stock.picking object and view to new API
renatonlima Oct 27, 2014
5898f78
migrate delivery.carrier to new API
renatonlima Oct 30, 2014
a59efa6
migrate all objects in l10n_br_delivery.py to new API
renatonlima Oct 30, 2014
a3f4257
migrate all objects in sale.py to new API
renatonlima Oct 30, 2014
741b8a9
migrate all objects in stock.py to new API
renatonlima Oct 30, 2014
47d9bd6
migrate stock objects
renatonlima Jan 14, 2015
a93cd14
[FIX] import
renatonlima Jan 14, 2015
c03c3ac
Added api
renatonlima Jan 14, 2015
b009ca9
fix self.user to self.env.user
renatonlima Jan 14, 2015
20ee549
fix stock.move and stock.picking objects
renatonlima Jan 14, 2015
b2118f0
removed debug
renatonlima Jan 14, 2015
da1ed80
migrate method to new api
renatonlima Mar 11, 2015
2c30cb9
moved models and views to a folder as new pattern and replace uncodin…
renatonlima Mar 11, 2015
f35dbd7
pep8 hopefully cleared
rvalyi Oct 22, 2015
258c730
Modificado interface dos transportes, criado onchange para setar os c…
danimaribeiro Oct 9, 2015
05a06fd
[MIG] Migration l10n_br_delivery.py and stock.py
mileo Dec 17, 2015
2adf785
[MIG] Migrate to new api delivery_set
mileo Dec 17, 2015
d235e83
[FIX] Args delivery _get_invoice_line_vals
mileo Dec 17, 2015
9dac478
[FIX] delivery UserError
mileo Dec 26, 2015
087bae5
pep8
renatonlima May 19, 2016
5d0a5d4
chaged README file
renatonlima May 19, 2016
a18ece4
update author and version
renatonlima May 19, 2016
a9810d1
[REF] methods in stock.picking
renatonlima May 19, 2016
76d6830
[REF] Replace tabs with spaces
mileo Jul 19, 2016
de01177
lighter new style OCA license headers
rvalyi Aug 15, 2016
4571a6d
[REF] change view in l10n_br_delivery
renatonlima Aug 25, 2016
b9ce292
[MIG] Make modules uninstallable
renatonlima Dec 2, 2016
96e8992
[MIG] Rename manifest files
renatonlima Dec 6, 2016
62edb6b
[ADD] Freight apportionment
gabrielcardoso21 Nov 10, 2020
11c3fad
[REF] Remove no longer used files and set v8 -> v12
DiegoParadeda Nov 10, 2020
9fed6f8
[ADD] Disable add delivery line from sale.order and stock.picking
DiegoParadeda Nov 10, 2020
4b02755
[FIX] Runtime error
gabrielcardoso21 Nov 10, 2020
dadb284
[FIX] Version and headers
DiegoParadeda Dec 4, 2020
88ac7d6
[FIX] Flake 8
DiegoParadeda Dec 4, 2020
5339496
[REM] Commented code
gabrielcardoso21 Dec 8, 2020
595a441
[ADD] Inverse function for other costs
gabrielcardoso21 Dec 8, 2020
485b2a6
[ADD] Inverse function for insurance value
gabrielcardoso21 Dec 8, 2020
4c151e1
[FIX] l10n_delivery manifest
luismalta Dec 8, 2020
e4e4a82
[ADD] README files
luismalta Dec 8, 2020
9b56f57
[IMP] Update values on save
gabrielcardoso21 Dec 9, 2020
6ca4aa4
[ADD] l10n_br_delivey tests
luismalta Dec 9, 2020
8c78ca4
[FIX] amount_insurance and amount_costs readonly
luismalta Dec 9, 2020
c5e4c0b
[FIX] Picking state on test
luismalta Dec 10, 2020
8c677c2
[IMP] New test cases
luismalta Dec 10, 2020
3f4498d
[IMP] l10n_br_delivery test cases and performance
luismalta Dec 10, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
109 changes: 109 additions & 0 deletions l10n_br_delivery/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
===============================
Brazilian Localization Delivery
===============================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fhttps://github.com/OCA/l10n--brazil-lightgray.png?logo=github
:target: https://github.com/OCA/https://github.com/OCA/l10n-brazil/tree/12.0/l10n_br_delivery
:alt: OCA/https://github.com/OCA/l10n-brazil
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/https://github.com/OCA/l10n-brazil-12-0/https://github.com/OCA/l10n-brazil-12-0-l10n_br_delivery
:alt: Translate me on Weblate

|badge1| |badge2| |badge3| |badge4|

This module was written to extend the functionality of delivery to support the
adequacy of Brazilian delivery standards
and allows you to apportion the value of freight, insurance and other costs.

**Table of contents**

.. contents::
:local:

Installation
============

To install this module, you need to do nothing

Configuration
=============

No additional configuration is required to use this module

Usage
=====

To use this module, you need to:

* Create a quote and enter freight, insurance and other costs for each product line
* Check the total values of the quotation being updated according to the sum of the values of the product lines

Alternatively:

* Change only the total freight, insurance and other quote costs

* Check that each of the previous values for each product line has been set proportionally to the value of the product

Known issues / Roadmap
======================

* TODO!

Changelog
=========



Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/https://github.com/OCA/l10n-brazil/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/https://github.com/OCA/l10n-brazil/issues/new?body=module:%20l10n_br_delivery%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
~~~~~~~

* KMEE

Contributors
~~~~~~~~~~~~

* Renato Lima <[email protected]>
* Diego Paradeda <[email protected]>
* Gabriel Cardoso de Faria <[email protected]>
* Luis Otavio Malta Conceição <[email protected]>

Maintainers
~~~~~~~~~~~

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

This module is part of the `OCA/https://github.com/OCA/l10n-brazil <https://github.com/OCA/https://github.com/OCA/l10n-brazil/tree/12.0/l10n_br_delivery>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions l10n_br_delivery/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
23 changes: 23 additions & 0 deletions l10n_br_delivery/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright (C) 2020 KMEE INFORMATICA LTDA
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html

{
'name': 'Brazilian Localization Delivery',
'summary': """
This module changes the delivery model strategy to match brazilian
standards.""",
'license': 'AGPL-3',
'author': 'KMEE,Odoo Community Association (OCA)',
'website': 'https://github.com/oca/l10n-brazil',
'version': '12.0.1.1.0',
'depends': [
'l10n_br_fiscal',
'l10n_br_sale_stock',
'delivery',
],
'data': [
],
'demo': [],
'category': 'Localization',
'installable': True,
}
3 changes: 3 additions & 0 deletions l10n_br_delivery/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from . import sale_order
from . import stock_picking
from . import document
93 changes: 93 additions & 0 deletions l10n_br_delivery/models/document.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# Copyright (C) 2020 - Gabriel Cardoso de Faria<[email protected]>
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html

from odoo import api, fields, models


class Document(models.Model):
_inherit = 'l10n_br_fiscal.document'

amount_freight_value = fields.Monetary(
inverse='_inverse_amount_freight_value'
)

amount_other_costs_value = fields.Monetary(
inverse='_inverse_amount_other_costs_value'
)

amount_insurance_value = fields.Monetary(
inverse='_inverse_amount_insurance_value'
)

@api.multi
def _inverse_amount_freight_value(self):
for record in self.filtered(lambda doc: doc.line_ids):
amount_freight_value = record.amount_freight_value
if all(record.line_ids.mapped('freight_value')):
amount_freight_old = sum(
record.line_ids.mapped('freight_value'))
for line in record.line_ids[:-1]:
line.freight_value = amount_freight_value * (
line.freight_value / amount_freight_old)
record.line_ids[-1].freight_value = \
amount_freight_value - sum(
line.freight_value for line in record.line_ids[:-1])
else:
for line in record.line_ids[:-1]:
line.freight_value = amount_freight_value * (
line.amount_total / record.amount_total)
record.line_ids[-1].freight_value = \
amount_freight_value - sum(
line.freight_value for line in record.line_ids[:-1])
for line in record.line_ids:
line._onchange_fiscal_taxes()

@api.multi
def _inverse_amount_other_costs_value(self):
for record in self.filtered(lambda doc: doc.line_ids):
amount_other_costs_value = record.amount_other_costs_value
if all(record.line_ids.mapped('other_costs_value')):
amount_freight_old = sum(
record.line_ids.mapped('other_costs_value'))
for line in record.line_ids[:-1]:
line.other_costs_value = amount_other_costs_value * (
line.other_costs_value / amount_freight_old)
record.line_ids[-1].other_costs_value = \
amount_other_costs_value - sum(
line.other_costs_value
for line in record.line_ids[:-1])
else:
for line in record.line_ids[:-1]:
line.other_costs_value = amount_other_costs_value * (
line.amount_total / record.amount_total)
record.line_ids[-1].other_costs_value = \
amount_other_costs_value - sum(
line.other_costs_value
for line in record.line_ids[:-1])
for line in record.line_ids:
line._onchange_fiscal_taxes()

@api.multi
def _inverse_amount_insurance_value(self):
for record in self.filtered(lambda doc: doc.line_ids):
amount_insurance_value = record.amount_insurance_value
if all(record.line_ids.mapped('insurance_value')):
amount_freight_old = sum(
record.line_ids.mapped('insurance_value'))
for line in record.line_ids[:-1]:
line.insurance_value = amount_insurance_value * (
line.insurance_value / amount_freight_old)
record.line_ids[-1].insurance_value = \
amount_insurance_value - sum(
line.insurance_value
for line in record.line_ids[:-1])
else:
for line in record.line_ids[:-1]:
line.insurance_value = amount_insurance_value * (
line.amount_total / record.amount_total)
record.line_ids[-1].insurance_value = \
amount_insurance_value - sum(
line.insurance_value
for line in record.line_ids[:-1])
for line in record.line_ids:
line._onchange_fiscal_taxes()
136 changes: 136 additions & 0 deletions l10n_br_delivery/models/sale_order.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
# Copyright 2020 KMEE INFORMATICA LTDA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import api, fields, models, _

from odoo.exceptions import UserError


class SaleOrder(models.Model):
_inherit = 'sale.order'

amount_freight = fields.Float(
inverse='_inverse_amount_freight',
)

amount_insurance = fields.Float(
inverse='_inverse_amount_insurance',
readonly=False,
)
amount_costs = fields.Float(
inverse='_inverse_amount_costs',
readonly=False,
)

@api.multi
def set_delivery_line(self):
# Remove delivery products from the sales order
self._remove_delivery_line()

for order in self:
if order.state not in ('draft', 'sent'):
raise UserError(_(
'You can add delivery price only on unconfirmed '
'quotations.'))
elif not order.carrier_id:
raise UserError(_('No carrier set for this order.'))
elif not order.delivery_rating_success:
raise UserError(_(
'Please use "Check price" in order to compute a shipping '
'price for this quotation.'))
else:
price_unit = order.carrier_id.rate_shipment(order)['price']
order.amount_freight = price_unit
return True

@api.multi
def _inverse_amount_freight(self):
for record in self.filtered(lambda so: so.order_line):
amount_freight = record.amount_freight
if all(record.order_line.mapped('freight_value')):
amount_freight_old = sum(
record.order_line.mapped('freight_value'))
for line in record.order_line[:-1]:
line.freight_value = amount_freight * (
line.freight_value / amount_freight_old)
record.order_line[-1].freight_value = amount_freight - sum(
line.freight_value for line in record.order_line[:-1])
else:
amount_total = sum(record.order_line.mapped('price_total'))
for line in record.order_line[:-1]:
line.freight_value = amount_freight * (
line.price_total / amount_total)
record.order_line[-1].freight_value = amount_freight - sum(
line.freight_value for line in record.order_line[:-1])
for line in record.order_line:
line._onchange_fiscal_taxes()
record._fields['amount_total'].compute_value(record)
record.write({
name: value
for name, value in record._cache.items()
if record._fields[name].compute == '_amount_all' and
not record._fields[name].inverse
})

@api.multi
def _inverse_amount_insurance(self):
for record in self.filtered(lambda so: so.order_line):
amount_insurance = record.amount_insurance
if all(record.order_line.mapped('insurance_value')):
amount_insurance_old = sum(
record.order_line.mapped('insurance_value'))
for line in record.order_line[:-1]:
line.insurance_value = amount_insurance * (
line.insurance_value / amount_insurance_old)
record.order_line[-1].insurance_value = \
amount_insurance - sum(
line.insurance_value
for line in record.order_line[:-1]
)
else:
amount_total = sum(record.order_line.mapped('price_total'))
for line in record.order_line[:-1]:
line.insurance_value = amount_insurance * (
line.price_total / amount_total)
record.order_line[-1].insurance_value = \
amount_insurance - sum(
line.insurance_value
for line in record.order_line[:-1])
for line in record.order_line:
line._onchange_fiscal_taxes()
record._fields['amount_total'].compute_value(record)
record.write({
name: value
for name, value in record._cache.items()
if record._fields[name].compute == '_amount_all' and
not record._fields[name].inverse
})

@api.multi
def _inverse_amount_costs(self):
for record in self.filtered(lambda so: so.order_line):
amount_costs = record.amount_costs
if all(record.order_line.mapped('other_costs_value')):
amount_costs_old = sum(
record.order_line.mapped('other_costs_value'))
for line in record.order_line[:-1]:
line.other_costs_value = amount_costs * (
line.other_costs_value / amount_costs_old)
record.order_line[-1].other_costs_value = amount_costs - sum(
line.other_costs_value for line in record.order_line[:-1])
else:
amount_total = sum(record.order_line.mapped('price_total'))
for line in record.order_line[:-1]:
line.other_costs_value = amount_costs * (
line.price_total / amount_total)
record.order_line[-1].other_costs_value = amount_costs - sum(
line.other_costs_value for line in record.order_line[:-1])
for line in record.order_line:
line._onchange_fiscal_taxes()
record._fields['amount_total'].compute_value(record)
record.write({
name: value
for name, value in record._cache.items()
if record._fields[name].compute == '_amount_all' and
not record._fields[name].inverse
})
15 changes: 15 additions & 0 deletions l10n_br_delivery/models/stock_picking.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright 2020 KMEE INFORMATICA LTDA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import api, models


class StockPicking(models.Model):

_inherit = 'stock.picking'

@api.multi
def _add_delivery_cost_to_so(self):
# disable this function since, if called, adds a delivery line to
# order -> strategy no longer used, view amount_freight
return
1 change: 1 addition & 0 deletions l10n_br_delivery/readme/CONFIGURE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
No additional configuration is required to use this module
4 changes: 4 additions & 0 deletions l10n_br_delivery/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
* Renato Lima <[email protected]>
* Diego Paradeda <[email protected]>
* Gabriel Cardoso de Faria <[email protected]>
* Luis Otavio Malta Conceição <[email protected]>
3 changes: 3 additions & 0 deletions l10n_br_delivery/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This module was written to extend the functionality of delivery to support the
adequacy of Brazilian delivery standards
and allows you to apportion the value of freight, insurance and other costs.
1 change: 1 addition & 0 deletions l10n_br_delivery/readme/HISTORY.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Loading