summaryrefslogtreecommitdiff
path: root/addons/mrp/tests/test_workorder_operation.py
diff options
context:
space:
mode:
authorWilliam Henrotin <whe@odoo.com>2019-11-06 10:09:13 +0000
committerfw-bot <otis@odoo.com>2019-11-13 17:45:51 +0000
commit643c91aba6077748a37a480d2efc8ef7a93664f8 (patch)
treeed41de63b857e755bb9a4398c9f524f6d218cd08 /addons/mrp/tests/test_workorder_operation.py
parenteea62c09c9e9d509b7e8aa9fc341af58469e8835 (diff)
[FIX] mrp: fix workcenter capacity
Planning the workorders depends on the quantity to produce of those workorder This will create as much as production batch needed regarding the workcenter capacity. This method is good except in case of product tracked by serial number. In that case the quantity to produce on the workorders is force to 1 regardless of the quantity to produce on the production closes odoo/odoo#40226 X-original-commit: 3c4133ddac256c63802a99461db49cc9bd9fa1d6 Signed-off-by: William Henrotin <Whenrow@users.noreply.github.com>
Diffstat (limited to 'addons/mrp/tests/test_workorder_operation.py')
-rw-r--r--addons/mrp/tests/test_workorder_operation.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/addons/mrp/tests/test_workorder_operation.py b/addons/mrp/tests/test_workorder_operation.py
index 3cccd8d167a..52b44901933 100644
--- a/addons/mrp/tests/test_workorder_operation.py
+++ b/addons/mrp/tests/test_workorder_operation.py
@@ -1263,6 +1263,26 @@ class TestWorkOrderProcess(TestWorkOrderProcessCommon):
self.assertAlmostEqual(wo.date_planned_start, datetime.now(), delta=timedelta(seconds=10))
self.assertAlmostEqual(wo.date_planned_finished, datetime.now(), delta=timedelta(seconds=10))
+ def test_planning_7(self):
+ """ set the workcenter capacity to 10. Produce a dozen of product tracked by
+ SN. The production should be done in two batches"""
+ self.workcenter_1.capacity = 10
+ self.workcenter_1.time_efficiency = 100
+ self.workcenter_1.time_start = 0
+ self.workcenter_1.time_stop = 0
+ self.routing_1.operation_ids.time_cycle = 60
+ self.product_4.tracking = 'serial'
+ mo_form = Form(self.env['mrp.production'])
+ mo_form.product_id = self.product_4
+ mo_form.bom_id = self.planning_bom
+ mo_form.product_uom_id = self.uom_dozen
+ mo_form.product_qty = 1
+ mo = mo_form.save()
+ mo.action_confirm()
+ mo.button_plan()
+ wo = mo.workorder_ids
+ self.assertEqual(wo.duration_expected, 120)
+
def test_plan_unplan_date(self):
""" Testing planning a workorder then cancel it and then plan it again.
The planned date must be the same the first time and the second time the