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

[12.0][REF] Delivery Costs( Freight, Insurance and Other Value ) #1301

Merged
merged 37 commits into from
Aug 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
8be8e4d
[ADD] Carrier infos
renatonlima Jan 4, 2021
e1991fa
[MOV] Moved fields Freight, Insurance and Other Costs to l10n_br_sale…
mbcosta Apr 16, 2021
5f4cf12
[IMP] Created an Parameter to define if Delivery Costs should be info…
mbcosta Apr 16, 2021
34850fe
[IMP] Demo data.
mbcosta Apr 19, 2021
da8efd7
[REM] Delivery Costs in Fiscal Document should be made by wizard Rati…
mbcosta Apr 19, 2021
bac215b
[IMP] Test case where delivery costs Insurance, Freight and Other Cos…
mbcosta Apr 19, 2021
ca3e844
[FIX] Put back objects l10n_br_delivery.carrier.vehicle and l10n_br_d…
mbcosta Apr 19, 2021
ad28786
[FIX] PEP8 and test.
mbcosta Apr 19, 2021
f4aa668
[REF] l10n_br_delivery objects
renatonlima Apr 24, 2021
55a9c34
[REF] split file by objects
renatonlima Apr 24, 2021
ca777c5
[IMP] Method name_get of incoterms return 'CODE - DESCRIPTION'.
mbcosta Apr 27, 2021
c3561c2
[IMP] Included field for amount weight and volume in sale order.
mbcosta Apr 27, 2021
1d1f747
[FIX] Recursive error when Delivery Costs By Line.
mbcosta Apr 30, 2021
2d51ad9
[FIX] Related Field can be reference another related field.
mbcosta Apr 30, 2021
7f4047a
[FIX] In name_get of incoterms return reduced name to avoid distortio…
mbcosta May 19, 2021
a76bb93
[IMP] Incoterms should been in shadow_fields to be used in Fiscal Doc…
mbcosta May 19, 2021
9fca2f8
[FIX] Delivery module has dependency on Sale, this one from Account.
mbcosta May 19, 2021
2b6cd66
[IMP] Information fiscal of freight responsibility can be defined in …
mbcosta May 19, 2021
f40ac52
[IMP] Included fields to be able to used at inherit objects.
mbcosta May 19, 2021
b904140
[FIX] Incoterm at sale.order is not defined with standard field name …
mbcosta May 19, 2021
6508230
[IMP] Included incoterm at stock picking view.
mbcosta May 19, 2021
7115a5a
[IMP] Defined to show Incoterm at Sale Order and Invoice.
mbcosta May 19, 2021
53b644d
[IMP] Demo data.
mbcosta May 19, 2021
90e0fc6
[FIX] Flake8.
mbcosta May 19, 2021
c8011b2
pylint fixes
rvalyi May 20, 2021
aeb92b6
[FIX] API definition don't needed.
mbcosta May 21, 2021
a98695d
[REF] Changed method Delivery Price to get value from amount_freight_…
mbcosta May 21, 2021
e07f039
[FIX+REF] In the tests product should have picking done to create inv…
mbcosta May 21, 2021
be2938e
[FIX] Pre commit.
mbcosta Jun 10, 2021
328c62f
[FIX] Weight field refers to Gross Weight.
mbcosta Aug 18, 2021
68f99e6
[REF] Included dependecy of module delivery_carrier_partner, less cod…
mbcosta Aug 20, 2021
61578ec
[REF] Standard name of files.
mbcosta Aug 20, 2021
200c7a8
[FIX] Amount Freight informed has preference over value calculate.
mbcosta Aug 20, 2021
26f9504
[REM][WIP] The implementation of Shipment information should be made …
mbcosta Aug 23, 2021
0cde847
[REF] Relation between Vehicle and Delivery Carrier.
mbcosta Aug 23, 2021
c9bfe1e
[IMP] Demo data.
mbcosta Aug 23, 2021
6e51974
[FIX] Depends modules.
mbcosta Aug 23, 2021
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
1 change: 1 addition & 0 deletions l10n_br_account/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@
from . import fiscal_document_line
from . import account_move
from . import account_move_line
from . import account_incoterms
27 changes: 27 additions & 0 deletions l10n_br_account/models/account_incoterms.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Copyright (C) 2021-Today - Akretion (<http://www.akretion.com>).
# @author Magno Costa <[email protected]>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import api, models


class AccountIncoterms(models.Model):
_inherit = "account.incoterms"

@api.multi
def name_get(self):
# No Brasil muitas pessoas conhecem os tipos de frete mais pelo
# Codigo do que pela descrição, por isso aqui está sendo feito
# "Codigo - Descrição" ex.:
# CIF - Custo, Seguro e Frete; FOB - Gratis a Bordo, etc
result = []
for record in self:
name = record.name
# Caso o name seja muito grande ao mostrar o campo na
# visão acaba ficando fora da tela o que dificulta a
# visualização, ao clicar em Pesquisar é mostrado o
# name completo
if len(record.name) > 150:
name = record.name[:150] + " ..."
result.append((record.id, "%s - %s" % (record.code, name)))
return result
1 change: 1 addition & 0 deletions l10n_br_account/models/account_invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"company_id",
"currency_id",
"partner_shipping_id",
"incoterm_id",
]


