Add related field intrastat_fiscal_position on account.move

This commit is contained in:
Alexis de Lattre
2021-01-05 23:42:48 +01:00
parent 960f22ba52
commit 1db800dac2
5 changed files with 19 additions and 6 deletions

View File

@@ -3,3 +3,4 @@ from . import product_template
from . import res_company
from . import intrastat_common
from . import account_fiscal_position
from . import account_move

View File

@@ -11,7 +11,7 @@ class AccountFiscalPosition(models.Model):
intrastat = fields.Boolean(
string="Intrastat",
help="Set to True if the invoices with this fiscal position should "
"be taken into account for the generation of the intrastat reports."
"be taken into account for the generation of the intrastat reports.",
)
@@ -26,5 +26,5 @@ class AccountChartTemplate(models.Model):
def _get_fp_vals(self, company, position):
vals = super()._get_fp_vals(company, position)
vals['intrastat'] = position.intrastat
vals["intrastat"] = position.intrastat
return vals

View File

@@ -0,0 +1,13 @@
# Copyright 2020 Akretion France (http://www.akretion.com/)
# @author: <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import fields, models
class AccountMove(models.Model):
_inherit = "account.move"
intrastat_fiscal_position = fields.Boolean(
related="fiscal_position_id.intrastat", store=True,
string="Intrastat Fiscal Position")

View File

@@ -2,7 +2,6 @@
# Copyright 2009-2020 Noviat (http://www.noviat.com)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
import base64
import logging
from io import BytesIO
from sys import exc_info
@@ -78,7 +77,7 @@ class IntrastatCommon(models.AbstractModel):
"name": filename,
"res_id": self.id,
"res_model": self._name,
"datas": base64.encodebytes(xml_bytes),
"raw": xml_bytes,
}
)
return attach.id