[FIX] yml fix, need to update the system as it's not working in case of only service...
[odoo/odoo.git] / addons / mrp / test / bom_with_service_type_product.yml
1 -
2   I create Bill of Materials with one service type product and one consumable product.
3 -
4   !record {model: mrp.bom, id: mrp_bom_test1}:
5     company_id: base.main_company
6     name: PC Assemble SC234
7     product_id: product.product_product_3
8     product_qty: 1.0
9     type: normal
10     bom_lines:
11       - company_id: base.main_company
12         name: On Site Assistance
13         product_id: product.product_product_2
14         product_qty: 1.0
15       - company_id: base.main_company
16         name: GrapWorks Software
17         product_id: product.product_product_44
18         product_qty: 1.0
19 -
20   I make the production order using BoM having one service type product and one consumable product.
21 -
22   !record {model: mrp.production, id: mrp_production_servicetype_mo1}:
23     product_id: product.product_product_3
24     product_qty: 1.0
25     bom_id: mrp_bom_test1
26     date_planned: !eval time.strftime('%Y-%m-%d %H:%M:%S')
27 -
28   I compute the data of production order.
29 -
30   !python {model: mrp.production}: |
31     self.action_compute(cr, uid, [ref("mrp_production_servicetype_mo1")], {"lang": "en_US", "tz": False, "search_default_Current": 1,
32       "active_model": "ir.ui.menu", "active_ids": [ref("mrp.menu_mrp_production_action")],
33       "active_id": ref("mrp.menu_mrp_production_action"), })
34 -
35   I confirm the production order.
36 -
37   !workflow {model: mrp.production, action: button_confirm, ref: mrp_production_servicetype_mo1}
38 -
39   I reserved the product.
40 -
41   !python {model: mrp.production}: |
42     order = self.browse(cr, uid, ref("mrp_production_servicetype_mo1"))
43     assert order.state == 'confirmed', "Production order should be confirmed."
44     self.force_production(cr, uid, [order.id])
45
46 -
47   I produce product.
48 -
49   !python {model: mrp.product.produce}: |
50     context.update({'active_id': ref('mrp_production_servicetype_mo1')})
51 -
52   !record {model: mrp.product.produce, id: mrp_product_produce_1}:
53     mode: 'consume_produce'
54 -
55   !python {model: mrp.product.produce}: |
56     self.do_produce(cr, uid, [ref('mrp_product_produce_1')], context=context)
57 -
58   I check production order after produced.
59 -
60   !python {model: mrp.production}: |
61     order = self.browse(cr, uid, ref("mrp_production_servicetype_mo1"))
62     assert order.state == 'done', "Production order should be closed."
63 -
64   I create Bill of Materials with two service type products.
65 -
66   !record {model: mrp.bom, id: mrp_bom_test_2}:
67     company_id: base.main_company
68     name: PC Assemble SC234
69     product_id: product.product_product_3
70     product_qty: 1.0
71     type: normal
72     bom_lines:
73       - company_id: base.main_company
74         name: On Site Monitoring
75         product_id: product.product_product_1
76         product_qty: 1.0
77       - company_id: base.main_company
78         name: On Site Assistance
79         product_id: product.product_product_2
80         product_qty: 1.0
81 -
82   I make the production order using BoM having two service type products.
83 -
84   !record {model: mrp.production, id: mrp_production_servicetype_2}:
85     product_id: product.product_product_3
86     product_qty: 1.0
87     bom_id: mrp_bom_test_2
88     date_planned: !eval time.strftime('%Y-%m-%d %H:%M:%S')
89 -
90   I compute the data of production order.
91 -
92   !python {model: mrp.production}: |
93     self.action_compute(cr, uid, [ref("mrp_production_servicetype_2")], {"lang": "en_US", "tz": False, "search_default_Current": 1,
94       "active_model": "ir.ui.menu", "active_ids": [ref("mrp.menu_mrp_production_action")],
95       "active_id": ref("mrp.menu_mrp_production_action"), })
96 -
97   I confirm the production order.
98 -
99   !workflow {model: mrp.production, action: button_confirm, ref: mrp_production_servicetype_2}
100 -
101   Now I start production.
102 -
103   !workflow {model: mrp.production, action: button_produce, ref: mrp_production_servicetype_2}
104 -
105   I check that production order in production state after start production.
106 -
107   !python {model: mrp.production}: |
108     order = self.browse(cr, uid, ref("mrp_production_servicetype_2"))
109     assert order.state == 'in_production', 'Production order should be in production State.'
110 -
111   I produce product.
112 -
113   !python {model: mrp.product.produce}: |
114     context.update({'active_id': ref('mrp_production_servicetype_2')})
115 -
116   !record {model: mrp.product.produce, id: mrp_product_produce_2}:
117     mode: 'consume_produce'
118 -
119   !python {model: mrp.product.produce}: |
120     self.do_produce(cr, uid, [ref('mrp_product_produce_2')], context=context)
121 -
122   I check production order after produced.
123 -
124   !python {model: mrp.production}: |
125     order = self.browse(cr, uid, ref("mrp_production_servicetype_2"))
126     assert order.state == 'done', "Production order should be closed."