Expand Down
22 changes: 18 additions & 4 deletions l10n_br_delivery/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2020 KMEE INFORMATICA LTDA
# Copyright (C) 2010 Renato Lima - Akretion
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html

{
Expand All @@ -7,17 +7,31 @@
This module changes the delivery model strategy to match brazilian
standards.""",
'license': 'AGPL-3',
'author': 'KMEE,Odoo Community Association (OCA)',
'author': 'Akretion, Odoo Community Association (OCA)',
'website': 'https://github.com/OCA/l10n-brazil',
'version': '12.0.3.0.0',
'depends': [
'l10n_br_fiscal',
'l10n_br_sale_stock',
'delivery',
'delivery_carrier_partner',
],
'data': [
# Data
'data/res_config_settings_data.xml',
'data/account_incoterms_data.xml',
# View
'views/delivery_carrier_views.xml',
'views/l10n_br_delivery_view.xml',
'views/sale_order_view.xml',
"views/account_incoterms_view.xml",
'views/stock_picking_view.xml',
# Security
'security/ir.model.access.csv',
],
'demo': [
'demo/l10n_br_delivery_demo.xml',
'demo/sale_order_demo.xml',
],
'demo': [],
'category': 'Localization',
'installable': True,
}
75 changes: 75 additions & 0 deletions l10n_br_delivery/data/account_incoterms_data.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo noupdate="1">

<!-- TODO: Mapear os Tipos de Frete nos dados
MODFRETE_TRANSP = [
('0', '0 - Contratação do Frete por conta do Remetente (CIF)'),
('1', '1 - Contratação do Frete por conta do'
' destinatário/remetente (FOB)'),
('2', '2 - Contratação do Frete por conta de terceiros'),
('3', '3 - Transporte próprio por conta do remetente'),
('4', '4 - Transporte próprio por conta do destinatário'),
('9', '9 - Sem Ocorrência de transporte.'),
]

<record id="account.incoterm_EXW" model="account.incoterms">
<field name="freight_responsibility"></field>
</record>

<record id="account.incoterm_FCA" model="account.incoterms">
<field name="freight_responsibility"></field>
</record>

<record id="account.incoterm_FAS" model="account.incoterms">
<field name="freight_responsibility"></field>
</record> -->

<record id="account.incoterm_FOB" model="account.incoterms">
<field name="freight_responsibility">1</field>
</record>

<!--<record id="incoterm_CFR" model="account.incoterms">
<field name="freight_responsibility"></field>
</record> -->

<record id="account.incoterm_CIF" model="account.incoterms">
<field name="freight_responsibility">0</field>
</record>

<!--<record id="account.incoterm_CPT" model="account.incoterms">
<field name="freight_responsibility"></field>
</record>

<record id="account.incoterm_CIP" model="account.incoterms">
<field name="freight_responsibility"></field>
</record>

<record id="account.incoterm_DAF" model="account.incoterms">
<field name="freight_responsibility"></field>
</record>

<record id="account.incoterm_DES" model="account.incoterms">
<field name="freight_responsibility"></field>
</record>

<record id="account.incoterm_DEQ" model="account.incoterms">
<field name="freight_responsibility"></field>
</record>

<record id="account.incoterm_DDU" model="account.incoterms">
<field name="freight_responsibility"></field>
</record>

<record id="account.incoterm_DAT" model="account.incoterms">
<field name="freight_responsibility"></field>
</record>

<record id="account.incoterm_DAP" model="account.incoterms">
<field name="freight_responsibility"></field>
</record>

<record id="account.incoterm_DDP" model="account.incoterms">
<field name="freight_responsibility"></field>
</record> -->

</odoo>
13 changes: 13 additions & 0 deletions l10n_br_delivery/data/res_config_settings_data.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo noupdate="1">

<record id="l10n_br_delivery_config_settings" model="res.config.settings">
<field name="group_display_incoterm">True</field>
</record>

<function model="res.config.settings" name="execute">
<value model="res.config.settings"
search="[('id', '=', ref('l10n_br_delivery_config_settings'))]"/>
</function>

</odoo>
121 changes: 121 additions & 0 deletions l10n_br_delivery/demo/l10n_br_delivery_demo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo noupdate="1">

<!--
Transportadora res.partner
-->
<record id="test_carrier" model="res.partner">
<field name="name">Transportadora - Teste</field>
<field name="legal_name">Transportadora - Teste</field>
<field name="cnpj_cpf">21.221.265/0001-90</field>
<field name="street">Estrada do Caminho Velho</field>
<field name="street_number">1</field>
<field name="district">Jardim Nova Cidade</field>
<field name="street2"></field>
<field name="state_id" ref="base.state_br_sp"/>
<field name="city_id" ref="l10n_br_base.city_3518800"/>
<field name="zip">07252-312</field>
<field name="country_id" ref="base.br"/>
<field name="website">www.transportadora.com.br</field>
<field name="phone">(11) 9999-9999</field>
<field name="email">[email protected]</field>
<field name="inscr_est">115.106.496.207</field>
<field name="customer" eval="0"/>
<field name="supplier" eval="1"/>
<field name="is_company" eval="1"/>
<field name="active" eval="1"/>
</record>

<!-- Dados do Veículo -->
<record id="test_l10n_br_delivery_carrier_vehicle_1" model="l10n_br_delivery.carrier.vehicle">
<field name="name">Teste - Veículo da Transportadora 1</field>
<field name="description">Teste - Veículo da Transportadora 1</field>
<field name="plate">ABC1234</field>
<field name="driver">Teste - Motorista 1</field>
<field name="rntc_code">Teste - Codigo RTNC 1</field>
<field name="country_id" ref="base.br"/>
<field name="state_id" ref="base.state_br_sp"/>
<field name="l10n_br_city_id" ref="l10n_br_base.city_3518800"/>
<field name="active" eval="1"/>
<field name="manufacture_year">2000</field>
<field name="model_year">2001</field>
<field name="model_year">2001</field>
<field name="type">bau</field>
</record>

<record id="test_l10n_br_delivery_carrier_vehicle_2" model="l10n_br_delivery.carrier.vehicle">
<field name="name">Teste - Veículo da Transportadora 2</field>
<field name="description">Teste - Veículo da Transportadora 2</field>
<field name="plate">DEF5678</field>
<field name="driver">Teste - Motorista 2</field>
<field name="rntc_code">Teste - Codigo RTNC 2</field>
<field name="country_id" ref="base.br"/>
<field name="state_id" ref="base.state_br_sp"/>
<field name="l10n_br_city_id" ref="l10n_br_base.city_3518800"/>
<field name="active" eval="1"/>
<field name="manufacture_year">2010</field>
<field name="model_year">2011</field>
<field name="model_year">2011</field>
<field name="type">bau</field>
</record>

<!-- Metodo de Entrega -->
<record id="test_br_delivery_carrier" model="delivery.carrier">
<field name="name">Teste - l10n_br_delivery</field>
<field name="fixed_price">10.0</field>
<field name="sequence">3</field>
<field name="delivery_type">fixed</field>
<field name="product_id" ref="delivery.product_product_delivery_normal"/>
<field name="partner_id" ref="test_carrier"/>
<field name="antt_code">Teste - Código ANTT</field>
<field name="vehicle_ids" />
<field
name="vehicle_ids"
eval="[(6,0,[ref('test_l10n_br_delivery_carrier_vehicle_1'),
ref('test_l10n_br_delivery_carrier_vehicle_2'),
])]"
/>
</record>

<!-- Resource: stock.inventory -->

<record id="l10n_br_delivery_stock_inventory_0" model="stock.inventory">
<field name="name">Starting Inventory - l10n_br_delivery</field>
</record>

<!-- Resource: stock.inventory.line -->

<record id="l10n_br_delivery_stock_inventory_line_1" model="stock.inventory.line">
<field name="product_id" ref="product.product_delivery_01"/>
<field name="product_uom_id" ref="uom.product_uom_unit"/>
<field name="inventory_id" ref="l10n_br_delivery_stock_inventory_0"/>
<field name="product_qty">100</field>
<field name="location_id" ref="stock.stock_location_stock"/>
</record>

<record id="l10n_br_delivery_stock_inventory_line_2" model="stock.inventory.line">
<field name="product_id" ref="product.product_delivery_02"/>
<field name="product_uom_id" ref="uom.product_uom_unit"/>
<field name="inventory_id" ref="l10n_br_delivery_stock_inventory_0"/>
<field name="product_qty">100</field>
<field name="location_id" ref="stock.stock_location_stock"/>
</record>

<function model="stock.inventory" name="action_validate">
<function eval="[[('state','=','draft'),('id', '=', ref('l10n_br_delivery_stock_inventory_0'))]]" model="stock.inventory" name="search"/>
</function>

<!-- Physical Products -->
<!-- Office Chair -->
<record id="product.product_delivery_01" model="product.product">
<field name="weight">3.0</field>
<field name="volume">1</field>
</record>

<!-- Office Lamp -->
<record id="product.product_delivery_02" model="product.product">
<field name="weight">3.0</field>
<field name="volume">1</field>
</record>

</odoo>
67 changes: 67 additions & 0 deletions l10n_br_delivery/demo/sale_order_demo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>

<!-- Teste com Transportadora e Incoterms -->
<record id="main_so_delivery_1" model="sale.order">
<field name="name">Main l10n_br_delivery - Produtos</field>
<field name="partner_id" ref="l10n_br_base.res_partner_akretion"/>
<field name="partner_invoice_id" ref="l10n_br_base.res_partner_akretion"/>
<field name="partner_shipping_id" ref="l10n_br_base.res_partner_akretion"/>
<field name="user_id" ref="base.user_admin"/>
<field name="pricelist_id" ref="product.list0"/>
<field name="team_id" ref="sales_team.crm_team_1"/>
<field name="state">draft</field>
<field name="fiscal_operation_id" ref="l10n_br_fiscal.fo_venda"/>
<field name="note">TESTE</field>
<field name="company_id" ref="base.main_company"/>
<field name="incoterm" ref="account.incoterm_FOB"/>
<field name="carrier_id" ref="l10n_br_delivery.test_br_delivery_carrier"/>
</record>

<record id="main_sl_delivery_1_2" model="sale.order.line">
<field name="order_id" ref="main_so_delivery_1"/>
<field name="name">Office Chair</field>
<field name="product_id" ref="product.product_delivery_01"/>
<field name="product_uom_qty">2</field>
<field name="product_uom" ref="uom.product_uom_unit"/>
<field name="price_unit">500</field>
<field name="fiscal_operation_type">out</field>
<field name="fiscal_operation_id" ref="l10n_br_fiscal.fo_venda"/>
<field name="fiscal_operation_line_id" ref="l10n_br_fiscal.fo_venda_venda"/>
<field name="other_value">10</field>
<field name="freight_value">20</field>
<field name="insurance_value">30</field>
</record>

<function model="sale.order.line" name="_onchange_fiscal_operation_id">
<value eval="[ref('main_sl_delivery_1_2')]"/>
</function>

<function model="sale.order.line" name="_onchange_fiscal_operation_line_id">
<value eval="[ref('main_sl_delivery_1_2')]"/>
</function>

<record id="main_sl_delivery_2_2" model="sale.order.line">
<field name="order_id" ref="main_so_delivery_1"/>
<field name="name">Office Lamp</field>
<field name="product_id" ref="product.product_delivery_02"/>
<field name="product_uom_qty">2</field>
<field name="product_uom" ref="uom.product_uom_unit"/>
<field name="price_unit">500</field>
<field name="fiscal_operation_type">out</field>
<field name="fiscal_operation_id" ref="l10n_br_fiscal.fo_venda"/>
<field name="fiscal_operation_line_id" ref="l10n_br_fiscal.fo_venda_venda"/>
<field name="other_value">5</field>
<field name="freight_value">10</field>
<field name="insurance_value">15</field>
</record>

<function model="sale.order.line" name="_onchange_fiscal_operation_id">
<value eval="[ref('main_sl_delivery_2_2')]"/>
</function>

<function model="sale.order.line" name="_onchange_fiscal_operation_line_id">
<value eval="[ref('main_sl_delivery_2_2')]"/>
</function>

</odoo>
7 changes: 6 additions & 1 deletion l10n_br_delivery/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html

from . import delivery_carrier
from . import vehicle
from . import sale_order
from . import stock_picking
from . import document
from . import account_incoterms
from . import fiscal_document_mixin
Loading