diff options
| author | Christophe Simonis <chs@odoo.com> | 2019-06-21 15:16:54 +0200 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2019-06-21 15:16:54 +0200 |
| commit | 78b2063b29a321d152df9badb2d0324578ffe2ec (patch) | |
| tree | 8ecfa4d4acec837795d84f75c39dc10ab98929d8 /addons/sale_mrp | |
| parent | e416428669fb18b59893b63f1d9769e871ac9321 (diff) | |
| parent | 8747d72f1efbc3f32c41c20d4d3198410639d2aa (diff) | |
[MERGE] forward port branch saas-12.2 up to 8747d72f1ef
Diffstat (limited to 'addons/sale_mrp')
| -rw-r--r-- | addons/sale_mrp/tests/test_sale_mrp_flow.py | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/addons/sale_mrp/tests/test_sale_mrp_flow.py b/addons/sale_mrp/tests/test_sale_mrp_flow.py index 459892631b1..6f8710a34e8 100644 --- a/addons/sale_mrp/tests/test_sale_mrp_flow.py +++ b/addons/sale_mrp/tests/test_sale_mrp_flow.py @@ -1459,3 +1459,48 @@ class TestSaleMrpFlow(common.SavepointCase): move_component_kg = order.picking_ids[0].move_lines - move_component_unit self.assertEquals(move_component_unit.product_uom_qty, 0.5) self.assertEquals(move_component_kg.product_uom_qty, 0.583) + + def test_product_type_service_1(self): + route_manufacture = self.warehouse.manufacture_pull_id.route_id.id + route_mto = self.warehouse.mto_pull_id.route_id.id + self.uom_unit = self.env.ref('uom.product_uom_unit') + + # Create finished product + finished_product = self.env['product.product'].create({ + 'name': 'Geyser', + 'type': 'product', + 'route_ids': [(4, route_mto), (4, route_manufacture)], + }) + + # Create service type product + product_raw = self.env['product.product'].create({ + 'name': 'raw Geyser', + 'type': 'service', + }) + + # Create bom for finish product + bom = self.env['mrp.bom'].create({ + 'product_id': finished_product.id, + 'product_tmpl_id': finished_product.product_tmpl_id.id, + 'product_uom_id': self.env.ref('uom.product_uom_unit').id, + 'product_qty': 1.0, + 'type': 'normal', + 'bom_line_ids': [(5, 0), (0, 0, {'product_id': product_raw.id})] + }) + + # Create sale order + sale_form = Form(self.env['sale.order']) + sale_form.partner_id = self.env.ref('base.res_partner_1') + with sale_form.order_line.new() as line: + line.name = finished_product.name + line.product_id = finished_product + line.product_uom_qty = 1.0 + line.product_uom = self.uom_unit + line.price_unit = 10.0 + sale_order = sale_form.save() + + sale_order.action_confirm() + + mo = self.env['mrp.production'].search([('product_id', '=', finished_product.id)]) + + self.assertTrue(mo, 'Manufacturing order created.') |
