mirror of
https://github.com/OCA/intrastat-extrastat.git
synced 2025-02-16 17:13:41 +02:00
Rename field type to declaration_type Use the new intrastat boolean of fiscal position, following issue #110 Co-authored-by: Alexis de Lattre <alexis.delattre@akretion.com>
28 lines
972 B
Python
28 lines
972 B
Python
# Copyright 2010-2020 Akretion France (http://www.akretion.com)
|
|
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
|
|
|
from odoo import fields, models
|
|
|
|
|
|
class SaleOrder(models.Model):
|
|
_inherit = "sale.order"
|
|
|
|
intrastat_transport_id = fields.Many2one(
|
|
comodel_name="intrastat.transport_mode",
|
|
string="Transport Mode",
|
|
help="This information is used in Intrastat reports",
|
|
)
|
|
intrastat = fields.Selection(
|
|
string="Intrastat Declaration", related="company_id.intrastat_dispatches"
|
|
)
|
|
|
|
def _prepare_invoice(self):
|
|
"""Copy destination country to invoice"""
|
|
vals = super()._prepare_invoice()
|
|
if self.intrastat_transport_id:
|
|
vals["intrastat_transport_id"] = self.intrastat_transport_id.id
|
|
if self.warehouse_id.region_id:
|
|
vals["src_dest_region_id"] = self.warehouse_id.region_id.id
|
|
return vals
|