Merge lp:~vauxoo/addons-vauxoo/addons-vauxoo-stock_picking_cancel_move-dev-julio into lp:addons-vauxoo

Proposed by Julio Serna-http://www.vauxoo.com
Status: Merged
Merged at revision: 494
Proposed branch: lp:~vauxoo/addons-vauxoo/addons-vauxoo-stock_picking_cancel_move-dev-julio
Merge into: lp:addons-vauxoo
Diff against target: 71 lines (+52/-1)
2 files modified
stock_picking_cancel/__openerp__.py (+1/-1)
stock_picking_cancel/stock.py (+51/-0)
To merge this branch: bzr merge lp:~vauxoo/addons-vauxoo/addons-vauxoo-stock_picking_cancel_move-dev-julio
Reviewer Review Type Date Requested Status
Isaac López Zúñiga Pending
Moisés López - http://www.vauxoo.com Pending
Review via email: mp+127852@code.launchpad.net

Description of the change

cancel las polizas cuando cancelas picking o el move o la orden de produccion

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'stock_picking_cancel/__openerp__.py'
2--- stock_picking_cancel/__openerp__.py 2012-08-07 18:37:02 +0000
3+++ stock_picking_cancel/__openerp__.py 2012-10-03 19:08:24 +0000
4@@ -31,7 +31,7 @@
5 "description" : """This module add a button to cancel after to done""",
6 "website" : "http://www.vauxoo.com/",
7 "license" : "AGPL-3",
8- "depends" : ["stock",],
9+ "depends" : ["stock","account_relation_move"],
10 "init_xml" : [],
11 "demo_xml" : [],
12 "update_xml" : [
13
14=== modified file 'stock_picking_cancel/stock.py'
15--- stock_picking_cancel/stock.py 2012-08-07 18:37:02 +0000
16+++ stock_picking_cancel/stock.py 2012-10-03 19:08:24 +0000
17@@ -47,3 +47,54 @@
18 self.log(cr, uid, id, message)
19 return True
20 stock_picking()
21+
22+class stock_move(osv.osv):
23+ _inherit = 'stock.move'
24+
25+ def action_cancel(self, cr, uid, ids, context=None):
26+ account_move_line = self.pool.get('account.move.line')
27+ account_move = self.pool.get('account.move')
28+ res = super(stock_move, self).action_cancel(cr,uid,ids,context=context)
29+ result = {}
30+ for move in self.browse(cr, uid, ids, context=context):
31+ account_move_line_id = account_move_line.search(cr,uid,[('stock_move_id','=',move.id)])
32+ for move_line in account_move_line.browse(cr, uid, account_move_line_id, context=context):
33+ result.setdefault(move_line.move_id.id, move.id)
34+ for lin in result.items():
35+ try:
36+ account_move.button_cancel(cr, uid, [lin[0]], context=context)
37+ except:
38+ pass
39+ account_move.unlink(cr, uid, [lin[0]])
40+ return True
41+
42+stock_move()
43+
44+
45+
46+
47+
48+
49+
50+
51+
52+
53+
54+
55+
56+
57+
58+
59+
60+
61+
62+
63+
64+
65+
66+
67+
68+
69+
70+
71+