mirror of
https://github.com/OCA/manufacture.git
synced 2025-01-28 16:37:15 +02:00
[FIX] mrp_bom_attribute_match: avoid recursion in BOM.
This commit is contained in:
@@ -5,6 +5,7 @@
|
|||||||
"author": "Ilyas, Ooops, Odoo Community Association (OCA)",
|
"author": "Ilyas, Ooops, Odoo Community Association (OCA)",
|
||||||
"summary": "Dynamic BOM component based on product attribute",
|
"summary": "Dynamic BOM component based on product attribute",
|
||||||
"depends": ["mrp"],
|
"depends": ["mrp"],
|
||||||
|
"maintainers": ["ilyasProgrammer", "ivantodorovich"],
|
||||||
"license": "AGPL-3",
|
"license": "AGPL-3",
|
||||||
"website": "https://github.com/OCA/manufacture",
|
"website": "https://github.com/OCA/manufacture",
|
||||||
"data": [
|
"data": [
|
||||||
|
|||||||
@@ -15,7 +15,9 @@ class MrpBomLine(models.Model):
|
|||||||
"product.product", help="Technical field to store previous value of product_id"
|
"product.product", help="Technical field to store previous value of product_id"
|
||||||
)
|
)
|
||||||
component_template_id = fields.Many2one(
|
component_template_id = fields.Many2one(
|
||||||
"product.template", "Component (product template)"
|
"product.template",
|
||||||
|
"Component (product template)",
|
||||||
|
domain="[('id', '!=', parent_product_tmpl_id)]",
|
||||||
)
|
)
|
||||||
match_on_attribute_ids = fields.Many2many(
|
match_on_attribute_ids = fields.Many2many(
|
||||||
"product.attribute",
|
"product.attribute",
|
||||||
@@ -29,6 +31,18 @@ class MrpBomLine(models.Model):
|
|||||||
compute="_compute_product_uom_category_id",
|
compute="_compute_product_uom_category_id",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@api.constrains("component_template_id")
|
||||||
|
def _check_component_template_recursion(self):
|
||||||
|
for line in self:
|
||||||
|
if line.component_template_id == line.parent_product_tmpl_id:
|
||||||
|
raise ValidationError(
|
||||||
|
_(
|
||||||
|
"Component template must be different from BOM "
|
||||||
|
"product template. Please check BOM: %s BOM Line: %s"
|
||||||
|
)
|
||||||
|
% (line, line.bom_id)
|
||||||
|
)
|
||||||
|
|
||||||
@api.depends("product_id", "component_template_id")
|
@api.depends("product_id", "component_template_id")
|
||||||
def _compute_product_uom_category_id(self):
|
def _compute_product_uom_category_id(self):
|
||||||
"""Compute the product_uom_category_id field.
|
"""Compute the product_uom_category_id field.
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
* Ooops404 <https://ooops404.com>
|
* Ooops404 <https://ooops404.com>
|
||||||
|
|
||||||
* Ilyas
|
* Ilyas <irazor147@gmail.com>
|
||||||
|
|
||||||
* `Camptocamp <https://www.camptocamp.com>`_
|
* `Camptocamp <https://www.camptocamp.com>`_
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user