Skip to content

Commit

Permalink
l10n_br_sale: Add field modalidade_frete to sale.order
Browse files Browse the repository at this point in the history
  • Loading branch information
felipepaloschi committed Jul 27, 2022
1 parent 4ba6962 commit 34844f4
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
14 changes: 14 additions & 0 deletions l10n_br_sale/models/sale.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,19 @@ class SaleOrder(models.Model):
states=STATES,
)

modalidade_frete = fields.Selection(
[
("0", "0 - Contratação do Frete por conta do Remetente (CIF)"),
("1", "1 - Contratação do Frete por conta do Destinatário (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"),
],
string="Modalidade do frete",
default="9",
)

def compute_lines_partition(self, line_type):
if line_type not in ("delivery", "expense", "insurance"):
return
Expand Down Expand Up @@ -150,6 +163,7 @@ def _prepare_invoice(self):
])
quantidade_volumes = sum(len(picking.package_ids) for picking in picking_ids)
vals['quantidade_volumes'] = quantidade_volumes
vals['modalidade_frete'] = self.modalidade_frete

if self.carrier_id and self.carrier_id.partner_id:
vals["carrier_partner_id"] = self.carrier_id.partner_id
Expand Down
5 changes: 4 additions & 1 deletion l10n_br_sale/views/sale_order.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,17 @@
<record id="sale_order_delivery_insurance_expense_form" model="ir.ui.view">
<field name="name">sale.order.delivery.insurance.expense.form</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form" />
<field name="inherit_id" ref="sale_stock.view_order_form_inherit_sale_stock" />
<field name="arch" type="xml">
<field name="tax_totals_json" position="after">
<div class="oe_subtotal_footer_separator oe_inline o_td_label"></div>
<field name="l10n_br_delivery_amount" />
<field name="l10n_br_expense_amount" />
<field name="l10n_br_insurance_amount" />
</field>
<field name="picking_policy" position="before">
<field name="modalidade_frete" />
</field>
</field>
</record>
</odoo>

0 comments on commit 34844f4

Please sign in to comment.