Merge lp:~unifield-team/unifield-wm/us-202 into lp:unifield-wm

Proposed by jftempo
Status: Merged
Merged at revision: 2474
Proposed branch: lp:~unifield-team/unifield-wm/us-202
Merge into: lp:unifield-wm
Diff against target: 44 lines (+20/-1)
2 files modified
analytic_distribution_supply/purchase.py (+7/-0)
purchase_override/purchase.py (+13/-1)
To merge this branch: bzr merge lp:~unifield-team/unifield-wm/us-202
Reviewer Review Type Date Requested Status
UniField Reviewer Team Pending
Review via email: mp+255991@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 'analytic_distribution_supply/purchase.py'
2--- analytic_distribution_supply/purchase.py 2014-04-04 10:05:06 +0000
3+++ analytic_distribution_supply/purchase.py 2015-04-13 15:54:37 +0000
4@@ -443,6 +443,13 @@
5 context = {}
6 if isinstance(ids, (int, long)):
7 ids = [ids]
8+
9+ if not context.get('partner_type'):
10+ raise osv.except_osv(
11+ _('Error'),
12+ _('You need to select a partner before add the analytic distribution'),
13+ )
14+
15 # Prepare some values
16 purchase_line = self.browse(cr, uid, ids[0], context=context)
17 amount = purchase_line.price_subtotal or 0.0
18
19=== modified file 'purchase_override/purchase.py'
20--- purchase_override/purchase.py 2015-04-02 12:05:19 +0000
21+++ purchase_override/purchase.py 2015-04-13 15:54:37 +0000
22@@ -854,9 +854,21 @@
23 else:
24 bro_dest_ok = pol.account_4_distribution.default_destination_id
25 # Copy cost center line to the new distribution
26- ccdl_obj.copy(cr, uid, line.id, {'distribution_id': id_ad, 'destination_id': bro_dest_ok.id})
27+ ccdl_obj.copy(cr, uid, line.id, {
28+ 'distribution_id': id_ad,
29+ 'destination_id': bro_dest_ok.id,
30+ 'partner_type': pol.order_id.partner_id.partner_type,
31+ })
32 # Write result
33 pol_obj.write(cr, uid, [pol.id], {'analytic_distribution_id': id_ad})
34+ else:
35+ ad_lines = pol.analytic_distribution_id and pol.analytic_distribution_id.cost_center_lines or po.analytic_distribution_id.cost_center_lines
36+ for line in ad_lines:
37+ if not line.partner_type:
38+ ccdl_obj.write(cr, uid, [line.id], {
39+ 'partner_type': pol.order_id.partner_id.partner_type,
40+ })
41+
42 return True
43
44 def wkf_picking_done(self, cr, uid, ids, context=None):

Subscribers

People subscribed via source and target branches