Skip to content

Commit

Permalink
Merge PR #611 into 10.0
Browse files Browse the repository at this point in the history
Signed-off-by Cedric-Pigeon
  • Loading branch information
OCA-git-bot committed Oct 1, 2019
2 parents e92f6a6 + 4be9edb commit 8d100ea
Showing 1 changed file with 2 additions and 27 deletions.
29 changes: 2 additions & 27 deletions stock_available_mrp/models/product_product.py
Expand Up @@ -21,36 +21,11 @@ class ProductProduct(models.Model):
def _compute_available_quantities(self):
super(ProductProduct, self)._compute_available_quantities()

@api.multi
def _get_bom_id_domain(self):
"""
Real multi domain
:return:
"""
return [
'|',
('product_id', 'in', self.ids),
'&',
('product_id', '=', False),
('product_tmpl_id', 'in', self.mapped('product_tmpl_id.id'))
]

@api.multi
@api.depends('product_tmpl_id')
def _compute_bom_id(self):
bom_obj = self.env['mrp.bom']
boms = bom_obj.search(
self._get_bom_id_domain(),
order='sequence, product_id',
)
for product in self:
product_boms = boms.filtered(
lambda b: b.product_id == product or
(not b.product_id and
b.product_tmpl_id == product.product_tmpl_id)
)
if product_boms:
product.bom_id = first(product_boms)
for one in self:
one.bom_id = self.env["mrp.bom"]._bom_find(product=one)

@api.multi
def _compute_available_quantities_dict(self):
Expand Down

0 comments on commit 8d100ea

Please sign in to comment.