From 8532d49c9b12c1d28b8f9eb0f80835ff61263a05 Mon Sep 17 00:00:00 2001 From: ced <> Date: Fri, 15 Dec 2006 15:18:45 +0000 Subject: [PATCH] Fix report for price list bzr revid: ced-9c0021a474b3f4cbcff364be1f1b0893348fbb2a --- addons/mrp/__terp__.py | 2 +- addons/mrp/report/price.py | 24 ++++++++++++------------ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/addons/mrp/__terp__.py b/addons/mrp/__terp__.py index 1ca7473c51c..1ac18654085 100644 --- a/addons/mrp/__terp__.py +++ b/addons/mrp/__terp__.py @@ -4,7 +4,7 @@ "author" : "Tiny", "website" : "http://tinyerp.com/module_mrp.html", "category" : "Generic Modules/Production", - "depends" : ["stock", "hr", "purchase"], + "depends" : ["stock", "hr", "purchase", "product"], "description": "Manage the manufacturing process: procurement, scheduler computation, bill of materials, routings, procurements, production orders, workcenters, eso.", "init_xml" : [], "demo_xml" : ["mrp_demo.xml","mrp_order_point.xml"], diff --git a/addons/mrp/report/price.py b/addons/mrp/report/price.py index 96ad2bfc153..17ddb1ca809 100644 --- a/addons/mrp/report/price.py +++ b/addons/mrp/report/price.py @@ -53,29 +53,29 @@ class report_custom(report_rml): main_strd_price = '' if prod.seller_ids and prod.seller_ids[0] : main_sp_name = '' + prod.seller_ids[0].name.name + '\r\n' - pricelist = ir.ir_get(cr,uid,'meta','product.pricelist.purchase',[('res.partner',prod.seller_ids[0].name.id)]) + pricelist = prod.seller_ids[0].name.property_product_pricelist_purchase if pricelist: - pricelist_id = pricelist[0][2] - price = pooler.get_pool(cr.dbname).get('product.pricelist').price_get(cr,uid,[pricelist_id], prod.id, number*prod_qtty or 1.0)[pricelist_id] + pricelist_id = pricelist[0] + price = pooler.get_pool(cr.dbname).get('product.pricelist').price_get(cr,uid,[pricelist_id], prod.id, number*prod_qtty or 1.0).setdefault(pricelist_id, 0) else: price = 0 - main_sp_price = str(price) + '\r\n' + main_sp_price = '%.2f' % price + '\r\n' sum += prod_qtty*price - main_strd_price = str(prod.standard_price) + '\r\n' + main_strd_price = '%.2f' % prod.standard_price + '\r\n' sum_strd = prod_qtty*prod.standard_price sellers = '' sellers_price = '' for seller_id in prod.seller_ids: sellers += '- '+ seller_id.name.name +'\r\n' - pricelist = ir.ir_get(cr,uid,'meta','product.pricelist.purchase',[('res.partner',seller_id.name.id)]) + pricelist = seller_id.name.property_product_pricelist_purchase if pricelist: - pricelist_id = pricelist[0][2] - price = pooler.get_pool(cr.dbname).get('product.pricelist').price_get(cr,uid,[pricelist_id], prod.id, number*prod_qtty or 1.0)[pricelist_id] + pricelist_id = pricelist[0] + price = pooler.get_pool(cr.dbname).get('product.pricelist').price_get(cr,uid,[pricelist_id], prod.id, number*prod_qtty or 1.0).setdefault(pricelist_id, 0) else: price = 0 - sellers_price += '-' + str(price) + '\r\n' + sellers_price += '%.2f' % price + '\r\n' xml += "" + prod_name + '' xml += "" + main_sp_name + sellers + '' @@ -174,7 +174,7 @@ class report_custom(report_rml): if not first: xml += prod_header xml += "" + xml_tmp + '' - xml += "SUBTOTAL : (for " + str(number) + " products)" + str(total_strd) + '' + str(total) + '' + xml += "SUBTOTAL : (for " + str(number) + " products)" + '%.2f' % total_strd + '' + '%.2f' % total + '' total2 = 0 xml_tmp = '' @@ -185,8 +185,8 @@ class report_custom(report_rml): if xml_tmp: xml += workcenter_header xml += "" + xml_tmp + '' - xml += "SUBTOTAL : (for " + str(number) + " products)" + str(total2) + '' - xml += "TOTAL : (for " + str(number) + " products)" + str(total_strd+total2) + "" + str(total+total2) + '' + xml += "SUBTOTAL : (for " + str(number) + " products)" + '%.2f' % total2 + '' + xml += "TOTAL : (for " + str(number) + " products)" + '%.2f' % (total_strd+total2) + "" + '%.2f' % (total+total2) + '' first = False xml = '' + config_start + 'Product Cost Structure\n\r' + prod.name + ''+ config_stop + header + xml + ''