Merge lp:~unifield-team/unifield-addons/uf-1191 into lp:unifield-addons

Proposed by jftempo
Status: Merged
Merged at revision: 4557
Proposed branch: lp:~unifield-team/unifield-addons/uf-1191
Merge into: lp:unifield-addons
Diff against target: 62 lines (+26/-12)
1 file modified
stock/stock.py (+26/-12)
To merge this branch: bzr merge lp:~unifield-team/unifield-addons/uf-1191
Reviewer Review Type Date Requested Status
UniField Dev Team Pending
Review via email: mp+124406@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 'stock/stock.py'
2--- stock/stock.py 2012-09-14 10:00:38 +0000
3+++ stock/stock.py 2012-09-14 12:24:36 +0000
4@@ -1186,7 +1186,7 @@
5 elif pick.state in ['confirmed','assigned', 'draft']:
6 ids2 = [move.id for move in pick.move_lines]
7 ctx = context.copy()
8- ctx.update({'call_unlink':True})
9+ ctx.update({'call_unlink':True, 'skipResequencing': True})
10 if pick.state != 'draft':
11 #Cancelling the move in order to affect Virtual stock of product
12 move_obj.action_cancel(cr, uid, ids2, ctx)
13@@ -1928,6 +1928,19 @@
14 pick_values = self.hook__create_chained_picking(cr, uid, pick_values, picking)
15 pick_id= picking_obj.create(cr, uid, pick_values, context=context)
16 return pick_id
17+
18+ def _create_chained_picking_move_values_hook(self, cr, uid, context=None, *args, **kwargs):
19+ '''
20+ Please copy this to your module's method also.
21+ This hook belongs to the action_process method from stock>stock.py>stock_picking
22+
23+ - allow to modify the data for chained move creation
24+ '''
25+ if context is None:
26+ context = {}
27+ move_data = kwargs['move_data']
28+ return move_data
29+
30 def create_chained_picking(self, cr, uid, moves, context=None):
31 res_obj = self.pool.get('res.company')
32 location_obj = self.pool.get('stock.location')
33@@ -1952,17 +1965,18 @@
34 else:
35 pickid = False
36 for move, (loc, dummy, delay, dummy, company_id, ptype) in todo:
37- new_id = move_obj.copy(cr, uid, move.id, {
38- 'location_id': move.location_dest_id.id,
39- 'location_dest_id': loc.id,
40- 'date_moved': time.strftime('%Y-%m-%d'),
41- 'picking_id': pickid,
42- 'state': 'waiting',
43- 'company_id': company_id or res_obj._company_default_get(cr, uid, 'stock.company', context=context) ,
44- 'move_history_ids': [],
45- 'date': (datetime.strptime(move.date, '%Y-%m-%d %H:%M:%S') + relativedelta(days=delay or 0)).strftime('%Y-%m-%d'),
46- 'move_history_ids2': []}
47- )
48+ move_data = {'location_id': move.location_dest_id.id,
49+ 'location_dest_id': loc.id,
50+ 'date_moved': time.strftime('%Y-%m-%d'),
51+ 'picking_id': pickid,
52+ 'state': 'waiting',
53+ 'company_id': company_id or res_obj._company_default_get(cr, uid, 'stock.company', context=context) ,
54+ 'move_history_ids': [],
55+ 'date': (datetime.strptime(move.date, '%Y-%m-%d %H:%M:%S') + relativedelta(days=delay or 0)).strftime('%Y-%m-%d'),
56+ 'move_history_ids2': [],
57+ }
58+ move_data = self._create_chained_picking_move_values_hook(cr, uid, context=context, move_data=move_data, move=move)
59+ new_id = move_obj.copy(cr, uid, move.id, move_data)
60 move_obj.write(cr, uid, [move.id], {
61 'move_dest_id': new_id,
62 'move_history_ids': [(4, new_id)]

Subscribers

People subscribed via source and target branches

to all changes: