[ADD] mrp_account_bom_attribute_match

This commit is contained in:
Ivàn Todorovich
2023-01-31 10:32:24 -03:00
committed by Ilyas
parent 1022b14cea
commit db8d61f804
7 changed files with 13 additions and 99 deletions

View File

@@ -2,13 +2,13 @@
# @author Iván Todorovich <ivan.todorovich@camptocamp.com>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import models
from odoo import Command, models
class ProductProduct(models.Model):
_inherit = "product.product"
def _compute_bom_price(self, bom, boms_to_recompute=False):
def _compute_bom_price(self, bom, boms_to_recompute=False, byproduct_bom=False):
# OVERRIDE to fill in the `line.product_id` if a component template is used.
# To avoid a complete override, we HACK the bom by replacing it with a virtual
# record, and modifying it's lines on-the-fly.
@@ -30,6 +30,5 @@ class ProductProduct(models.Model):
else:
line.product_id = line_product
if to_ignore_line_ids:
for to_ignore_line_id in to_ignore_line_ids:
bom.bom_line_ids = [(3, to_ignore_line_id, 0)]
return super()._compute_bom_price(bom, boms_to_recompute)
bom.bom_line_ids = [Command.unlink(id) for id in to_ignore_line_ids]
return super()._compute_bom_price(bom, boms_to_recompute, byproduct_bom)