Merge lp:~openerp-dev/openobject-addons/6.0-opw-381990-han into lp:openobject-addons/6.0

Proposed by Hardik Ansodariya (OpenERP)
Status: Rejected
Rejected by: Naresh(OpenERP)
Proposed branch: lp:~openerp-dev/openobject-addons/6.0-opw-381990-han
Merge into: lp:openobject-addons/6.0
Diff against target: 73 lines (+14/-5)
4 files modified
account/report/account_tax_report.py (+1/-1)
account/wizard/account_vat.py (+3/-3)
stock/stock.py (+8/-0)
stock/wizard/stock_return_picking.py (+2/-1)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/6.0-opw-381990-han
Reviewer Review Type Date Requested Status
Naresh(OpenERP) (community) Disapprove
nel Pending
Hardik Ansodariya (OpenERP) Pending
Rifakat Husen (OpenERP) Pending
Vinay Rana (OpenERP) Pending
Review via email: mp+92258@code.launchpad.net

This proposal supersedes a proposal from 2012-02-02.

Description of the change

Hello,

Fixed the issue Problem with side effect of automatic chaining moves

Thanks
Hardik

To post a comment you must log in.
Revision history for this message
Rifakat Husen (OpenERP) (rha-openerp) wrote : Posted in a previous version of this proposal

Hello,

I have applied this scenario of 2 level chaining location and getting wrong result,
Stock (chaining location: Shop 1)
Shop 1 (Chaining location: Shop 2)

Solution:
You need to go to the depth of all stock moves(move_dest_id in the move) which are chained and cancel that moves.

Feel free to ask if any doubt.

review: Needs Fixing
Revision history for this message
Rifakat Husen (OpenERP) (rha-openerp) wrote : Posted in a previous version of this proposal

Hardik,

Canceling the chaining move would not be a good practice I think.
What we can do is, try to reach to the depth of the chaining location and return picking to the supplier from that last chained location.

Indeed in you fix you tried to do that but you did not reach to the depth location.

For example, we have chaining like, stock > shop 1 > shop 2,
Currently return picking is considering from stock (creating stock -> supplier return move),
Instead we should consider the last chained location (shop 2 in this case) and create
shop 2 -> supplier return move. So ultimately it will send back goods from the final location in which we had goods priorly and our stock level will not be altered.

Kindly check all the possible test cases.

Thanks.

Revision history for this message
Hardik Ansodariya (OpenERP) (han-tinyerp) wrote : Posted in a previous version of this proposal

Hello,

i have fix the issue of depth location according to your suggestion.
kindly review it

Thanks
Hardik

review: Needs Resubmitting
Revision history for this message
Hardik Ansodariya (OpenERP) (han-tinyerp) wrote : Posted in a previous version of this proposal

Hello,

I have add the method _recursive_chain_location for depth location according to your suggestion.
kindly review it

Thanks
Hardik

review: Needs Resubmitting
5032. By Hardik Ansodariya (OpenERP)

[FIX] stock_return_picking: removed useless code:(Maintanabce Case-381990)

Revision history for this message
Naresh(OpenERP) (nch-openerp) wrote :

Feature request needs a bit more check on this for all the cases so rejecting it for the stable version

Thanks,
Naresh

review: Disapprove

Unmerged revisions

5032. By Hardik Ansodariya (OpenERP)

[FIX] stock_return_picking: removed useless code:(Maintanabce Case-381990)

5031. By Hardik Ansodariya (OpenERP)

[FIX] stock_retrun_picking: Fix the depth problem of chained location : (Maintenance Case : 381990

5030. By Hardik Ansodariya (OpenERP)

[FIX] stock_location :Fix the depth problem of chained location : (Maintenance Case : 381990)

5029. By Hardik Ansodariya (OpenERP)

[FIX] stock_location :Problem with side effect of automatic chaining moves : (Maintenance Case : 381990)

5028. By Hardik Ansodariya (OpenERP)

[FIX] stock_location :Problem with side effect of automatic chaining moves : (Maintenance Case : 381990)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'account/report/account_tax_report.py'
2--- account/report/account_tax_report.py 2011-01-14 00:11:01 +0000
3+++ account/report/account_tax_report.py 2012-02-09 13:37:18 +0000
4@@ -229,4 +229,4 @@
5 report_sxw.report_sxw('report.account.vat.declaration', 'account.tax.code',
6 'addons/account/report/account_tax_report.rml', parser=tax_report, header="internal")
7
8-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
9\ No newline at end of file
10+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
11
12=== modified file 'account/wizard/account_vat.py'
13--- account/wizard/account_vat.py 2011-01-14 00:11:01 +0000
14+++ account/wizard/account_vat.py 2012-02-09 13:37:18 +0000
15@@ -35,10 +35,10 @@
16 def _get_tax(self, cr, uid, context=None):
17 taxes = self.pool.get('account.tax.code').search(cr, uid, [('parent_id', '=', False)], limit=1)
18 return taxes and taxes[0] or False
19-
20+
21 _defaults = {
22 'based_on': 'invoices',
23- 'chart_tax_id': _get_tax
24+ 'chart_tax_id': _get_tax,
25 }
26
27 def create_vat(self, cr, uid, ids, context=None):
28@@ -56,4 +56,4 @@
29
30 account_vat_declaration()
31
32-#vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
33\ No newline at end of file
34+#vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
35
36=== modified file 'stock/stock.py'
37--- stock/stock.py 2012-01-10 12:52:13 +0000
38+++ stock/stock.py 2012-02-09 13:37:18 +0000
39@@ -1648,6 +1648,14 @@
40 default = {}
41 default = default.copy()
42 return super(stock_move, self).copy(cr, uid, id, default, context=context)
43+
44+ def _recursive_chain_location(self, cr, uid, move):
45+ dest = True and move.location_dest_id
46+ while dest:
47+ final_location = dest
48+ chained_location = dest.chained_location_id
49+ dest = dest and chained_location
50+ return final_location.id
51
52 def _auto_init(self, cursor, context=None):
53 res = super(stock_move, self)._auto_init(cursor, context=context)
54
55=== modified file 'stock/wizard/stock_return_picking.py'
56--- stock/wizard/stock_return_picking.py 2011-01-18 13:41:41 +0000
57+++ stock/wizard/stock_return_picking.py 2012-02-09 13:37:18 +0000
58@@ -168,7 +168,7 @@
59 new_picking = pick_obj.copy(cr, uid, pick.id, {'name':'%s-return' % pick.name,
60 'move_lines':[], 'state':'draft', 'type':new_type,
61 'date':date_cur, 'invoice_state':data['invoice_state'],})
62- new_location=move.location_dest_id.id
63+ new_location= move_obj._recursive_chain_location(cr, uid, move)
64 if move.state=='done':
65 new_qty = data['return%s' % move.id]
66 returned_qty = move.product_qty
67@@ -215,6 +215,7 @@
68 'type':'ir.actions.act_window',
69 'context':context,
70 }
71+
72
73 stock_return_picking()
74