mirror of
https://github.com/OCA/intrastat-extrastat.git
synced 2025-02-16 17:13:41 +02:00
Add related field intrastat_fiscal_position on account.move
This commit is contained in:
@@ -3,3 +3,4 @@ from . import product_template
|
|||||||
from . import res_company
|
from . import res_company
|
||||||
from . import intrastat_common
|
from . import intrastat_common
|
||||||
from . import account_fiscal_position
|
from . import account_fiscal_position
|
||||||
|
from . import account_move
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ class AccountFiscalPosition(models.Model):
|
|||||||
intrastat = fields.Boolean(
|
intrastat = fields.Boolean(
|
||||||
string="Intrastat",
|
string="Intrastat",
|
||||||
help="Set to True if the invoices with this fiscal position should "
|
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):
|
def _get_fp_vals(self, company, position):
|
||||||
vals = super()._get_fp_vals(company, position)
|
vals = super()._get_fp_vals(company, position)
|
||||||
vals['intrastat'] = position.intrastat
|
vals["intrastat"] = position.intrastat
|
||||||
return vals
|
return vals
|
||||||
|
|||||||
13
intrastat_base/models/account_move.py
Normal file
13
intrastat_base/models/account_move.py
Normal 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")
|
||||||
@@ -2,7 +2,6 @@
|
|||||||
# Copyright 2009-2020 Noviat (http://www.noviat.com)
|
# Copyright 2009-2020 Noviat (http://www.noviat.com)
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
import base64
|
|
||||||
import logging
|
import logging
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
from sys import exc_info
|
from sys import exc_info
|
||||||
@@ -78,7 +77,7 @@ class IntrastatCommon(models.AbstractModel):
|
|||||||
"name": filename,
|
"name": filename,
|
||||||
"res_id": self.id,
|
"res_id": self.id,
|
||||||
"res_model": self._name,
|
"res_model": self._name,
|
||||||
"datas": base64.encodebytes(xml_bytes),
|
"raw": xml_bytes,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
return attach.id
|
return attach.id
|
||||||
|
|||||||
Reference in New Issue
Block a user