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
1=== modified file 'wms/__terp__.py'
2--- wms/__terp__.py 2011-03-22 14:12:31 +0000
3+++ wms/__terp__.py 2011-08-10 13:58:30 +0000
4@@ -95,7 +95,8 @@
5 'demo/picking_crossdock_one.xml',
6 'demo/monday_round.xml',
7 'demo/burst_in.xml',
8- 'demo/burst_out.xml',
9+ #'demo/burst_out.xml', NOCOMMIT (not in this branch)
10+ 'demo/burst_out_cancelled_line.xml',
11 'demo/picking_product_reserved_1.xml',
12 ],
13 'installable': True,
14
15=== added file 'wms/demo/burst_out_cancelled_line.xml'
16--- wms/demo/burst_out_cancelled_line.xml 1970-01-01 00:00:00 +0000
17+++ wms/demo/burst_out_cancelled_line.xml 2011-08-10 13:58:30 +0000
18@@ -0,0 +1,85 @@
19+<?xml version='1.0' encoding='UTF-8'?>
20+<openerp>
21+ <data>
22+ #
23+ # Create stock picking with one cancelled line
24+ #
25+ <record model="stock.picking" id="stock_picking_burst_out_with_cancel">
26+ <field name="name">Demo for burst out</field>
27+ <field name="active" eval="True"/>
28+ <field name="address_id" ref="base.res_partner_address_12"/>
29+ <field name="invoice_state">none</field>
30+ <field name="move_lines"/>
31+ <field name="move_type">direct</field>
32+ <field name="product_id" ref="product.product_product_pc1"/>
33+ <field name="type">out</field>
34+ <field name="warehouse_id" ref="stock.warehouse0"/>
35+ </record>
36+
37+ <record model="stock.move" id="stock_move_burst_out_with_cancel_1">
38+ <field name="location_dest_id" ref="stock.stock_location_customers"/>
39+ <field name="location_id" ref="stock.stock_location_workshop"/>
40+ <field name="name">[PC1] Basic PC</field>
41+ <field name="picking_id" ref="stock_picking_burst_out_with_cancel"/>
42+ <field name="priority">1</field>
43+ <field name="product_id" ref="product.product_product_pc1"/>
44+ <field name="product_qty" eval="10.0"/>
45+ <field name="product_uom" ref="product.product_uom_unit"/>
46+ <field name="product_uos_qty" eval="10.0"/>
47+ </record>
48+
49+ <record model="stock.move" id="stock_move_burst_out_with_cancel_2">
50+ <field name="location_dest_id" ref="stock.stock_location_customers"/>
51+ <field name="location_id" ref="stock.stock_location_workshop"/>
52+ <field name="name">[PC3] Medium PC</field>
53+ <field name="picking_id" ref="stock_picking_burst_out_with_cancel"/>
54+ <field name="priority">1</field>
55+ <field name="product_id" ref="product.product_product_pc3"/>
56+ <field name="product_qty" eval="25.0"/>
57+ <field name="product_uom" ref="product.product_uom_unit"/>
58+ <field name="product_uos_qty" eval="25.0"/>
59+ <field name="state">cancel</field>
60+ </record>
61+
62+ #
63+ # Create stock burst 1 (without the cancelled line, of course)
64+ #
65+ <record model="stock.burst" id="stock_burst_out_with_cancel">
66+ <field name="line_ids"/>
67+ <field name="stock_picking_id" ref="stock_picking_burst_out_with_cancel"/>
68+ <field name="type">out</field>
69+ </record>
70+ <record model="stock.burst.line" id="stock_burst_line_out_with_cancel_1">
71+ <field name="burst_id" ref="stock_burst_out_with_cancel"/>
72+ <field name="product_id" ref="product.product_product_pc1"/>
73+ <field name="quantity" eval="10.0"/>
74+ <field name="is_done" eval="False"/>
75+ </record>
76+
77+ #
78+ # Tests
79+ #
80+ <workflow action="button_confirm" model="stock.picking" ref="stock_picking_burst_out_with_cancel"/>
81+
82+ <function name="valid_done" model="stock.burst">
83+ <value eval="[obj(ref('stock_burst_out_with_cancel')).id]" model="stock.burst"/>
84+ </function>
85+
86+ <assert id="stock_picking_burst_out_with_cancel"
87+ model="stock.picking" severity="error"
88+ string="This picking has failed">
89+ <!-- GR: reason not to check state : wkf is buggy in tests and
90+ doesn't apply the activitiy properly (action_done) -->
91+ <!--test expr="state">done</test-->
92+ <test expr="len(move_lines) == 2"/>
93+ </assert>
94+
95+ <assert id="stock_move_burst_out_with_cancel_2"
96+ model="stock.move" severity="error"
97+ string="This move line has been wrongly handled">
98+ <test expr="state">cancel</test>
99+ </assert>
100+
101+ </data>
102+
103+</openerp>
104\ No newline at end of file
105
106=== modified file 'wms/object/burst.py'
107--- wms/object/burst.py 2011-07-18 12:24:41 +0000
108+++ wms/object/burst.py 2011-08-10 13:58:30 +0000
109@@ -208,10 +208,23 @@
110 # Check for products not found in burst
111 for p, (qty, move_id) in picking_moves.items():
112 if p not in burst_lines.keys():
113+ # GR perf-wise wrong (should at least be done once for all,
114+ # ideally be available in picking_moves) but a non trivial
115+ # refactor would be necessary in order to avoid that
116+ try:
117+ missing_state = move_obj.browse(cr, uid, [move_id])[0].state
118+ except IndexError:
119+ continue
120+ # GR: functionnally meaningless. Risky to drop it ?
121 # Set quantity to 0
122- move_obj.write(cr, uid, [move_id], {'state': 'done', 'product_qty': 0}, context=context)
123- # Add to missing list
124- missing.append((move_id, qty))
125+ if missing_state != 'cancel':
126+ missing_state = 'done'
127+ move_obj.write(cr, uid, [move_id], {'state': missing_state,
128+ 'product_qty': 0},
129+ context=context)
130+ # Add to missing list GR: if not cancelled !
131+ if missing_state != 'cancel':
132+ missing.append((move_id, qty))
133
134 burst_type = self.read(cr, uid, ids, ['type'], context=context)[0]['type']
135 wf_service = netsvc.LocalService("workflow")

Subscribers

People subscribed via source and target branches