[FIX]:When we make a payment on a Customer refund, the field amount stay to zero...
[odoo/odoo.git] / addons / mrp_subproduct / test / mrp_subproduct.yml
1 -
2   In order to test mrp_subproduct with OpenERP, I create a bill of material with subproducts.
3   I make a production order, confirm it so stock moves for subproducts are generated.
4 -
5   I create a record for the product Chair.
6 -
7   !record {model: product.product, id: product_product_woodenchair0}:
8     categ_id: product.cat1
9     name: Wooden Chair
10     procure_method: make_to_stock
11     supply_method: produce
12     type: product
13     uom_id: product.product_uom_unit
14     uom_po_id: product.product_uom_unit
15     property_stock_inventory: stock.location_inventory
16     property_stock_procurement: stock.location_procurement
17     property_stock_production: stock.location_production
18 -
19   I create a record for the product Wood.
20 -
21   !record {model: product.product, id: product_product_wood0}:
22     categ_id: product.cat1
23     name: Wood
24     procure_method: make_to_order
25     supply_method: buy
26     property_stock_inventory: stock.location_inventory
27     property_stock_procurement: stock.location_procurement
28     property_stock_production: stock.location_production
29     seller_ids:
30       - delay: 1
31         name: base.res_partner_maxtor
32         min_qty: 300.0
33     type: product
34     uom_id: product.product_uom_unit
35     uom_po_id: product.product_uom_unit
36 -
37   I create a record for the product Nails.
38 -
39   !record {model: product.product, id: product_product_nails0}:
40     categ_id: product.cat1
41     name: Nails
42     procure_method: make_to_order
43     supply_method: buy
44     property_stock_inventory: stock.location_inventory
45     property_stock_procurement: stock.location_procurement
46     property_stock_production: stock.location_production
47     seller_ids:
48       - delay: 1
49         name: base.res_partner_asus
50         min_qty: 500.0
51     type: product
52     uom_id: product.product_uom_unit
53     uom_po_id: product.product_uom_unit
54 -
55   I create a record for the product Table.
56 -
57   !record {model: product.product, id: product_product_woodentable0}:
58     categ_id: product.cat1
59     name: Wooden Table
60     procure_method: make_to_stock
61     supply_method: produce
62     type: product
63     uom_id: product.product_uom_unit
64     uom_po_id: product.product_uom_unit
65     property_stock_inventory: stock.location_inventory
66     property_stock_procurement: stock.location_procurement
67     property_stock_production: stock.location_production
68 -
69   Now I create a bill of material for the product Wooden Chair.
70 -
71   !record {model: mrp.bom, id: mrp_bom_woodenchair0}:
72     company_id: base.main_company
73     name: Wooden Chair
74     product_efficiency: 1.0
75     product_id: product_product_woodenchair0
76     product_qty: 1.0
77     product_uom: product.product_uom_unit
78     product_uos_qty: 0.0
79     type: normal
80     bom_lines:
81       - company_id: base.main_company
82         name: Wood
83         product_efficiency: 1.0
84         product_id: product_product_wood0
85         product_qty: 10.0
86         product_uom: product.product_uom_unit
87         product_uos_qty: 0.0
88         sequence: 0.0
89         type: normal
90       - company_id: base.main_company
91         name: Nails
92         product_efficiency: 1.0
93         product_id: product_product_nails0
94         product_qty: 35.0
95         product_uom: product.product_uom_unit
96         product_uos_qty: 0.0
97         sequence: 0.0
98         type: normal
99     sub_products:
100       - product_id: product_product_woodentable0
101         product_uom: product.product_uom_unit
102         product_qty: 1.0
103         subproduct_type: fixed
104 -
105   I create a production order for Wooden Chair.
106 -
107   !record {model: mrp.production, id: mrp_production_mo0}:
108     bom_id: mrp_bom_woodenchair0
109     company_id: base.main_company
110     date_planned: !eval datetime.today().strftime("%Y-%m-%d %H:%M:%S")
111     location_dest_id: stock.stock_location_stock
112     location_src_id: stock.stock_location_stock
113     name: MO/00004
114     product_id: product_product_woodenchair0
115     product_qty: 10.0
116     product_uom: product.product_uom_unit
117     product_uos_qty: 0.0
118 -
119   I compute the data of production order.
120 -
121   !python {model: mrp.production}: |
122     self.action_compute(cr, uid, [ref("mrp_production_mo0")], {"lang": "en_US", "tz": False, "search_default_Current":
123       1, "active_model": "ir.ui.menu", "active_ids": [ref("mrp.menu_mrp_production_action")],
124       "active_id": ref("mrp.menu_mrp_production_action"), })
125 -
126   I confirm the production order.
127 -
128   !workflow {model: mrp.production, action: button_confirm, ref: mrp_production_mo0}
129 -
130   Now I check the stock moves for the subproduct I created in the bill of material.
131   This move is created automatically when I confirmed the production order.
132 -
133   !python {model: stock.move}: |
134     move_id = self.search(cr, uid, [('product_id','=',ref('product_product_woodentable0'))])
135     assert move_id, 'No moves are created !'
136 -
137   I want to start the production so I force the reservation of products.
138 -
139   !python {model: mrp.production}: |
140     self.force_production(cr, uid, [ref("mrp_production_mo0")], {"lang": "en_US", "tz": False,
141       "search_default_Current": 1, "active_model": "ir.ui.menu", "active_ids":
142       [ref("mrp.menu_mrp_production_action")], "active_id": ref("mrp.menu_mrp_production_action"),
143       })
144 -
145   I start the production.
146 -
147   !workflow {model: mrp.production, action: button_produce, ref: mrp_production_mo0}
148 -
149   I consume and produce the Production of products.
150 -
151   I create record for selecting mode and quantity of products to produce.
152 -
153   !record {model: mrp.product.produce, id: mrp_product_produce0}:
154     product_qty: 10.00
155     mode: 'consume_produce'
156 -
157   I finish the production order.
158 -
159   !python {model: mrp.product.produce}: |
160     self.do_produce(cr, uid, [ref("mrp_product_produce0")], {"lang": "en_US", "tz":
161       False, "search_default_Current": 1, "active_model": "mrp.production", "active_ids":
162       [ref("mrp_production_mo0")], "active_id": ref("mrp_production_mo0"), })
163 -
164   I see that stock moves of Wood and Nails including Wooden Table are done now.
165 -
166   !python {model: stock.move}: |
167     move_ids = self.search(cr, uid, [('product_id','in',[ref("product_product_woodentable0"),ref("product_product_wood0"),ref("product_product_nails0")])])
168     moves = self.browse(cr, uid, move_ids)
169     assert all(move.state == 'done' for move in moves), 'Moves are not done!'