Ila Rana(Open ERP) has proposed merging 
lp:~openerp-dev/openobject-addons/6.0-opw-16233-ira into 
lp:openobject-addons/6.0.

Requested reviews:
  OpenERP Core Team (openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-opw-16233-ira/+merge/68230

Hello sir,

In the absence of partner or customer's price-list.
It gives such  attribute-error(none_type object) while defining 
sale_order_line,So to overcome from an issue I have made changes in 
product_id_change method.

Thanks,
Ila Rana.
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-opw-16233-ira/+merge/68230
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/6.0-opw-16233-ira.
=== modified file 'sale_margin/sale_margin.py'
--- sale_margin/sale_margin.py	2011-04-14 11:10:33 +0000
+++ sale_margin/sale_margin.py	2011-07-18 11:03:33 +0000
@@ -30,11 +30,14 @@
             uom=uom, qty_uos=qty_uos, uos=uos, name=name, partner_id=partner_id,
             lang=lang, update_tax=update_tax, date_order=date_order, packaging=packaging, fiscal_position=fiscal_position, flag=flag)
         frm_cur = self.pool.get('res.users').browse(cr, uid, uid).company_id.currency_id.id
-        to_cur = self.pool.get('res.partner').browse(cr, uid, partner_id).property_product_pricelist.currency_id.id
-        if product:
-            purchase_price = self.pool.get('product.product').browse(cr, uid, product).standard_price
+        partner_pricelist = self.pool.get('res.partner').browse(cr, uid, partner_id).property_product_pricelist
+        if partner_pricelist and product:
+            to_cur = partner_pricelist.currency_id.id
             price = self.pool.get('res.currency').compute(cr, uid, frm_cur, to_cur, purchase_price, round=False)
             res['value'].update({'purchase_price': price})
+        elif product:
+            purchase_price = self.pool.get('product.product').browse(cr, uid, product).standard_price
+            res['value'].update({'purchase_price': purchase_price})
         return res
 
     def _product_margin(self, cr, uid, ids, field_name, arg, context=None):

_______________________________________________
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