Merge lp:~julie-w/unifield-server/US-5480 into lp:unifield-server

Proposed by jftempo
Status: Merged
Merged at revision: 5217
Proposed branch: lp:~julie-w/unifield-server/US-5480
Merge into: lp:unifield-server
Diff against target: 56 lines (+35/-0)
2 files modified
bin/addons/msf_profile/data/patches.xml (+5/-0)
bin/addons/msf_profile/msf_profile.py (+30/-0)
To merge this branch: bzr merge lp:~julie-w/unifield-server/US-5480
Reviewer Review Type Date Requested Status
UniField Reviewer Team Pending
Review via email: mp+362313@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 'bin/addons/msf_profile/data/patches.xml'
--- bin/addons/msf_profile/data/patches.xml 2019-01-16 16:00:37 +0000
+++ bin/addons/msf_profile/data/patches.xml 2019-01-28 14:17:37 +0000
@@ -1,6 +1,11 @@
1<?xml version="1.0" encoding="utf-8" ?>1<?xml version="1.0" encoding="utf-8" ?>
2<openerp>2<openerp>
3 <data>3 <data>
4 <!-- UF12.0 -->
5 <record id="us_5480_correct_partner_fo_default_currency" model="patch.scripts">
6 <field name="method">us_5480_correct_partner_fo_default_currency</field>
7 </record>
8
4 <!-- UF11.1 -->9 <!-- UF11.1 -->
5 <record id="us_5425_reset_amount_currency" model="patch.scripts">10 <record id="us_5425_reset_amount_currency" model="patch.scripts">
6 <field name="method">us_5425_reset_amount_currency</field>11 <field name="method">us_5425_reset_amount_currency</field>
712
=== modified file 'bin/addons/msf_profile/msf_profile.py'
--- bin/addons/msf_profile/msf_profile.py 2019-01-25 16:57:19 +0000
+++ bin/addons/msf_profile/msf_profile.py 2019-01-28 14:17:37 +0000
@@ -52,6 +52,36 @@
52 'model': lambda *a: 'patch.scripts',52 'model': lambda *a: 'patch.scripts',
53 }53 }
5454
55 # UF12.0
56 def us_5480_correct_partner_fo_default_currency(self, cr, uid, *a, **b):
57 """
58 Sets FO default currency = PO default currency for all external partners where these currencies are different
59 """
60 partner_obj = self.pool.get('res.partner')
61 pricelist_obj = self.pool.get('product.pricelist')
62 partner_ids = partner_obj.search(cr, uid, [('partner_type', '=', 'external'), ('active', 'in', ['t', 'f'])])
63 partner_count = 0
64 for partner in partner_obj.browse(cr, uid, partner_ids,
65 fields_to_fetch=['property_product_pricelist_purchase',
66 'property_product_pricelist']):
67 if partner.property_product_pricelist_purchase and partner.property_product_pricelist \
68 and partner.property_product_pricelist_purchase.currency_id.id != partner.property_product_pricelist.currency_id.id:
69 # search for the "Sale" pricelist having the same currency as the "Purchase" pricelist currently used
70 pricelist_dom = [('type', '=', 'sale'),
71 ('currency_id', '=', partner.property_product_pricelist_purchase.currency_id.id)]
72 pricelist_ids = pricelist_obj.search(cr, uid, pricelist_dom, limit=1)
73 if pricelist_ids:
74 sql = """
75 UPDATE ir_property
76 SET value_reference = %s
77 WHERE name = 'property_product_pricelist'
78 AND res_id = %s;
79 """
80 cr.execute(sql, ('product.pricelist,%s' % pricelist_ids[0], 'res.partner,%s' % partner.id))
81 partner_count += 1
82 self._logger.warn('FO default currency modified for %s partner(s).' % (partner_count,))
83 return True
84
55 # UF11.185 # UF11.1
56 def us_5559_set_pricelist(self, cr, uid, *a, **b):86 def us_5559_set_pricelist(self, cr, uid, *a, **b):
57 if not self.pool.get('sync.client.entity'):87 if not self.pool.get('sync.client.entity'):

Subscribers

People subscribed via source and target branches