mirror of
https://github.com/OCA/manufacture.git
synced 2025-01-28 16:37:15 +02:00
Merge pull request #126 from oihane/8.0-operations_extension
[IMP] mrp_operations_extension: new method for computing value
This commit is contained in:
@@ -56,15 +56,14 @@ class MrpProductionProductLine(models.Model):
|
||||
class MrpProductionWorkcenterLine(models.Model):
|
||||
_inherit = 'mrp.production.workcenter.line'
|
||||
|
||||
@api.one
|
||||
@api.multi
|
||||
@api.depends('move_lines', 'move_lines.state')
|
||||
def _compute_is_material_ready(self):
|
||||
self.is_material_ready = True
|
||||
if self.product_line:
|
||||
moves = self.env['stock.move'].search(
|
||||
[('work_order', '=', self.id)])
|
||||
self.is_material_ready = not any(
|
||||
for line in self:
|
||||
line.is_material_ready = (not any(
|
||||
x not in ('assigned', 'cancel', 'done') for x in
|
||||
moves.mapped('state'))
|
||||
line.mapped('move_lines.state'))
|
||||
if line.product_line else True)
|
||||
|
||||
@api.multi
|
||||
@api.depends('routing_wc_line')
|
||||
|
||||
@@ -156,6 +156,7 @@ class TestMrpOperationsExtension(common.TransactionCase):
|
||||
self.production.action_confirm()
|
||||
|
||||
def test_confirm_production_operation_extension_case1(self):
|
||||
self.assertEqual(self.production.state, 'draft')
|
||||
self.production.signal_workflow('button_confirm')
|
||||
self.assertFalse(self.production.workcenter_lines[0].is_material_ready)
|
||||
self.production.force_production()
|
||||
|
||||
Reference in New Issue
Block a user