Merge lp:~unifield-team/unifield-addons/uf_1204_cancel_availability_button_2 into lp:unifield-addons

Proposed by jftempo
Status: Merged
Merged at revision: 4548
Proposed branch: lp:~unifield-team/unifield-addons/uf_1204_cancel_availability_button_2
Merge into: lp:unifield-addons
Diff against target: 161 lines (+20/-28)
7 files modified
account/report/account_balance_sheet.py (+1/-1)
account/report/account_general_journal.py (+1/-1)
stock/partner_view.xml (+1/-0)
stock/stock.py (+11/-17)
stock/wizard/stock_partial_move.py (+4/-1)
stock/wizard/stock_partial_picking.py (+1/-7)
stock/wizard/stock_partial_picking_view.xml (+1/-1)
To merge this branch: bzr merge lp:~unifield-team/unifield-addons/uf_1204_cancel_availability_button_2
Reviewer Review Type Date Requested Status
UniField Dev Team Pending
Review via email: mp+115752@code.launchpad.net
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 'account/report/account_balance_sheet.py'
2--- account/report/account_balance_sheet.py 2011-06-29 05:29:28 +0000
3+++ account/report/account_balance_sheet.py 2012-07-19 14:40:35 +0000
4@@ -215,4 +215,4 @@
5 'addons/account/report/account_balance_sheet.rml',parser=report_balancesheet_horizontal,
6 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/report/account_general_journal.py'
13--- account/report/account_general_journal.py 2011-01-14 00:11:01 +0000
14+++ account/report/account_general_journal.py 2012-07-19 14:40:35 +0000
15@@ -158,4 +158,4 @@
16
17 report_sxw.report_sxw('report.account.general.journal', 'account.journal.period', 'addons/account/report/general_journal.rml', parser=journal_print, header='internal')
18
19-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
20\ No newline at end of file
21+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
22
23=== modified file 'stock/partner_view.xml'
24--- stock/partner_view.xml 2012-06-14 12:30:17 +0000
25+++ stock/partner_view.xml 2012-07-19 14:40:35 +0000
26@@ -9,6 +9,7 @@
27 <field name="name">res.partner.stock.property.form.inherit</field>
28 <field name="model">res.partner</field>
29 <field name="type">form</field>
30+ <field name="priority" eval="15"/>
31 <field name="inherit_id" ref="base.view_partner_form"/>
32 <field name="priority" eval="15" />
33 <field name="arch" type="xml">
34
35=== modified file 'stock/stock.py'
36--- stock/stock.py 2012-07-06 12:59:15 +0000
37+++ stock/stock.py 2012-07-19 14:40:35 +0000
38@@ -363,7 +363,7 @@
39 def _product_virtual_get(self, cr, uid, id, product_ids=False, context=None, states=['done']):
40 return self._product_all_get(cr, uid, id, product_ids, context, ['confirmed', 'waiting', 'assigned', 'done'])
41
42- def _product_reserve(self, cr, uid, ids, product_id, product_qty, context=None, lock=False):
43+ def _product_reserve(self, cr, uid, ids, product_id, product_qty, location_dest_id, context=None, lock=False):
44 """
45 Attempt to find a quantity ``product_qty`` (in the product's default uom or the uom passed in ``context``) of product ``product_id``
46 in locations with id ``ids`` and their child locations. If ``lock`` is True, the stock.move lines
47@@ -390,7 +390,9 @@
48 if context is None:
49 context = {}
50 pool_uom = self.pool.get('product.uom')
51- for id in self.search(cr, uid, [('location_id', 'child_of', ids)]):
52+ for id in self.search(cr, uid, [('location_id', 'child_of', ids)], order="parent_left"):
53+ if id == location_dest_id:
54+ continue
55 if lock:
56 try:
57 # Must lock with a separate select query because FOR UPDATE can't be used with
58@@ -456,13 +458,9 @@
59 if amount > 0:
60 if amount > min(total, product_qty):
61 amount = min(product_qty, total)
62- result.append((amount, id))
63- product_qty -= amount
64- total -= amount
65- if product_qty <= 0.0:
66- return result
67- if total <= 0.0:
68- continue
69+
70+ return self._hook_proct_reserve(cr,uid,product_qty,result,amount, id, ids)
71+
72 return False
73
74 stock_location()
75@@ -2029,6 +2027,7 @@
76 @return: No. of moves done
77 """
78 done = []
79+ notdone = []
80 count = 0
81 pickings = {}
82 if context is None:
83@@ -2041,7 +2040,7 @@
84 continue
85 if move.state in ('confirmed', 'waiting'):
86 # Important: we must pass lock=True to _product_reserve() to avoid race conditions and double reservations
87- res = self.pool.get('stock.location')._product_reserve(cr, uid, [move.location_id.id], move.product_id.id, move.product_qty, {'uom': move.product_uom.id}, lock=True)
88+ res = self.pool.get('stock.location')._product_reserve(cr, uid, [move.location_id.id], move.product_id.id, move.product_qty, move.location_dest_id.id ,{'uom': move.product_uom.id}, lock=True)
89 if res:
90 #_product_available_test depends on the next status for correct functioning
91 #the test does not work correctly if the same product occurs multiple times
92@@ -2053,13 +2052,8 @@
93 r = res.pop(0)
94 cr.execute('update stock_move set location_id=%s, product_qty=%s, product_uos_qty=%s where id=%s', (r[1], r[0], r[0] * move.product_id.uos_coeff, move.id))
95
96- while res:
97- r = res.pop(0)
98- move_id = self.copy(cr, uid, move.id, {'product_qty': r[0],'product_uos_qty': r[0] * move.product_id.uos_coeff,'location_id': r[1]})
99- done.append(move_id)
100- if done:
101- count += len(done)
102- self.write(cr, uid, done, {'state': 'assigned'})
103+ done, notdone = self._hook_copy_stock_move(cr, uid, res, move, done, notdone)
104+ count = self._hook_write_state_stock_move(cr, uid, done, notdone, count)
105
106 if count:
107 for pick_id in pickings:
108
109=== modified file 'stock/wizard/stock_partial_move.py'
110--- stock/wizard/stock_partial_move.py 2012-05-15 16:56:55 +0000
111+++ stock/wizard/stock_partial_move.py 2012-07-19 14:40:35 +0000
112@@ -83,6 +83,9 @@
113 return "product_moves_in"
114 else:
115 return "product_moves_out"
116+
117+ def _hook_move_state(self):
118+ return ('done', 'cancel')
119
120 def view_init(self, cr, uid, fields_list, context=None):
121 res = super(stock_partial_move, self).view_init(cr, uid, fields_list, context=context)
122@@ -91,7 +94,7 @@
123 if context is None:
124 context = {}
125 for move in move_obj.browse(cr, uid, context.get('active_ids', []), context=context):
126- if move.state in ('done', 'cancel'):
127+ if move.state in self._hook_move_state():
128 raise osv.except_osv(_('Invalid action !'), _('Cannot deliver products which are already delivered !'))
129
130 return res
131
132=== modified file 'stock/wizard/stock_partial_picking.py'
133--- stock/wizard/stock_partial_picking.py 2012-05-15 16:56:55 +0000
134+++ stock/wizard/stock_partial_picking.py 2012-07-19 14:40:35 +0000
135@@ -64,13 +64,7 @@
136 if not picking_ids:
137 return res
138
139- result = []
140- for pick in pick_obj.browse(cr, uid, picking_ids, context=context):
141- pick_type = self.get_picking_type(cr, uid, pick, context=context)
142- for m in pick.move_lines:
143- if m.state in ('done', 'cancel'):
144- continue
145- result.append(self.__create_partial_picking_memory(m, pick_type))
146+ result = self._hook_default_get(cr, uid, picking_ids, context)
147
148 if 'product_moves_in' in fields:
149 res.update({'product_moves_in': result})
150
151=== modified file 'stock/wizard/stock_partial_picking_view.xml'
152--- stock/wizard/stock_partial_picking_view.xml 2011-01-14 00:11:01 +0000
153+++ stock/wizard/stock_partial_picking_view.xml 2012-07-19 14:40:35 +0000
154@@ -8,6 +8,6 @@
155 <field name="view_mode">form</field>
156 <field name="target">new</field>
157 </record>
158+ </data>
159
160- </data>
161 </openerp>

Subscribers

People subscribed via source and target branches

to all changes: