Skip to content

Commit

Permalink
[IMP] mrp_packaging: make compute field store=True
Browse files Browse the repository at this point in the history
  • Loading branch information
oihane committed May 29, 2017
1 parent 3c13740 commit 01cad2b
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions mrp_packaging/models/mrp_production.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class MrpProduction(models.Model):
string='Qty left for packaging', compute='_left_product_qty',
digits=dp.get_precision('Product Unit of Measure'),
help='This amount is indicative, it is calculated with packaging'
' orders that are not in canceled state.')
' orders that are not in canceled state.', store=True)

@api.multi
@api.depends('move_created_ids2')
Expand All @@ -38,7 +38,10 @@ def _final_product_qty(self):
record.final_product_qty = sum(moves.mapped('product_uom_qty'))

@api.multi
@api.depends('final_product_qty', 'expected_production')
@api.depends('move_created_ids2', 'expected_production',
'expected_production.move_lines2',
'expected_production.move_lines',
'expected_production.product_lines')
def _left_product_qty(self):
for record in self:
moves = record.mapped('move_created_ids2').filtered(
Expand Down Expand Up @@ -73,7 +76,7 @@ def get_dump_packages(self):
('product_id', '=', self.product_id.id)])
exist_prod = [x.product.id for x in self.pack]
for line in lines:
if line not in exist_prod:
if line.product_id not in exist_prod:
packs = filter(
lambda x: x not in exist_prod,
line.bom_id.product_tmpl_id.product_variant_ids.ids)
Expand Down

0 comments on commit 01cad2b

Please sign in to comment.