1
0
forked from Mapan/odoo17e
odoo17e-kedaikipas58/addons/l10n_br_edi_sale/models/sale_order.py
2024-12-10 09:04:09 +07:00

36 lines
1.3 KiB
Python

# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import models, fields
from odoo.addons.l10n_br_edi.models.account_move import FREIGHT_MODEL_SELECTION, PAYMENT_METHOD_SELECTION
class SaleOrder(models.Model):
_inherit = "sale.order"
l10n_br_edi_transporter_id = fields.Many2one(
"res.partner",
"Transporter Brazil",
help="Brazil: If you use a transport company, add its company contact here.",
)
l10n_br_edi_freight_model = fields.Selection(
FREIGHT_MODEL_SELECTION,
string="Freight Model",
help="Brazil: Used to determine the freight model used on this transaction.",
)
l10n_br_edi_payment_method = fields.Selection(
PAYMENT_METHOD_SELECTION,
string="Payment Method Brazil",
default="90", # no payment
help="Brazil: Expected payment method to be used.",
)
def _prepare_invoice(self):
res = super()._prepare_invoice()
res.update(
{
"l10n_br_edi_transporter_id": self.l10n_br_edi_transporter_id.id,
"l10n_br_edi_freight_model": self.l10n_br_edi_freight_model,
"l10n_br_edi_payment_method": self.l10n_br_edi_payment_method,
}
)
return res