Merge pull request #130 from oihane/8.0-fix-real_cost

[FIX] mrp_production_real_cost: error when ending mo, fixes #124
This commit is contained in:
Pedro M. Baeza
2016-05-26 17:50:37 +02:00

View File

@@ -31,8 +31,15 @@ class MrpProduction(models.Model):
@api.multi
def action_production_end(self):
res = super(MrpProduction, self).action_production_end()
self.mapped('move_created_ids2').filtered(
lambda l: l.state == 'done').product_price_update_production_done()
for production in self:
# This is needed because commit
# https://github.com/odoo/odoo/commit/
# 6f29bfc181d23d70d29776d96b4318e9ee2c93a9
# introduces a weird behavior on the next call, provoking an error.
production.sudo().refresh()
production.mapped('move_created_ids2').filtered(
lambda l: l.state == 'done'
).product_price_update_production_done()
return res
@api.model