Pinakin Nayi (OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/trunk-company-currency-pricelist-currency-pna 
into lp:~openerp-dev/openobject-addons/trunk-company-currency.

Requested reviews:
  Priyesh (OpenERP) (pso-openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-company-currency-pricelist-currency-pna/+merge/121855

Hello Sir,

 I improved purchase and product. Override write method of company in sale and 
purchase module to write new wizard currency into related pricelists.


Thanks,
pna
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-company-currency-pricelist-currency-pna/+merge/121855
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/trunk-company-currency.
=== modified file 'product/pricelist.py'
--- product/pricelist.py	2012-08-14 14:10:40 +0000
+++ product/pricelist.py	2012-08-29 12:55:22 +0000
@@ -436,7 +436,20 @@
         return {}
 product_pricelist_item()
 
-
+class res_company(osv.osv):
+    _inherit = 'res.company'
+
+    def write(self, cr, uid, ids, vals, context=None):
+        res = super(res_company, self).write(cr, uid, ids, vals, context)
+        product_pricelist_obj = self.pool.get('product.pricelist')
+        model_obj = self.pool.get('ir.model.data')
+        currency = product_pricelist_obj._get_currency(cr, uid, context)
+        if currency :
+            pricelist = model_obj.get_object(cr, uid, 'product', 'list0')
+            product_pricelist_obj.write(cr, uid, pricelist.id, {'currency_id': currency}, context=context)
+        return res
+
+res_company()
 
 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
 

=== modified file 'purchase/company.py'
--- purchase/company.py	2011-09-08 10:48:15 +0000
+++ purchase/company.py	2012-08-29 12:55:22 +0000
@@ -30,6 +30,14 @@
     _defaults = {
         'po_lead': lambda *a: 1.0,
     }
+    def write(self, cr, uid, ids, vals, context=None):
+        res = super(company, self).write(cr, uid, ids, vals, context)
+        product_pricelist_obj = self.pool.get('product.pricelist')
+        currency = product_pricelist_obj._get_currency(cr, uid, context)
+        if currency :
+            purchase = self.pool.get('ir.model.data').get_object(cr, uid, 'purchase', 'list0')
+            product_pricelist_obj.write(cr, uid, purchase.id, {'currency_id': currency}, context=context)
+        return res
 company()
 
 

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to