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
=== modified file 'stock/stock.py'
--- stock/stock.py 2012-09-14 10:00:38 +0000
+++ stock/stock.py 2012-09-14 12:24:36 +0000
@@ -1186,7 +1186,7 @@
1186 elif pick.state in ['confirmed','assigned', 'draft']:1186 elif pick.state in ['confirmed','assigned', 'draft']:
1187 ids2 = [move.id for move in pick.move_lines]1187 ids2 = [move.id for move in pick.move_lines]
1188 ctx = context.copy()1188 ctx = context.copy()
1189 ctx.update({'call_unlink':True})1189 ctx.update({'call_unlink':True, 'skipResequencing': True})
1190 if pick.state != 'draft':1190 if pick.state != 'draft':
1191 #Cancelling the move in order to affect Virtual stock of product1191 #Cancelling the move in order to affect Virtual stock of product
1192 move_obj.action_cancel(cr, uid, ids2, ctx)1192 move_obj.action_cancel(cr, uid, ids2, ctx)
@@ -1928,6 +1928,19 @@
1928 pick_values = self.hook__create_chained_picking(cr, uid, pick_values, picking)1928 pick_values = self.hook__create_chained_picking(cr, uid, pick_values, picking)
1929 pick_id= picking_obj.create(cr, uid, pick_values, context=context)1929 pick_id= picking_obj.create(cr, uid, pick_values, context=context)
1930 return pick_id1930 return pick_id
1931
1932 def _create_chained_picking_move_values_hook(self, cr, uid, context=None, *args, **kwargs):
1933 '''
1934 Please copy this to your module's method also.
1935 This hook belongs to the action_process method from stock>stock.py>stock_picking
1936
1937 - allow to modify the data for chained move creation
1938 '''
1939 if context is None:
1940 context = {}
1941 move_data = kwargs['move_data']
1942 return move_data
1943
1931 def create_chained_picking(self, cr, uid, moves, context=None):1944 def create_chained_picking(self, cr, uid, moves, context=None):
1932 res_obj = self.pool.get('res.company')1945 res_obj = self.pool.get('res.company')
1933 location_obj = self.pool.get('stock.location')1946 location_obj = self.pool.get('stock.location')
@@ -1952,17 +1965,18 @@
1952 else:1965 else:
1953 pickid = False1966 pickid = False
1954 for move, (loc, dummy, delay, dummy, company_id, ptype) in todo:1967 for move, (loc, dummy, delay, dummy, company_id, ptype) in todo:
1955 new_id = move_obj.copy(cr, uid, move.id, {1968 move_data = {'location_id': move.location_dest_id.id,
1956 'location_id': move.location_dest_id.id,1969 'location_dest_id': loc.id,
1957 'location_dest_id': loc.id,1970 'date_moved': time.strftime('%Y-%m-%d'),
1958 'date_moved': time.strftime('%Y-%m-%d'),1971 'picking_id': pickid,
1959 'picking_id': pickid,1972 'state': 'waiting',
1960 'state': 'waiting',1973 'company_id': company_id or res_obj._company_default_get(cr, uid, 'stock.company', context=context) ,
1961 'company_id': company_id or res_obj._company_default_get(cr, uid, 'stock.company', context=context) ,1974 'move_history_ids': [],
1962 'move_history_ids': [],1975 'date': (datetime.strptime(move.date, '%Y-%m-%d %H:%M:%S') + relativedelta(days=delay or 0)).strftime('%Y-%m-%d'),
1963 'date': (datetime.strptime(move.date, '%Y-%m-%d %H:%M:%S') + relativedelta(days=delay or 0)).strftime('%Y-%m-%d'),1976 'move_history_ids2': [],
1964 'move_history_ids2': []}1977 }
1965 )1978 move_data = self._create_chained_picking_move_values_hook(cr, uid, context=context, move_data=move_data, move=move)
1979 new_id = move_obj.copy(cr, uid, move.id, move_data)
1966 move_obj.write(cr, uid, [move.id], {1980 move_obj.write(cr, uid, [move.id], {
1967 'move_dest_id': new_id,1981 'move_dest_id': new_id,
1968 'move_history_ids': [(4, new_id)]1982 'move_history_ids': [(4, new_id)]

Subscribers

People subscribed via source and target branches

to all changes: