Merge lp:~mathieu-julius/stock-logistic-tracking/allow_to_close_a_tracking_pack into lp:stock-logistic-tracking/6.1

Proposed by Mathieu Vatel - Julius Network Solutions
Status: Merged
Merged at revision: 12
Proposed branch: lp:~mathieu-julius/stock-logistic-tracking/allow_to_close_a_tracking_pack
Merge into: lp:stock-logistic-tracking/6.1
Diff against target: 141 lines (+17/-21)
5 files modified
stock_move_packaging/__openerp__.py (+0/-1)
stock_tracking_add_move/__openerp__.py (+0/-1)
stock_tracking_extended/__openerp__.py (+0/-1)
stock_tracking_extended/stock_tracking.py (+17/-17)
stock_tracking_reopen/__openerp__.py (+0/-1)
To merge this branch: bzr merge lp:~mathieu-julius/stock-logistic-tracking/allow_to_close_a_tracking_pack
Reviewer Review Type Date Requested Status
Alexandre Fayolle - camptocamp code review, no test Approve
Guewen Baconnier @ Camptocamp Approve
Review via email: mp+135602@code.launchpad.net

Description of the change

Sorry, it was missing one context propagation in the last merge proposal.
Propagation of context in all methods found in the file stock_tracking_extended/stock_tracking.py

To post a comment you must log in.
Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote :

Hi,

Great, looks fine to me.

On a side note, you do not need to drop and create again the merge proposal, you can push again on the branch and the merge proposal is automatically updated.

review: Approve
Revision history for this message
Alexandre Fayolle - camptocamp (alexandre-fayolle-c2c) wrote :

yep

review: Approve (code review, no test)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'stock_move_packaging/__openerp__.py'
2--- stock_move_packaging/__openerp__.py 2012-04-26 10:42:17 +0000
3+++ stock_move_packaging/__openerp__.py 2012-11-22 08:08:21 +0000
4@@ -47,5 +47,4 @@
5 'test': [],
6 'installable': True,
7 'active': False,
8- 'certificate': '',
9 }
10
11=== modified file 'stock_tracking_add_move/__openerp__.py'
12--- stock_tracking_add_move/__openerp__.py 2012-04-26 10:42:17 +0000
13+++ stock_tracking_add_move/__openerp__.py 2012-11-22 08:08:21 +0000
14@@ -50,5 +50,4 @@
15 'test': [],
16 'installable': True,
17 'active': False,
18- 'certificate': '',
19 }
20
21=== modified file 'stock_tracking_extended/__openerp__.py'
22--- stock_tracking_extended/__openerp__.py 2012-05-03 15:27:10 +0000
23+++ stock_tracking_extended/__openerp__.py 2012-11-22 08:08:21 +0000
24@@ -46,5 +46,4 @@
25 'test': [],
26 'installable': True,
27 'active': False,
28- 'certificate': '',
29 }
30
31=== modified file 'stock_tracking_extended/stock_tracking.py'
32--- stock_tracking_extended/stock_tracking.py 2012-11-02 10:27:23 +0000
33+++ stock_tracking_extended/stock_tracking.py 2012-11-22 08:08:21 +0000
34@@ -104,12 +104,12 @@
35 }
36
37 def reset_open(self, cr, uid, ids, context=None):
38- pack_ids = self.browse(cr, uid, ids, context)
39+ pack_ids = self.browse(cr, uid, ids, context=context)
40 for pack in pack_ids:
41 allowed = True
42 if pack.parent_id:
43 if pack.parent_id and pack.parent_id != 'open':
44- self.write(cr, uid, [pack.parent_id.id], {'state': 'open'})
45+ self.write(cr, uid, [pack.parent_id.id], {'state': 'open'}, context=context)
46 # allowed = False
47 # raise osv.except_osv(_('Not allowed !'),_('You can\'t re-open this pack because the parent pack is close'))
48 if allowed:
49@@ -119,11 +119,11 @@
50 raise osv.except_osv(_('Not allowed !'),_('You can\'t re-open this pack because there is at least one not closed child'))
51 break
52 if allowed:
53- self.write(cr, uid, [pack.id], {'state': 'open'})
54+ self.write(cr, uid, [pack.id], {'state': 'open'}, context=context)
55 return True
56
57 def set_close(self, cr, uid, ids, context=None):
58- pack_ids = self.browse(cr, uid, ids, context)
59+ pack_ids = self.browse(cr, uid, ids, context=context)
60 for pack in pack_ids:
61 allowed = True
62 for child in pack.child_ids:
63@@ -131,8 +131,8 @@
64 allowed = False
65 raise osv.except_osv(_('Not allowed !'),_('You can\'t close this pack because there is at least one not closed child'))
66 break
67-# if allowed:
68-# self.write(cr, uid, [pack.id], {'state': 'close'})
69+ if allowed:
70+ self.write(cr, uid, [pack.id], {'state': 'close'}, context=context)
71 return True
72
73 def get_products(self, cr, uid, ids, context=None):
74@@ -172,8 +172,8 @@
75 serial_list[x.prodlot_id.id] += x.product_qty
76 for serial in serial_list.keys():
77 if serial:
78- serial_track.create(cr, uid, {'serial_id': serial, 'quantity': serial_list[serial], 'tracking_id': child.id})
79- serial_obj.write(cr, uid, [serial], {'tracking_id': child.id})
80+ serial_track.create(cr, uid, {'serial_id': serial, 'quantity': serial_list[serial], 'tracking_id': child.id}, context=context)
81+ serial_obj.write(cr, uid, [serial], {'tracking_id': child.id}, context=context)
82 return True
83
84 stock_tracking()
85@@ -286,29 +286,29 @@
86 }
87
88 def write(self, cr, uid, ids, vals, context=None):
89- result = super(stock_move,self).write(cr, uid, ids, vals, context)
90+ result = super(stock_move,self).write(cr, uid, ids, vals, context=context)
91 if not isinstance(ids, list):
92 ids = [ids]
93 for id in ids:
94- state = self.browse(cr, uid, id, context).state
95- move_ori_id = self.browse(cr, uid, id, context).move_ori_id
96+ state = self.browse(cr, uid, id, context=context).state
97+ move_ori_id = self.browse(cr, uid, id, context=context).move_ori_id
98 if state == 'done' and move_ori_id:
99- self.write(cr, uid, [move_ori_id.id], {'state':'done'}, context)
100+ self.write(cr, uid, [move_ori_id.id], {'state':'done'}, context=context)
101 return result
102
103 def create(self, cr, uid, vals, context=None):
104 production_lot_obj = self.pool.get('stock.production.lot')
105 stock_tracking_obj = self.pool.get('stock.tracking')
106 if vals.get('prodlot_id',False):
107- production_lot_data = production_lot_obj.browse(cr, uid, vals['prodlot_id'])
108- last_production_lot_move_id = self.search(cr, uid, [('prodlot_id', '=', production_lot_data.id)], limit=1, order='date')
109+ production_lot_data = production_lot_obj.browse(cr, uid, vals['prodlot_id'], context=context)
110+ last_production_lot_move_id = self.search(cr, uid, [('prodlot_id', '=', production_lot_data.id)], limit=1, order='date', context=context)
111 if last_production_lot_move_id:
112 last_production_lot_move = self.browse(cr,uid,last_production_lot_move_id[0])
113 if last_production_lot_move.tracking_id:
114 ids = [last_production_lot_move.tracking_id.id]
115- stock_tracking_obj.reset_open(cr, uid, ids, context=None)
116+ stock_tracking_obj.reset_open(cr, uid, ids, context=context)
117
118- return super(stock_move,self).create(cr, uid, vals, context)
119+ return super(stock_move,self).create(cr, uid, vals, context=context)
120
121 stock_move()
122
123@@ -321,7 +321,7 @@
124 'use_exist': lambda *a: True,
125 }
126 def default_get(self, cr, uid, fields, context=None):
127- res = super(split_in_production_lot, self).default_get(cr, uid, fields, context)
128+ res = super(split_in_production_lot, self).default_get(cr, uid, fields, context=context)
129 res.update({'use_exist': True})
130 return res
131
132
133=== modified file 'stock_tracking_reopen/__openerp__.py'
134--- stock_tracking_reopen/__openerp__.py 2012-04-26 10:42:17 +0000
135+++ stock_tracking_reopen/__openerp__.py 2012-11-22 08:08:21 +0000
136@@ -46,5 +46,4 @@
137 'test': [],
138 'installable': True,
139 'active': False,
140- 'certificate': '',
141 }

Subscribers

People subscribed via source and target branches