Merge lp:~openerp-dev/openobject-addons/6.1-staging-mat into lp:openobject-addons/6.1

Proposed by Martin Trigaux (OpenERP)
Status: Needs review
Proposed branch: lp:~openerp-dev/openobject-addons/6.1-staging-mat
Merge into: lp:openobject-addons/6.1
Diff against target: 59 lines (+6/-6)
2 files modified
sale/sale.py (+5/-5)
stock/stock.py (+1/-1)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/6.1-staging-mat
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+187262@code.launchpad.net

Description of the change

Improve performances of confirmation of sale.stock

To post a comment you must log in.
7252. By Martin Trigaux (OpenERP)

[IMP] sale: revert commented block

7253. By Martin Trigaux (OpenERP)

[FIX] sale: initiate list

Unmerged revisions

7253. By Martin Trigaux (OpenERP)

[FIX] sale: initiate list

7252. By Martin Trigaux (OpenERP)

[IMP] sale: revert commented block

7251. By Martin Trigaux (OpenERP)

[IMP] stock: performance improvements while confirming stock moves with many lines

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'sale/sale.py'
2--- sale/sale.py 2012-10-09 12:16:14 +0000
3+++ sale/sale.py 2013-09-24 15:27:49 +0000
4@@ -817,7 +817,7 @@
5 picking_obj = self.pool.get('stock.picking')
6 procurement_obj = self.pool.get('procurement.order')
7 proc_ids = []
8-
9+ stock_move_ids = []
10 for line in order_lines:
11 if line.state == 'done':
12 continue
13@@ -828,7 +828,8 @@
14 if line.product_id.product_tmpl_id.type in ('product', 'consu'):
15 if not picking_id:
16 picking_id = picking_obj.create(cr, uid, self._prepare_order_picking(cr, uid, order, context=context))
17- move_id = move_obj.create(cr, uid, self._prepare_order_line_move(cr, uid, order, line, picking_id, date_planned, context=context))
18+ move_id = move_obj.create(cr, uid, self._prepare_order_line_move(cr, uid, order, line, False, date_planned, context=context))
19+ stock_move_ids.append(move_id)
20 else:
21 # a service has no stock move
22 move_id = False
23@@ -837,14 +838,13 @@
24 proc_ids.append(proc_id)
25 line.write({'procurement_id': proc_id})
26 self.ship_recreate(cr, uid, order, line, move_id, proc_id)
27-
28+ if picking_id:
29+ move_obj.write(cr, uid, stock_move_ids, {'picking_id': picking_id}, context=context)
30 wf_service = netsvc.LocalService("workflow")
31 if picking_id:
32 wf_service.trg_validate(uid, 'stock.picking', picking_id, 'button_confirm', cr)
33-
34 for proc_id in proc_ids:
35 wf_service.trg_validate(uid, 'procurement.order', proc_id, 'button_confirm', cr)
36-
37 val = {}
38 if order.state == 'shipping_except':
39 val['state'] = 'progress'
40
41=== modified file 'stock/stock.py'
42--- stock/stock.py 2013-06-10 15:05:56 +0000
43+++ stock/stock.py 2013-09-24 15:27:49 +0000
44@@ -1947,7 +1947,6 @@
45 'location_id': move.location_dest_id.id,
46 'location_dest_id': loc.id,
47 'date_moved': time.strftime('%Y-%m-%d'),
48- 'picking_id': pickid,
49 'state': 'waiting',
50 'company_id': company_id or res_obj._company_default_get(cr, uid, 'stock.company', context=context) ,
51 'move_history_ids': [],
52@@ -1960,6 +1959,7 @@
53 })
54 new_moves.append(self.browse(cr, uid, [new_id])[0])
55 if pickid:
56+ move_obj.write(cr, uid, [m.id for m in new_moves], {'picking_id': pickid}, context=context)
57 wf_service.trg_validate(uid, 'stock.picking', pickid, 'button_confirm', cr)
58 if new_moves:
59 new_moves += self.create_chained_picking(cr, uid, new_moves, context)