summaryrefslogtreecommitdiff
path: root/addons/mrp_account
diff options
context:
space:
mode:
authorArnold Moyaux <arm@odoo.com>2020-06-09 10:37:11 +0200
committerSimon Lejeune <sle@openerp.com>2020-06-15 16:59:41 +0200
commited7012e8fd73d772bab5ecddd7781f888d4661f5 (patch)
treebf7b677aaec499b62695f61e6cdd1dae958a4fbb /addons/mrp_account
parent40603879886399a142dfc5dcf1f702fbb5ab4681 (diff)
[REF] mrp: workorders for enterprise
Removed abstract workorder Removed the integration of expiry wizard in tablet view since it should be moved in enterprise in the tablet view implementation (not possible to set consumed lot on workorders on community anymore) Refactor _set_quantity_done to use ORM command in order to not return a dict with vals to_create/to_write task-2241471
Diffstat (limited to 'addons/mrp_account')
-rw-r--r--addons/mrp_account/tests/test_mrp_account.py111
1 files changed, 108 insertions, 3 deletions
diff --git a/addons/mrp_account/tests/test_mrp_account.py b/addons/mrp_account/tests/test_mrp_account.py
index f77dbfc3c6e..f827a0eb023 100644
--- a/addons/mrp_account/tests/test_mrp_account.py
+++ b/addons/mrp_account/tests/test_mrp_account.py
@@ -1,16 +1,120 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
-from odoo.addons.mrp.tests.test_workorder_operation import TestWorkOrderProcessCommon
+from odoo.addons.mrp.tests.common import TestMrpCommon
from odoo.tests import Form
-class TestMrpAccount(TestWorkOrderProcessCommon):
+class TestMrpAccount(TestMrpCommon):
@classmethod
def setUpClass(cls):
super(TestMrpAccount, cls).setUpClass()
+ cls.source_location_id = cls.stock_location_14.id
+ cls.warehouse = cls.env.ref('stock.warehouse0')
+ # setting up alternative workcenters
+ cls.wc_alt_1 = cls.env['mrp.workcenter'].create({
+ 'name': 'Nuclear Workcenter bis',
+ 'capacity': 3,
+ 'time_start': 9,
+ 'time_stop': 5,
+ 'time_efficiency': 80,
+ })
+ cls.wc_alt_2 = cls.env['mrp.workcenter'].create({
+ 'name': 'Nuclear Workcenter ter',
+ 'capacity': 1,
+ 'time_start': 10,
+ 'time_stop': 5,
+ 'time_efficiency': 85,
+ })
+ cls.product_4.uom_id = cls.uom_unit
+ cls.planning_bom = cls.env['mrp.bom'].create({
+ 'product_id': cls.product_4.id,
+ 'product_tmpl_id': cls.product_4.product_tmpl_id.id,
+ 'product_uom_id': cls.uom_unit.id,
+ 'product_qty': 4.0,
+ 'consumption': 'flexible',
+ 'operation_ids': [
+ (0, 0, {'name': 'Gift Wrap Maching', 'workcenter_id': cls.workcenter_1.id, 'time_cycle': 15, 'sequence': 1}),
+ ],
+ 'type': 'normal',
+ 'bom_line_ids': [
+ (0, 0, {'product_id': cls.product_2.id, 'product_qty': 2}),
+ (0, 0, {'product_id': cls.product_1.id, 'product_qty': 4})
+ ]})
+ cls.dining_table = cls.env['product.product'].create({
+ 'name': 'Table (MTO)',
+ 'type': 'product',
+ 'tracking': 'serial',
+ })
+ cls.product_table_sheet = cls.env['product.product'].create({
+ 'name': 'Table Top',
+ 'type': 'product',
+ 'tracking': 'serial',
+ })
+ cls.product_table_leg = cls.env['product.product'].create({
+ 'name': 'Table Leg',
+ 'type': 'product',
+ 'tracking': 'lot',
+ })
+ cls.product_bolt = cls.env['product.product'].create({
+ 'name': 'Bolt',
+ 'type': 'product',
+ })
+ cls.product_screw = cls.env['product.product'].create({
+ 'name': 'Screw',
+ 'type': 'product',
+ })
+ cls.mrp_workcenter = cls.env['mrp.workcenter'].create({
+ 'name': 'Assembly Line 1',
+ 'resource_calendar_id': cls.env.ref('resource.resource_calendar_std').id,
+ })
+ cls.mrp_bom_desk = cls.env['mrp.bom'].create({
+ 'product_tmpl_id': cls.dining_table.product_tmpl_id.id,
+ 'product_uom_id': cls.env.ref('uom.product_uom_unit').id,
+ 'sequence': 3,
+ 'consumption': 'flexible',
+ 'operation_ids': [
+ (0, 0, {'workcenter_id': cls.mrp_workcenter.id, 'name': 'Manual Assembly'}),
+ ],
+ })
+ cls.mrp_bom_desk.write({
+ 'bom_line_ids': [
+ (0, 0, {
+ 'product_id': cls.product_table_sheet.id,
+ 'product_qty': 1,
+ 'product_uom_id': cls.env.ref('uom.product_uom_unit').id,
+ 'sequence': 1,
+ 'operation_id': cls.mrp_bom_desk.operation_ids.id}),
+ (0, 0, {
+ 'product_id': cls.product_table_leg.id,
+ 'product_qty': 4,
+ 'product_uom_id': cls.env.ref('uom.product_uom_unit').id,
+ 'sequence': 2,
+ 'operation_id': cls.mrp_bom_desk.operation_ids.id}),
+ (0, 0, {
+ 'product_id': cls.product_bolt.id,
+ 'product_qty': 4,
+ 'product_uom_id': cls.env.ref('uom.product_uom_unit').id,
+ 'sequence': 3,
+ 'operation_id': cls.mrp_bom_desk.operation_ids.id}),
+ (0, 0, {
+ 'product_id': cls.product_screw.id,
+ 'product_qty': 10,
+ 'product_uom_id': cls.env.ref('uom.product_uom_unit').id,
+ 'sequence': 4,
+ 'operation_id': cls.mrp_bom_desk.operation_ids.id}),
+ ]
+ })
+ cls.mrp_workcenter_1 = cls.env['mrp.workcenter'].create({
+ 'name': 'Drill Station 1',
+ 'resource_calendar_id': cls.env.ref('resource.resource_calendar_std').id,
+ })
+ cls.mrp_workcenter_3 = cls.env['mrp.workcenter'].create({
+ 'name': 'Assembly Line 1',
+ 'resource_calendar_id': cls.env.ref('resource.resource_calendar_std').id,
+ })
cls.categ_standard = cls.env['product.category'].create({
'name': 'STANDARD',
'property_cost_method': 'standard'
@@ -66,10 +170,11 @@ class TestMrpAccount(TestWorkOrderProcessCommon):
})
inventory.action_validate
bom = self.mrp_bom_desk.copy()
+ bom.operation_ids = False
production_table_form = Form(self.env['mrp.production'])
production_table_form.product_id = self.dining_table
production_table_form.bom_id = bom
- production_table_form.product_qty = 5.0
+ production_table_form.product_qty = 1
production_table = production_table_form.save()
production_table.extra_cost = 20