Merge lp:~zaber/openobject-addons/phantom-bom-moves into lp:openobject-addons/5.0
- phantom-bom-moves
- Merge into 5.0
Proposed by
Don Kirkby
Status: | Needs review |
---|---|
Proposed branch: | lp:~zaber/openobject-addons/phantom-bom-moves |
Merge into: | lp:openobject-addons/5.0 |
Diff against target: |
381 lines (+264/-22) 5 files modified
mrp/mrp.py (+6/-7) mrp/mrp_demo.xml (+2/-15) mrp_jit/test/mrp_jit_test.xml (+108/-0) product/product_demo.xml (+2/-0) sale/test/sale_test.xml (+146/-0) |
To merge this branch: | bzr merge lp:~zaber/openobject-addons/phantom-bom-moves |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
OpenERP Core Team | Pending | ||
Review via email: mp+45582@code.launchpad.net |
Commit message
Description of the change
Test and bug fix for bug lp:700154.
To post a comment you must log in.
Unmerged revisions
- 2881. By Don Kirkby
-
[FIX] Link move_dest_id to original phantom product move for bug lp:700154.
- 2880. By Don Kirkby
-
[FIX] Call action_confirm() to fix part of bug lp:700154.
- 2879. By Don Kirkby
-
[IMP] Add failing test for bug lp:700154 phantom BOM sales order
- 2878. By Don Kirkby
-
[MERGE] tweak demo data so that we can sell a product with a phantom BOM (PC0). Merged from phantom-
bom-workflow branch.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'mrp/mrp.py' | |||
2 | --- mrp/mrp.py 2010-12-30 06:18:22 +0000 | |||
3 | +++ mrp/mrp.py 2011-01-07 23:47:54 +0000 | |||
4 | @@ -1208,9 +1208,6 @@ | |||
5 | 1208 | factor = move.product_qty | 1208 | factor = move.product_qty |
6 | 1209 | bom_point = self.pool.get('mrp.bom').browse(cr, uid, bis[0]) | 1209 | bom_point = self.pool.get('mrp.bom').browse(cr, uid, bis[0]) |
7 | 1210 | res = self.pool.get('mrp.bom')._bom_explode(cr, uid, bom_point, factor, []) | 1210 | res = self.pool.get('mrp.bom')._bom_explode(cr, uid, bom_point, factor, []) |
8 | 1211 | state = 'confirmed' | ||
9 | 1212 | if move.state=='assigned': | ||
10 | 1213 | state='assigned' | ||
11 | 1214 | for line in res[0]: | 1211 | for line in res[0]: |
12 | 1215 | valdef = { | 1212 | valdef = { |
13 | 1216 | 'picking_id': move.picking_id.id, | 1213 | 'picking_id': move.picking_id.id, |
14 | @@ -1219,13 +1216,15 @@ | |||
15 | 1219 | 'product_qty': line['product_qty'], | 1216 | 'product_qty': line['product_qty'], |
16 | 1220 | 'product_uos': line['product_uos'], | 1217 | 'product_uos': line['product_uos'], |
17 | 1221 | 'product_uos_qty': line['product_uos_qty'], | 1218 | 'product_uos_qty': line['product_uos_qty'], |
19 | 1222 | 'state': state, | 1219 | 'state': 'draft', |
20 | 1223 | 'name': line['name'], | 1220 | 'name': line['name'], |
21 | 1221 | 'move_dest_id': move.id, | ||
22 | 1224 | 'move_history_ids': [(6,0,[move.id])], | 1222 | 'move_history_ids': [(6,0,[move.id])], |
23 | 1225 | 'move_history_ids2': [(6,0,[])], | 1223 | 'move_history_ids2': [(6,0,[])], |
24 | 1226 | 'procurements': [] | 1224 | 'procurements': [] |
25 | 1227 | } | 1225 | } |
26 | 1228 | mid = self.pool.get('stock.move').copy(cr, uid, move.id, default=valdef) | 1226 | mid = self.pool.get('stock.move').copy(cr, uid, move.id, default=valdef) |
27 | 1227 | self.action_confirm(cr, uid, [mid], context) | ||
28 | 1229 | prodobj = self.pool.get('product.product').browse(cr, uid, line['product_id'], context=context) | 1228 | prodobj = self.pool.get('product.product').browse(cr, uid, line['product_id'], context=context) |
29 | 1230 | proc_id = self.pool.get('mrp.procurement').create(cr, uid, { | 1229 | proc_id = self.pool.get('mrp.procurement').create(cr, uid, { |
30 | 1231 | 'name': (move.picking_id.origin or ''), | 1230 | 'name': (move.picking_id.origin or ''), |
31 | @@ -1272,10 +1271,10 @@ | |||
32 | 1272 | # | 1271 | # |
33 | 1273 | # Explode picking by replacing phantom BoMs | 1272 | # Explode picking by replacing phantom BoMs |
34 | 1274 | # | 1273 | # |
37 | 1275 | def action_explode(self, cr, uid, picks, *args): | 1274 | def action_explode(self, cr, uid, moves, *args): |
38 | 1276 | for move in self.pool.get('stock.move').browse(cr, uid, picks): | 1275 | for move in self.pool.get('stock.move').browse(cr, uid, moves): |
39 | 1277 | self.pool.get('stock.move')._action_explode(cr, uid, move) | 1276 | self.pool.get('stock.move')._action_explode(cr, uid, move) |
41 | 1278 | return picks | 1277 | return moves |
42 | 1279 | 1278 | ||
43 | 1280 | StockPicking() | 1279 | StockPicking() |
44 | 1281 | 1280 | ||
45 | 1282 | 1281 | ||
46 | === modified file 'mrp/mrp_demo.xml' | |||
47 | --- mrp/mrp_demo.xml 2010-02-17 12:18:07 +0000 | |||
48 | +++ mrp/mrp_demo.xml 2011-01-07 23:47:54 +0000 | |||
49 | @@ -238,12 +238,6 @@ | |||
50 | 238 | <field name="name">Complete PC with peripherals</field> | 238 | <field name="name">Complete PC with peripherals</field> |
51 | 239 | <field name="product_uom" ref="product.product_uom_unit"/> | 239 | <field name="product_uom" ref="product.product_uom_unit"/> |
52 | 240 | <field name="product_qty">1.0</field> | 240 | <field name="product_qty">1.0</field> |
53 | 241 | <field model="product.product" name="product_id" ref="product.product_product_23"/> | ||
54 | 242 | </record> | ||
55 | 243 | <record id="mrp_bom_11" model="mrp.bom"> | ||
56 | 244 | <field name="name">RAM on demand</field> | ||
57 | 245 | <field name="product_uom" ref="product.product_uom_unit"/> | ||
58 | 246 | <field name="product_qty">1.0</field> | ||
59 | 247 | <field name="type">phantom</field> | 241 | <field name="type">phantom</field> |
60 | 248 | <field model="product.product" name="product_id" ref="product.product_product_23"/> | 242 | <field model="product.product" name="product_id" ref="product.product_product_23"/> |
61 | 249 | </record> | 243 | </record> |
62 | @@ -260,9 +254,9 @@ | |||
63 | 260 | <field name="name">Kit Mouse</field> | 254 | <field name="name">Kit Mouse</field> |
64 | 261 | <field name="product_uom" ref="product.product_uom_unit"/> | 255 | <field name="product_uom" ref="product.product_uom_unit"/> |
65 | 262 | <field name="product_qty">1.0</field> | 256 | <field name="product_qty">1.0</field> |
67 | 263 | <field name="type">normal</field> | 257 | <field name="type">phantom</field> |
68 | 264 | <field name="bom_id" ref="mrp_bom_10"/> | 258 | <field name="bom_id" ref="mrp_bom_10"/> |
70 | 265 | <field model="product.product" name="product_id" ref="product.product_product_25"/> | 259 | <field model="product.product" name="product_id" ref="product.product_product_26"/> |
71 | 266 | </record> | 260 | </record> |
72 | 267 | <record id="mrp_bom_clavier" model="mrp.bom"> | 261 | <record id="mrp_bom_clavier" model="mrp.bom"> |
73 | 268 | <field name="name">Keyboard</field> | 262 | <field name="name">Keyboard</field> |
74 | @@ -306,13 +300,6 @@ | |||
75 | 306 | <field name="bom_id" ref="mrp_bom_13"/> | 300 | <field name="bom_id" ref="mrp_bom_13"/> |
76 | 307 | <field model="product.product" name="product_id" ref="product.product_product_fan"/> | 301 | <field model="product.product" name="product_id" ref="product.product_product_fan"/> |
77 | 308 | </record> | 302 | </record> |
78 | 309 | <record id="mrp_bom_23" model="mrp.bom"> | ||
79 | 310 | <field name="name">DDR 256MB PC333</field> | ||
80 | 311 | <field name="product_uom" ref="product.product_uom_unit"/> | ||
81 | 312 | <field name="product_qty">1.0</field> | ||
82 | 313 | <field name="bom_id" ref="mrp_bom_11"/> | ||
83 | 314 | <field model="product.product" name="product_id" ref="product.product_product_ram"/> | ||
84 | 315 | </record> | ||
85 | 316 | <record id="mrp_bom_1901" model="mrp.bom"> | 303 | <record id="mrp_bom_1901" model="mrp.bom"> |
86 | 317 | <field name="name">DDR 512MB PC400</field> | 304 | <field name="name">DDR 512MB PC400</field> |
87 | 318 | <field name="product_uom" ref="product.product_uom_unit"/> | 305 | <field name="product_uom" ref="product.product_uom_unit"/> |
88 | 319 | 306 | ||
89 | === modified file 'mrp_jit/test/mrp_jit_test.xml' | |||
90 | --- mrp_jit/test/mrp_jit_test.xml 2010-03-11 13:05:02 +0000 | |||
91 | +++ mrp_jit/test/mrp_jit_test.xml 2011-01-07 23:47:54 +0000 | |||
92 | @@ -166,6 +166,114 @@ | |||
93 | 166 | <assert id="smoke_test_sale_order" model="sale.order" string="the sale order is now done"> | 166 | <assert id="smoke_test_sale_order" model="sale.order" string="the sale order is now done"> |
94 | 167 | <test expr="state">done</test> | 167 | <test expr="state">done</test> |
95 | 168 | </assert> | 168 | </assert> |
96 | 169 | |||
97 | 170 | |||
98 | 171 | |||
99 | 172 | <!-- ================================================================ | ||
100 | 173 | Test phantom bill of materials with MRP-JIT installed, | ||
101 | 174 | based on a similar smoke test in 'sale' module | ||
102 | 175 | |||
103 | 176 | 0. Check that the set product is configured correctly | ||
104 | 177 | 1. creates a simple sale order with 1 line using a set product | ||
105 | 178 | 2. confirms the sale order | ||
106 | 179 | 3. Check that a chained move got created for each component | ||
107 | 180 | 4. Check that no production order is created | ||
108 | 181 | |||
109 | 182 | ================================================================ | ||
110 | 183 | --> | ||
111 | 184 | |||
112 | 185 | <!-- ==== 0. Check that the set product is configured correctly ==== --> | ||
113 | 186 | <assert | ||
114 | 187 | id="product.product_product_23" | ||
115 | 188 | model="product.product" | ||
116 | 189 | string="The PC with peripherals product is configured as a set."> | ||
117 | 190 | <test expr="name">Complete PC With Peripherals</test> | ||
118 | 191 | <test expr="code">PC0</test> | ||
119 | 192 | <test expr="supply_method">produce</test> | ||
120 | 193 | <test expr="procure_method">make_to_order</test> | ||
121 | 194 | </assert> | ||
122 | 195 | <assert | ||
123 | 196 | id="mrp.mrp_bom_10" | ||
124 | 197 | model="mrp.bom" | ||
125 | 198 | string="The PC with peripherals product has a phantom BOM."> | ||
126 | 199 | <test expr="type">phantom</test> | ||
127 | 200 | <test expr="product_id.code">PC0</test> | ||
128 | 201 | </assert> | ||
129 | 202 | <assert | ||
130 | 203 | id="product.product_product_26" | ||
131 | 204 | model="product.product" | ||
132 | 205 | string="The keyboard + mouse product is configured as a set."> | ||
133 | 206 | <test expr="name">Kit Keyboard + Mouse</test> | ||
134 | 207 | <test expr="code">KIT0</test> | ||
135 | 208 | <test expr="supply_method">produce</test> | ||
136 | 209 | <test expr="procure_method">make_to_order</test> | ||
137 | 210 | </assert> | ||
138 | 211 | <assert | ||
139 | 212 | id="mrp.mrp_bom_kit" | ||
140 | 213 | model="mrp.bom" | ||
141 | 214 | string="The keyboard + mouse product has a phantom BOM."> | ||
142 | 215 | <test expr="type">phantom</test> | ||
143 | 216 | <test expr="product_id.code">KIT0</test> | ||
144 | 217 | </assert> | ||
145 | 218 | |||
146 | 219 | <!-- ==== 1. creates a simple sale order with 1 line using a set product ==== --> | ||
147 | 220 | <!-- Resource: sale.order --> | ||
148 | 221 | <record id="phantom_sale_order" model="sale.order"> | ||
149 | 222 | <field name="shop_id" ref="sale.shop"/> | ||
150 | 223 | <field model="product.pricelist" name="pricelist_id" search="[]"/> | ||
151 | 224 | <field name="user_id" ref="base.user_root"/> | ||
152 | 225 | <field model="res.partner" name="partner_id" search="[]"/> | ||
153 | 226 | <field name="order_policy">manual</field> <!-- force manual invoicing --> | ||
154 | 227 | <field name="picking_policy">one</field> <!-- full delivery only --> | ||
155 | 228 | <field name="invoice_quantity">order</field> <!-- invoice based on ordered quantities --> | ||
156 | 229 | <field model="res.partner.address" name="partner_invoice_id" search="[]"/> | ||
157 | 230 | <field model="res.partner.address" name="partner_shipping_id" search="[]"/> | ||
158 | 231 | <field model="res.partner.address" name="partner_order_id" search="[]"/> | ||
159 | 232 | <field name="name">SO-PHANTOM-JIT</field> | ||
160 | 233 | </record> | ||
161 | 234 | <record id="phantom_sale_order_line_1" model="sale.order.line"> | ||
162 | 235 | <field name="order_id" ref="phantom_sale_order"/> | ||
163 | 236 | <field name="name">[PC0] Complete PC With Peripherals</field> | ||
164 | 237 | <field name="product_id" ref="product.product_product_23"/> | ||
165 | 238 | <field name="product_uom" ref="product.product_uom_unit"/> | ||
166 | 239 | <field name="price_unit">750</field> | ||
167 | 240 | <field name="product_uom_qty">1</field> | ||
168 | 241 | <field name="product_uos_qty">1</field> | ||
169 | 242 | <field name="type">make_to_order</field> | ||
170 | 243 | </record> | ||
171 | 244 | |||
172 | 245 | <!-- ==== 2. confirms the sale order ==== --> | ||
173 | 246 | <workflow action="order_confirm" model="sale.order" ref="phantom_sale_order"/> | ||
174 | 247 | |||
175 | 248 | <assert | ||
176 | 249 | id="phantom_sale_order" | ||
177 | 250 | model="sale.order" | ||
178 | 251 | string="the sale order is now in 'Manual in progress' state"> | ||
179 | 252 | <test expr="state">manual</test> | ||
180 | 253 | </assert> | ||
181 | 254 | |||
182 | 255 | <!-- ==== 3. Check that both packing lists contain set contents ==== --> | ||
183 | 256 | <assert | ||
184 | 257 | model="sale.order" | ||
185 | 258 | id="phantom_sale_order" | ||
186 | 259 | string="stock moves for phantom product (stock to output and output to cust)"> | ||
187 | 260 | <test expr="str(len(order_line[0].move_ids)) + ' stock moves'">7 stock moves</test> | ||
188 | 261 | <test expr="order_line[0].move_ids[0].product_id.code">PC0</test> | ||
189 | 262 | <test expr="order_line[0].move_ids[1].product_id.code + ' - ' + order_line[0].move_ids[1].picking_id.type">KEYA - out</test> | ||
190 | 263 | <test expr="order_line[0].move_ids[2].product_id.code + ' - ' + order_line[0].move_ids[2].picking_id.type">KEYA - delivery</test> | ||
191 | 264 | <test expr="order_line[0].move_ids[3].product_id.code + ' - ' + order_line[0].move_ids[3].picking_id.type">MOU - out</test> | ||
192 | 265 | <test expr="order_line[0].move_ids[4].product_id.code + ' - ' + order_line[0].move_ids[4].picking_id.type">MOU - delivery</test> | ||
193 | 266 | <test expr="order_line[0].move_ids[5].product_id.code + ' - ' + order_line[0].move_ids[5].picking_id.type">PC1 - out</test> | ||
194 | 267 | <test expr="order_line[0].move_ids[6].product_id.code + ' - ' + order_line[0].move_ids[6].picking_id.type">PC1 - delivery</test> | ||
195 | 268 | </assert> | ||
196 | 269 | |||
197 | 270 | <!-- ==== 4. Check that no production order is created ==== --> | ||
198 | 271 | <assert | ||
199 | 272 | model="mrp.production" | ||
200 | 273 | search="[('product_id', '=', ref('product.product_product_23'))]" | ||
201 | 274 | string="There should not be any production orders for the set product"> | ||
202 | 275 | <test expr="False"/> | ||
203 | 276 | </assert> | ||
204 | 169 | </data> | 277 | </data> |
205 | 170 | 278 | ||
206 | 171 | <data> | 279 | <data> |
207 | 172 | 280 | ||
208 | === modified file 'product/product_demo.xml' | |||
209 | --- product/product_demo.xml 2010-04-23 13:26:04 +0000 | |||
210 | +++ product/product_demo.xml 2011-01-07 23:47:54 +0000 | |||
211 | @@ -349,6 +349,7 @@ | |||
212 | 349 | <record id="product_product_23" model="product.product"> | 349 | <record id="product_product_23" model="product.product"> |
213 | 350 | <field name="default_code">PC0</field> | 350 | <field name="default_code">PC0</field> |
214 | 351 | <field name="supply_method">produce</field> | 351 | <field name="supply_method">produce</field> |
215 | 352 | <field name="procure_method">make_to_order</field> | ||
216 | 352 | <field name="list_price">750.0</field> | 353 | <field name="list_price">750.0</field> |
217 | 353 | <field name="standard_price">500.0</field> | 354 | <field name="standard_price">500.0</field> |
218 | 354 | <field name="uom_id" ref="product_uom_unit"/> | 355 | <field name="uom_id" ref="product_uom_unit"/> |
219 | @@ -378,6 +379,7 @@ | |||
220 | 378 | <record id="product_product_26" model="product.product"> | 379 | <record id="product_product_26" model="product.product"> |
221 | 379 | <field name="default_code">KIT0</field> | 380 | <field name="default_code">KIT0</field> |
222 | 380 | <field name="supply_method">produce</field> | 381 | <field name="supply_method">produce</field> |
223 | 382 | <field name="procure_method">make_to_order</field> | ||
224 | 381 | <field name="list_price">7.0</field> | 383 | <field name="list_price">7.0</field> |
225 | 382 | <field name="standard_price">5.0</field> | 384 | <field name="standard_price">5.0</field> |
226 | 383 | <field name="uom_id" ref="product_uom_unit"/> | 385 | <field name="uom_id" ref="product_uom_unit"/> |
227 | 384 | 386 | ||
228 | === modified file 'sale/test/sale_test.xml' | |||
229 | --- sale/test/sale_test.xml 2010-06-10 13:40:19 +0000 | |||
230 | +++ sale/test/sale_test.xml 2011-01-07 23:47:54 +0000 | |||
231 | @@ -173,6 +173,152 @@ | |||
232 | 173 | <assert id="smoke_test_sale_order" model="sale.order" string="the sale order is now done"> | 173 | <assert id="smoke_test_sale_order" model="sale.order" string="the sale order is now done"> |
233 | 174 | <test expr="state">done</test> | 174 | <test expr="state">done</test> |
234 | 175 | </assert> | 175 | </assert> |
235 | 176 | |||
236 | 177 | |||
237 | 178 | <!-- ================================================================ | ||
238 | 179 | Test phantom bill of materials | ||
239 | 180 | |||
240 | 181 | 0. Check that the set product is configured correctly | ||
241 | 182 | 1. creates a simple sale order with 1 line using a set product | ||
242 | 183 | 2. confirms the sale order | ||
243 | 184 | 3. Check that a chained move got created for each component | ||
244 | 185 | 4. Check that no production order is created | ||
245 | 186 | 5. Picking: check availability | ||
246 | 187 | 6. Make the delivery | ||
247 | 188 | 7. Verify that everything is done | ||
248 | 189 | |||
249 | 190 | ================================================================ | ||
250 | 191 | --> | ||
251 | 192 | |||
252 | 193 | <!-- ==== 0. Check that the set product is configured correctly ==== --> | ||
253 | 194 | <assert | ||
254 | 195 | id="product.product_product_23" | ||
255 | 196 | model="product.product" | ||
256 | 197 | string="The PC with peripherals product is configured as a set."> | ||
257 | 198 | <test expr="name">Complete PC With Peripherals</test> | ||
258 | 199 | <test expr="code">PC0</test> | ||
259 | 200 | <test expr="supply_method">produce</test> | ||
260 | 201 | <test expr="procure_method">make_to_order</test> | ||
261 | 202 | </assert> | ||
262 | 203 | <assert | ||
263 | 204 | id="mrp.mrp_bom_10" | ||
264 | 205 | model="mrp.bom" | ||
265 | 206 | string="The PC with peripherals product has a phantom BOM."> | ||
266 | 207 | <test expr="type">phantom</test> | ||
267 | 208 | <test expr="product_id.code">PC0</test> | ||
268 | 209 | </assert> | ||
269 | 210 | <assert | ||
270 | 211 | id="product.product_product_26" | ||
271 | 212 | model="product.product" | ||
272 | 213 | string="The keyboard + mouse product is configured as a set."> | ||
273 | 214 | <test expr="name">Kit Keyboard + Mouse</test> | ||
274 | 215 | <test expr="code">KIT0</test> | ||
275 | 216 | <test expr="supply_method">produce</test> | ||
276 | 217 | <test expr="procure_method">make_to_order</test> | ||
277 | 218 | </assert> | ||
278 | 219 | <assert | ||
279 | 220 | id="mrp.mrp_bom_kit" | ||
280 | 221 | model="mrp.bom" | ||
281 | 222 | string="The keyboard + mouse product has a phantom BOM."> | ||
282 | 223 | <test expr="type">phantom</test> | ||
283 | 224 | <test expr="product_id.code">KIT0</test> | ||
284 | 225 | </assert> | ||
285 | 226 | |||
286 | 227 | <!-- ==== 1. creates a simple sale order with 1 line using a set product ==== --> | ||
287 | 228 | <!-- Resource: sale.order --> | ||
288 | 229 | <record id="phantom_sale_order" model="sale.order"> | ||
289 | 230 | <field name="shop_id" ref="shop"/> | ||
290 | 231 | <field model="product.pricelist" name="pricelist_id" search="[]"/> | ||
291 | 232 | <field name="user_id" ref="base.user_root"/> | ||
292 | 233 | <field model="res.partner" name="partner_id" search="[]"/> | ||
293 | 234 | <field name="order_policy">manual</field> <!-- force manual invoicing --> | ||
294 | 235 | <field name="picking_policy">one</field> <!-- full delivery only --> | ||
295 | 236 | <field name="invoice_quantity">order</field> <!-- invoice based on ordered quantities --> | ||
296 | 237 | <field model="res.partner.address" name="partner_invoice_id" search="[]"/> | ||
297 | 238 | <field model="res.partner.address" name="partner_shipping_id" search="[]"/> | ||
298 | 239 | <field model="res.partner.address" name="partner_order_id" search="[]"/> | ||
299 | 240 | <field name="name">SO-PHANTOM</field> | ||
300 | 241 | </record> | ||
301 | 242 | <record id="phantom_sale_order_line_1" model="sale.order.line"> | ||
302 | 243 | <field name="order_id" ref="phantom_sale_order"/> | ||
303 | 244 | <field name="name">[PC0] Complete PC With Peripherals</field> | ||
304 | 245 | <field name="product_id" ref="product.product_product_23"/> | ||
305 | 246 | <field name="product_uom" ref="product.product_uom_unit"/> | ||
306 | 247 | <field name="price_unit">750</field> | ||
307 | 248 | <field name="product_uom_qty">1</field> | ||
308 | 249 | <field name="product_uos_qty">1</field> | ||
309 | 250 | <field name="type">make_to_order</field> | ||
310 | 251 | </record> | ||
311 | 252 | |||
312 | 253 | <!-- ==== 2. confirms the sale order ==== --> | ||
313 | 254 | <workflow action="order_confirm" model="sale.order" ref="phantom_sale_order"/> | ||
314 | 255 | |||
315 | 256 | <assert | ||
316 | 257 | id="phantom_sale_order" | ||
317 | 258 | model="sale.order" | ||
318 | 259 | string="the sale order is now in 'Manual in progress' state"> | ||
319 | 260 | <test expr="state">manual</test> | ||
320 | 261 | </assert> | ||
321 | 262 | |||
322 | 263 | <!-- ==== 3. Check that a chained move got created for each component ==== --> | ||
323 | 264 | <assert | ||
324 | 265 | model="sale.order" | ||
325 | 266 | id="phantom_sale_order" | ||
326 | 267 | string="stock moves for phantom product (stock to output and output to cust)"> | ||
327 | 268 | <test expr="str(len(order_line[0].move_ids)) + ' stock moves'">7 stock moves</test> | ||
328 | 269 | <test expr="order_line[0].move_ids[0].product_id.code">PC0</test> | ||
329 | 270 | <test expr="order_line[0].move_ids[1].product_id.code + ' - ' + order_line[0].move_ids[1].picking_id.type">KEYA - out</test> | ||
330 | 271 | <test expr="order_line[0].move_ids[2].product_id.code + ' - ' + order_line[0].move_ids[2].picking_id.type">KEYA - delivery</test> | ||
331 | 272 | <test expr="order_line[0].move_ids[3].product_id.code + ' - ' + order_line[0].move_ids[3].picking_id.type">MOU - out</test> | ||
332 | 273 | <test expr="order_line[0].move_ids[4].product_id.code + ' - ' + order_line[0].move_ids[4].picking_id.type">MOU - delivery</test> | ||
333 | 274 | <test expr="order_line[0].move_ids[5].product_id.code + ' - ' + order_line[0].move_ids[5].picking_id.type">PC1 - out</test> | ||
334 | 275 | <test expr="order_line[0].move_ids[6].product_id.code + ' - ' + order_line[0].move_ids[6].picking_id.type">PC1 - delivery</test> | ||
335 | 276 | </assert> | ||
336 | 277 | |||
337 | 278 | <!-- ==== 4. Check that no production order is created ==== --> | ||
338 | 279 | <assert | ||
339 | 280 | model="mrp.production" | ||
340 | 281 | search="[('product_id', '=', ref('product.product_product_23'))]" | ||
341 | 282 | string="There should not be any production orders for the set product"> | ||
342 | 283 | <test expr="False"/> | ||
343 | 284 | </assert> | ||
344 | 285 | <!-- ==== 5. Picking: check availability ==== --> | ||
345 | 286 | <!-- Here we need to directly call the function tag because action_assign is a method of stock_picking and not part of the workflow --> | ||
346 | 287 | <function model="stock.picking" name="action_assign"> | ||
347 | 288 | <value eval="[obj(ref('phantom_sale_order')).picking_ids[0].id]" model="sale.order"/> | ||
348 | 289 | </function> | ||
349 | 290 | <assert id="phantom_sale_order" model="sale.order" severity="error" string="the sale order's picking is now assigned"> | ||
350 | 291 | <test expr="picking_ids[0].state">assigned</test> | ||
351 | 292 | </assert> | ||
352 | 293 | |||
353 | 294 | <!-- The above step could also be replaced by the following call to the mrp schedulers: --> | ||
354 | 295 | <!-- <function model="mrp.procurement" name="run_scheduler"/> --> | ||
355 | 296 | |||
356 | 297 | <!-- ==== 6. Make the delivery ==== --> | ||
357 | 298 | <!-- See wizard_picking_make or wizard_partial_picking in stock module. --> | ||
358 | 299 | <function model="stock.picking" name="action_move"> | ||
359 | 300 | <value eval="[obj(ref('phantom_sale_order')).picking_ids[0].id]" model="sale.order"/> | ||
360 | 301 | </function> | ||
361 | 302 | <workflow action="button_done" model="stock.picking"> | ||
362 | 303 | <value eval="obj(ref('phantom_sale_order')).picking_ids[0].id" model="sale.order"/> | ||
363 | 304 | </workflow> | ||
364 | 305 | <function model="stock.picking" name="action_move"> | ||
365 | 306 | <value eval="[obj(ref('phantom_sale_order')).order_line[0].move_ids[6].picking_id.id]" model="sale.order"/> | ||
366 | 307 | </function> | ||
367 | 308 | <workflow action="button_done" model="stock.picking"> | ||
368 | 309 | <value eval="obj(ref('phantom_sale_order')).order_line[0].move_ids[6].picking_id.id" model="sale.order"/> | ||
369 | 310 | </workflow> | ||
370 | 311 | |||
371 | 312 | |||
372 | 313 | <!-- ==== 7. Verify that everything is done ==== --> | ||
373 | 314 | <assert id="phantom_sale_order" model="sale.order" string="the main procurement is now done"> | ||
374 | 315 | <test expr="order_line[0].procurement_id.state">done</test> | ||
375 | 316 | </assert> | ||
376 | 317 | <assert id="phantom_sale_order" model="sale.order" string="the sale order's picking is now done"> | ||
377 | 318 | <test expr="picking_ids[0].state">done</test> | ||
378 | 319 | <test expr="order_line[0].move_ids[3].picking_id.state">done</test> | ||
379 | 320 | <test expr="shipped == True"/> | ||
380 | 321 | </assert> | ||
381 | 176 | </data> | 322 | </data> |
382 | 177 | 323 | ||
383 | 178 | 324 |