mirror of
https://github.com/OCA/manufacture.git
synced 2025-01-28 16:37:15 +02:00
[ADD] mrp_account_bom_attribute_match
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user