Merge lp:~unifield-team/unifield-wm/sp118_trunk_merge into lp:unifield-wm

Proposed by jftempo
Status: Merged
Merged at revision: 1846
Proposed branch: lp:~unifield-team/unifield-wm/sp118_trunk_merge
Merge into: lp:unifield-wm
Diff against target: 95 lines (+39/-20)
2 files modified
msf_outgoing/msf_outgoing.py (+37/-19)
purchase_override/purchase.py (+2/-1)
To merge this branch: bzr merge lp:~unifield-team/unifield-wm/sp118_trunk_merge
Reviewer Review Type Date Requested Status
UniField Dev Team Pending
Review via email: mp+194383@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 'msf_outgoing/msf_outgoing.py'
2--- msf_outgoing/msf_outgoing.py 2013-10-14 12:45:55 +0000
3+++ msf_outgoing/msf_outgoing.py 2013-11-07 17:04:10 +0000
4@@ -278,11 +278,18 @@
5 'invoice_id': fields.many2one('account.invoice', string='Related invoice'),
6 'additional_items_ids': fields.one2many('shipment.additionalitems', 'shipment_id', string='Additional Items'),
7 }
8- _defaults = {'date': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'),}
9-
10+
11+ def _get_sequence(self, cr, uid, context=None):
12+ ir_id = self.pool.get('ir.model.data')._get_id(cr, uid, 'msf_outgoing', 'seq_shipment')
13+ return self.pool.get('ir.model.data').browse(cr, uid, ir_id).res_id
14+
15+ _defaults = {
16+ 'date': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'),
17+ 'sequence_id': _get_sequence,
18+ }
19
20 _order = 'name desc'
21-
22+
23 def create_shipment(self, cr, uid, ids, context=None):
24 '''
25 open the wizard to create (partial) shipment
26@@ -2053,6 +2060,13 @@
27
28 if context is None:
29 context = {}
30+
31+ if context.get('sync_update_execution', False):
32+ # UF-2066: in case the data comes from sync, some False value has been removed, but needed in some assert.
33+ # The following lines are to re-enter explicitly the values, even if they are already set to False
34+ vals['backorder_id'] = vals.get('backorder_id', False)
35+ vals['shipment_id'] = vals.get('shipment_id', False)
36+
37 # the action adds subtype in the context depending from which screen it is created
38 if context.get('picking_screen', False) and not vals.get('name', False):
39 pick_name = self.pool.get('ir.sequence').get(cr, uid, 'picking.ticket')
40@@ -2200,22 +2214,26 @@
41 rts = rts.strftime(db_date_format)
42
43 if not len(shipment_ids):
44- # no shipment, create one - no need to specify the state, it's a function
45- name = self.pool.get('ir.sequence').get(cr, uid, 'shipment')
46- addr = self.pool.get('res.partner.address').browse(cr, uid, vals['address_id'], context=context)
47- partner_id = addr.partner_id and addr.partner_id.id or False
48- values = {'name': name,
49- 'address_id': vals['address_id'],
50- 'partner_id2': partner_id,
51- 'shipment_expected_date': rts,
52- 'shipment_actual_date': rts,
53- 'sequence_id': self.create_sequence(cr, uid, {'name':name,
54- 'code':name,
55- 'prefix':'',
56- 'padding':2}, context=context)}
57-
58- shipment_id = shipment_obj.create(cr, uid, values, context=context)
59- shipment_obj.log(cr, uid, shipment_id, _('The new Draft Shipment %s has been created.')%(name,))
60+ # only create new shipment if we don't already have one through sync
61+ if not vals['shipment_id'] and not context.get('offline_synchronization', False):
62+ # no shipment, create one - no need to specify the state, it's a function
63+ name = self.pool.get('ir.sequence').get(cr, uid, 'shipment')
64+ addr = self.pool.get('res.partner.address').browse(cr, uid, vals['address_id'], context=context)
65+ partner_id = addr.partner_id and addr.partner_id.id or False
66+ values = {'name': name,
67+ 'address_id': vals['address_id'],
68+ 'partner_id2': partner_id,
69+ 'shipment_expected_date': rts,
70+ 'shipment_actual_date': rts,
71+ 'sequence_id': self.create_sequence(cr, uid, {'name':name,
72+ 'code':name,
73+ 'prefix':'',
74+ 'padding':2}, context=context)}
75+
76+ shipment_id = shipment_obj.create(cr, uid, values, context=context)
77+ shipment_obj.log(cr, uid, shipment_id, _('The new Draft Shipment %s has been created.')%(name,))
78+ else:
79+ shipment_id = vals['shipment_id']
80 else:
81 shipment_id = shipment_ids[0]
82 shipment = shipment_obj.browse(cr, uid, shipment_id, context=context)
83
84=== modified file 'purchase_override/purchase.py'
85--- purchase_override/purchase.py 2013-10-24 15:21:03 +0000
86+++ purchase_override/purchase.py 2013-11-07 17:04:10 +0000
87@@ -2019,7 +2019,8 @@
88 if (other_lines and stages and order.state != 'confirmed'):
89 context.update({'change_price_ok': False})
90
91- vals = self._update_merged_line(cr, uid, False, vals, context=dict(context, skipResequencing=True))
92+ if not context.get('offline_synchronization'):
93+ vals = self._update_merged_line(cr, uid, False, vals, context=dict(context, skipResequencing=True))
94
95 vals.update({'old_price_unit': vals.get('price_unit', False)})
96

Subscribers

People subscribed via source and target branches