Merge lp:~anybox/wms/burst-cancelled into lp:wms

Proposed by Georges Racinet on 2011-08-10
Status: Needs review
Proposed branch: lp:~anybox/wms/burst-cancelled
Merge into: lp:wms
Diff against target: 135 lines (+103/-4)
3 files modified
wms/__terp__.py (+2/-1)
wms/demo/burst_out_cancelled_line.xml (+85/-0)
wms/object/burst.py (+16/-3)
To merge this branch: bzr merge lp:~anybox/wms/burst-cancelled
Reviewer Review Type Date Requested Status
Christophe CHAUVET 2011-08-10 Needs Fixing on 2011-09-01
Review via email: mp+71049@code.launchpad.net

Description of the change

See the linked bug.

To post a comment you must log in.

Hi Georges

Can you replace the browse by a read ?

Thanks,

Regards,

review: Needs Fixing
Georges Racinet (gracinet) wrote :

> Can you replace the browse by a read ?

Sorry, forgot to extract that as well (done).

Georges

Have you push the last version for your branch ?

Regards,

Unmerged revisions

231. By Georges Racinet <gracinet@nlg> on 2011-08-10

[FIX] check state of move lines and special case for the cancelled ones.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'wms/__terp__.py'
--- wms/__terp__.py 2011-03-22 14:12:31 +0000
+++ wms/__terp__.py 2011-08-10 13:58:30 +0000
@@ -95,7 +95,8 @@
95 'demo/picking_crossdock_one.xml',95 'demo/picking_crossdock_one.xml',
96 'demo/monday_round.xml',96 'demo/monday_round.xml',
97 'demo/burst_in.xml',97 'demo/burst_in.xml',
98 'demo/burst_out.xml',98 #'demo/burst_out.xml', NOCOMMIT (not in this branch)
99 'demo/burst_out_cancelled_line.xml',
99 'demo/picking_product_reserved_1.xml',100 'demo/picking_product_reserved_1.xml',
100 ],101 ],
101 'installable': True,102 'installable': True,
102103
=== added file 'wms/demo/burst_out_cancelled_line.xml'
--- wms/demo/burst_out_cancelled_line.xml 1970-01-01 00:00:00 +0000
+++ wms/demo/burst_out_cancelled_line.xml 2011-08-10 13:58:30 +0000
@@ -0,0 +1,85 @@
1<?xml version='1.0' encoding='UTF-8'?>
2<openerp>
3 <data>
4 #
5 # Create stock picking with one cancelled line
6 #
7 <record model="stock.picking" id="stock_picking_burst_out_with_cancel">
8 <field name="name">Demo for burst out</field>
9 <field name="active" eval="True"/>
10 <field name="address_id" ref="base.res_partner_address_12"/>
11 <field name="invoice_state">none</field>
12 <field name="move_lines"/>
13 <field name="move_type">direct</field>
14 <field name="product_id" ref="product.product_product_pc1"/>
15 <field name="type">out</field>
16 <field name="warehouse_id" ref="stock.warehouse0"/>
17 </record>
18
19 <record model="stock.move" id="stock_move_burst_out_with_cancel_1">
20 <field name="location_dest_id" ref="stock.stock_location_customers"/>
21 <field name="location_id" ref="stock.stock_location_workshop"/>
22 <field name="name">[PC1] Basic PC</field>
23 <field name="picking_id" ref="stock_picking_burst_out_with_cancel"/>
24 <field name="priority">1</field>
25 <field name="product_id" ref="product.product_product_pc1"/>
26 <field name="product_qty" eval="10.0"/>
27 <field name="product_uom" ref="product.product_uom_unit"/>
28 <field name="product_uos_qty" eval="10.0"/>
29 </record>
30
31 <record model="stock.move" id="stock_move_burst_out_with_cancel_2">
32 <field name="location_dest_id" ref="stock.stock_location_customers"/>
33 <field name="location_id" ref="stock.stock_location_workshop"/>
34 <field name="name">[PC3] Medium PC</field>
35 <field name="picking_id" ref="stock_picking_burst_out_with_cancel"/>
36 <field name="priority">1</field>
37 <field name="product_id" ref="product.product_product_pc3"/>
38 <field name="product_qty" eval="25.0"/>
39 <field name="product_uom" ref="product.product_uom_unit"/>
40 <field name="product_uos_qty" eval="25.0"/>
41 <field name="state">cancel</field>
42 </record>
43
44 #
45 # Create stock burst 1 (without the cancelled line, of course)
46 #
47 <record model="stock.burst" id="stock_burst_out_with_cancel">
48 <field name="line_ids"/>
49 <field name="stock_picking_id" ref="stock_picking_burst_out_with_cancel"/>
50 <field name="type">out</field>
51 </record>
52 <record model="stock.burst.line" id="stock_burst_line_out_with_cancel_1">
53 <field name="burst_id" ref="stock_burst_out_with_cancel"/>
54 <field name="product_id" ref="product.product_product_pc1"/>
55 <field name="quantity" eval="10.0"/>
56 <field name="is_done" eval="False"/>
57 </record>
58
59 #
60 # Tests
61 #
62 <workflow action="button_confirm" model="stock.picking" ref="stock_picking_burst_out_with_cancel"/>
63
64 <function name="valid_done" model="stock.burst">
65 <value eval="[obj(ref('stock_burst_out_with_cancel')).id]" model="stock.burst"/>
66 </function>
67
68 <assert id="stock_picking_burst_out_with_cancel"
69 model="stock.picking" severity="error"
70 string="This picking has failed">
71 <!-- GR: reason not to check state : wkf is buggy in tests and
72 doesn't apply the activitiy properly (action_done) -->
73 <!--test expr="state">done</test-->
74 <test expr="len(move_lines) == 2"/>
75 </assert>
76
77 <assert id="stock_move_burst_out_with_cancel_2"
78 model="stock.move" severity="error"
79 string="This move line has been wrongly handled">
80 <test expr="state">cancel</test>
81 </assert>
82
83 </data>
84
85</openerp>
0\ No newline at end of file86\ No newline at end of file
187
=== modified file 'wms/object/burst.py'
--- wms/object/burst.py 2011-07-18 12:24:41 +0000
+++ wms/object/burst.py 2011-08-10 13:58:30 +0000
@@ -208,10 +208,23 @@
208 # Check for products not found in burst208 # Check for products not found in burst
209 for p, (qty, move_id) in picking_moves.items():209 for p, (qty, move_id) in picking_moves.items():
210 if p not in burst_lines.keys():210 if p not in burst_lines.keys():
211 # GR perf-wise wrong (should at least be done once for all,
212 # ideally be available in picking_moves) but a non trivial
213 # refactor would be necessary in order to avoid that
214 try:
215 missing_state = move_obj.browse(cr, uid, [move_id])[0].state
216 except IndexError:
217 continue
218 # GR: functionnally meaningless. Risky to drop it ?
211 # Set quantity to 0219 # Set quantity to 0
212 move_obj.write(cr, uid, [move_id], {'state': 'done', 'product_qty': 0}, context=context)220 if missing_state != 'cancel':
213 # Add to missing list221 missing_state = 'done'
214 missing.append((move_id, qty))222 move_obj.write(cr, uid, [move_id], {'state': missing_state,
223 'product_qty': 0},
224 context=context)
225 # Add to missing list GR: if not cancelled !
226 if missing_state != 'cancel':
227 missing.append((move_id, qty))
215228
216 burst_type = self.read(cr, uid, ids, ['type'], context=context)[0]['type']229 burst_type = self.read(cr, uid, ids, ['type'], context=context)[0]['type']
217 wf_service = netsvc.LocalService("workflow")230 wf_service = netsvc.LocalService("workflow")

Subscribers

People subscribed via source and target branches