mirror of
https://github.com/OCA/intrastat-extrastat.git
synced 2025-02-16 17:13:41 +02:00
[IMP] intrastat_base: is_accessory_cost is now a computed field
This commit is contained in:
@@ -1,7 +1,3 @@
|
|||||||
[checklog-odoo]
|
[checklog-odoo]
|
||||||
ignore=
|
ignore=
|
||||||
<<<<<<< before updating
|
|
||||||
WARNING.* 0 failed, 0 error\(s\).*
|
|
||||||
=======
|
|
||||||
WARNING.* 0 failed, 0 error\(s\).*
|
WARNING.* 0 failed, 0 error\(s\).*
|
||||||
>>>>>>> after updating
|
|
||||||
|
|||||||
@@ -16,9 +16,14 @@ class ProductTemplate(models.Model):
|
|||||||
],
|
],
|
||||||
compute="_compute_intrastat_type",
|
compute="_compute_intrastat_type",
|
||||||
store=True,
|
store=True,
|
||||||
|
precompute=True,
|
||||||
help="Type of product used for the intrastat declarations.",
|
help="Type of product used for the intrastat declarations.",
|
||||||
)
|
)
|
||||||
is_accessory_cost = fields.Boolean(
|
is_accessory_cost = fields.Boolean(
|
||||||
|
compute="_compute_is_accessory_cost",
|
||||||
|
store=True,
|
||||||
|
precompute=True,
|
||||||
|
readonly=False,
|
||||||
help="Activate this option for shipping costs, packaging "
|
help="Activate this option for shipping costs, packaging "
|
||||||
"costs and all services related to the sale of products. "
|
"costs and all services related to the sale of products. "
|
||||||
"This option is used for Intrastat reports.",
|
"This option is used for Intrastat reports.",
|
||||||
@@ -38,6 +43,12 @@ class ProductTemplate(models.Model):
|
|||||||
break
|
break
|
||||||
this.intrastat_type = intrastat_type
|
this.intrastat_type = intrastat_type
|
||||||
|
|
||||||
|
@api.depends("intrastat_type")
|
||||||
|
def _compute_is_accessory_cost(self):
|
||||||
|
for this in self:
|
||||||
|
if this.intrastat_type != "service":
|
||||||
|
this.is_accessory_cost = False
|
||||||
|
|
||||||
@api.constrains("intrastat_type", "is_accessory_cost")
|
@api.constrains("intrastat_type", "is_accessory_cost")
|
||||||
def _check_accessory_cost(self):
|
def _check_accessory_cost(self):
|
||||||
for this in self:
|
for this in self:
|
||||||
|
|||||||
Reference in New Issue
Block a user