Mayur Maheshwari(OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/trunk-bug-814124-mma into 
lp:openobject-addons.

Requested reviews:
  Rucha (Open ERP) (rpa-openerp)
Related bugs:
  Bug #814124 in OpenERP Addons: "Cost structure doesn't use the Supplier's 
"Purchase Pricelist""
  https://bugs.launchpad.net/openobject-addons/+bug/814124

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-814124-mma/+merge/69607

Hello,

    mrp : Now Cost structure use the Suppliers Purchase Pricelist in Supplier 
Price per Uom

Thanks
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-814124-mma/+merge/69607
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/trunk-bug-814124-mma.
=== modified file 'mrp/report/price.py'
--- mrp/report/price.py	2011-03-18 07:52:14 +0000
+++ mrp/report/price.py	2011-07-28 09:38:25 +0000
@@ -19,6 +19,7 @@
 #
 ##############################################################################
 
+import time
 import pooler
 from report.interface import report_rml
 #from report.interface import toxml
@@ -39,6 +40,7 @@
         workcenter_pool = pool.get('mrp.workcenter')
         user_pool = pool.get('res.users')
         bom_pool = pool.get('mrp.bom')
+        pricelist_pool = pool.get('product.pricelist')
         rml_obj=report_sxw.rml_parse(cr, uid, product_pool._name,context)
         rml_obj.localcontext.update({'lang':context.get('lang',False)})
         company_currency = user_pool.browse(cr, uid, uid).company_id.currency_id
@@ -56,8 +58,12 @@
 
             if prod.seller_id:
                 main_sp_name = "<b>%s</b>\r\n" %(prod.seller_id.name)
-                price = supplier_info_pool.price_get(cr, uid, prod.seller_id.id, prod.id, number*prod_qtty)[prod.seller_id.id]
-                price = product_uom_pool._compute_price(cr, uid, prod.uom_id.id, price, to_uom_id=product_uom.id)
+                pricelist =  prod.seller_id.property_product_pricelist_purchase
+                price = pricelist_pool.price_get(cr,uid,[pricelist.id],
+                     prod.id, number*prod_qtty or 1.0, prod.seller_id.id, {
+                        'uom': prod.uom_po_id.id,
+                        'date': time.strftime('%Y-%m-%d'),
+                        })[pricelist.id]
                 main_sp_price = """<b>"""+rml_obj.formatLang(price)+' '+ company_currency.symbol+"""</b>\r\n"""
                 sum += prod_qtty*price
             std_price = product_uom_pool._compute_price(cr, uid, prod.uom_id.id, prod.standard_price, to_uom_id=product_uom.id)
@@ -65,8 +71,12 @@
             sum_strd = prod_qtty*std_price
             for seller_id in prod.seller_ids:
                 sellers +=  '- <i>'+ seller_id.name.name +'</i>\r\n'
-                price = supplier_info_pool.price_get(cr, uid, seller_id.name.id, prod.id, number*prod_qtty)[seller_id.name.id]
-                price = product_uom_pool._compute_price(cr, uid, prod.uom_id.id, price, to_uom_id=product_uom.id)
+                pricelist = seller_id.name.property_product_pricelist_purchase
+                price = pricelist_pool.price_get(cr,uid,[pricelist.id],
+                     prod.id, number*prod_qtty or 1.0, seller_id.name.id, {
+                        'uom': prod.uom_po_id.id,
+                        'date': time.strftime('%Y-%m-%d'),
+                        })[pricelist.id]
                 sellers_price += """<i>"""+rml_obj.formatLang(price) +' '+ company_currency.symbol +"""</i>\r\n"""
             xml += """<col para='yes'> """+ prod_name +""" </col>
                     <col para='yes'> """+ main_sp_name + sellers + """ </col>

_______________________________________________
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