Merge lp:~yann-papouin/ocb-addons/6.1-bug-1234678-return-product-backorder-false into lp:ocb-addons/6.1

Proposed by Yann Papouin
Status: Merged
Merged at revision: 6819
Proposed branch: lp:~yann-papouin/ocb-addons/6.1-bug-1234678-return-product-backorder-false
Merge into: lp:ocb-addons/6.1
Diff against target: 21 lines (+8/-3)
1 file modified
stock/wizard/stock_return_picking.py (+8/-3)
To merge this branch: bzr merge lp:~yann-papouin/ocb-addons/6.1-bug-1234678-return-product-backorder-false
Reviewer Review Type Date Requested Status
Omar (Pexego) code review Abstain
Guewen Baconnier @ Camptocamp code review Approve
Holger Brunn (Therp) code review Approve
Review via email: mp+189069@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Holger Brunn (Therp) (hbrunn) :
review: Approve (code review)
Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) :
review: Approve (code review)
Revision history for this message
Omar (Pexego) (omar7r) wrote :

Hi Yann,

backorder_id is set to False in the copy method of stock.picking object in the stock module, but only when name not in default or default['name'] == '/'. Then, I think, the good fix should be in the copy method, extract this line out of this condition, not here.

Regards

review: Needs Fixing (code review)
Revision history for this message
Yann Papouin (yann-papouin) wrote :

Hi Omar,

I don't think like you about this. The return product action is specific and that's one of the only case where we have to set the backorder_id to False as we usually keep the backorder for any picking duplicate. Hiding this operation in the copy method could be awkward for a code reader and I don't know what condition could be used for this.

Revision history for this message
Omar (Pexego) (omar7r) wrote :

H Yann,

I think that don't have any sense keep the backorder_id for duplicating picking in any case, much less, like by default, when there isn't name or name == '/' Why?

Revision history for this message
Yann Papouin (yann-papouin) wrote :

I agree with you, backorder_id should be False by design when duplicating a picking but fixing it in ocb-addons is something "too deep" as it may require more changes in other places (built-in addons and other ones) to reintroduce the backorder_id value. (note that this sentence is just an assertion, I didn't made any code search on this behavior).

Revision history for this message
Omar (Pexego) (omar7r) wrote :

OK, I agree with you in this point. If any other reviewer shares this point I approve the merge. Meanwhile I abstain.

Thanks

review: Abstain (code review)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'stock/wizard/stock_return_picking.py'
2--- stock/wizard/stock_return_picking.py 2012-06-12 16:15:51 +0000
3+++ stock/wizard/stock_return_picking.py 2013-10-03 13:13:43 +0000
4@@ -166,9 +166,14 @@
5 new_type = 'internal'
6 seq_obj_name = 'stock.picking.' + new_type
7 new_pick_name = self.pool.get('ir.sequence').get(cr, uid, seq_obj_name)
8- new_picking = pick_obj.copy(cr, uid, pick.id, {'name':'%s-%s-return' % (new_pick_name, pick.name),
9- 'move_lines':[], 'state':'draft', 'type':new_type,
10- 'date':date_cur, 'invoice_state':data['invoice_state'],})
11+ new_picking = pick_obj.copy(cr, uid, pick.id, {
12+ 'name':'%s-%s-return' % (new_pick_name, pick.name),
13+ 'move_lines':[],
14+ 'state':'draft',
15+ 'backorder_id': False,
16+ 'type':new_type,
17+ 'date':date_cur,
18+ 'invoice_state':data['invoice_state'],})
19
20 val_id = data['product_return_moves']
21 for v in val_id:

Subscribers

People subscribed via source and target branches