Kirti Savalia(OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/trunk-bug-834004-ksa into 
lp:openobject-addons.

Requested reviews:
  Kirti Savalia(OpenERP) (ksa-openerp)
  Rucha (Open ERP) (rpa-openerp)
  qdp (OpenERP) (qdp)
Related bugs:
  Bug #834004 in OpenERP Addons: "[6.0.3] Product cost structure report xml 
predefined entities problem"
  https://bugs.launchpad.net/openobject-addons/+bug/834004

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-834004-ksa/+merge/73749

predefined entities problem in product cost structure.
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-834004-ksa/+merge/73749
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/trunk-bug-834004-ksa.
=== modified file 'mrp/report/price.py'
--- mrp/report/price.py	2011-10-02 17:31:16 +0000
+++ mrp/report/price.py	2011-11-03 13:10:11 +0000
@@ -22,13 +22,11 @@
 import time
 import pooler
 from report.interface import report_rml
-#from report.interface import toxml
 from tools import to_xml
 from report import report_sxw
 from datetime import datetime
 from tools.translate import _
 
-
 #FIXME: we should use toxml
 class report_custom(report_rml):
     def create_xml(self, cr, uid, ids, datas, context=None):
@@ -50,14 +48,15 @@
             sum_strd = 0
             prod = product_pool.browse(cr, uid, bom['product_id'])
 
-            prod_name = bom['name']
+            prod_name = to_xml(bom['name'])
             prod_qtty = factor * bom['product_qty']
             product_uom = product_uom_pool.browse(cr, uid, bom['product_uom'], context=context)
+            product_uom_name = to_xml(product_uom.name)
             main_sp_price, main_sp_name , main_strd_price = '','',''
             sellers, sellers_price = '',''
 
             if prod.seller_id:
-                main_sp_name = "<b>%s</b>\r\n" %(prod.seller_id.name)
+                main_sp_name = '- <b>'+ to_xml(prod.seller_id.name) +'</b>\r\n'
                 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, {
@@ -70,7 +69,7 @@
             main_strd_price = str(std_price) + '\r\n'
             sum_strd = prod_qtty*std_price
             for seller_id in prod.seller_ids:
-                sellers +=  '- <i>'+ seller_id.name.name +'</i>\r\n'
+                sellers +=  '- <i>'+ to_xml(seller_id.name.name) +'</i>\r\n'
                 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, {
@@ -80,7 +79,7 @@
                 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>
-                    <col f='yes'>"""+ rml_obj.formatLang(prod_qtty) +' '+ product_uom.name +"""</col>
+                    <col f='yes'>"""+ rml_obj.formatLang(prod_qtty) +' '+ product_uom_name +"""</col>
                     <col f='yes'>"""+ rml_obj.formatLang(float(main_strd_price)) +' '+ company_currency.symbol +"""</col>
                     <col f='yes'>""" + main_sp_price + sellers_price + """</col>'"""
 
@@ -93,7 +92,7 @@
             cost_hour = wrk['hour']*workcenter.costs_hour
             total = cost_cycle + cost_hour
             xml = '<row>'
-            xml += "<col para='yes'>" + workcenter.name + '</col>'
+            xml += "<col para='yes'>" + to_xml(workcenter.name) + '</col>'
             xml += "<col/>"
             xml += """<col f='yes'>"""+rml_obj.formatLang(cost_cycle)+' '+ company_currency.symbol + """</col>"""
             xml += """<col f='yes'>"""+rml_obj.formatLang(cost_hour)+' '+ company_currency.symbol + """</col>"""
@@ -142,9 +141,10 @@
         purchase_price_digits = rml_obj.get_digits(dp='Purchase Price')
 
         for product in product_pool.browse(cr, uid, ids, context=context):
+            product_uom_name = to_xml(product.uom_id.name)
             bom_id = bom_pool._bom_find(cr, uid, product.id, product.uom_id.id)
             title = "<title>%s</title>" %(_("Cost Structure"))
-            title += "<title>%s</title>" %product.name
+            title += "<title>%s</title>" % (to_xml(product.name))
             xml += "<lines style='header'>" + title + prod_header + "</lines>"
             if not bom_id:
                 total_strd = number * product.standard_price
@@ -157,7 +157,7 @@
                     <col para='yes'>-</col>
                     </row></lines>"""
                 xml += """<lines style='total'> <row>
-                    <col> """ + _('Total Cost of %s %s') % (str(number), product.uom_id.name) + """: </col>
+                    <col> """ + _('Total Cost of %s %s') % (str(number), product_uom_name) + """: </col>
                     <col/>
                     <col f='yes'/>
                     <col t='yes'>"""+ rml_obj.formatLang(total_strd, digits=purchase_price_digits) +' '+ company_currency.symbol + """</col>
@@ -184,7 +184,7 @@
 
                 xml += "<lines style='lines'>" + xml_tmp + '</lines>'
                 xml += """<lines style='sub_total'> <row>
-                    <col> """ + _('Components Cost of %s %s') % (str(number), product.uom_id.name) + """: </col>
+                    <col> """ + _('Components Cost of %s %s') % (str(number), product_uom_name) + """: </col>
                     <col/>
                     <col t='yes'/>
                     <col t='yes'>"""+ rml_obj.formatLang(total_strd, digits=purchase_price_digits) +' '+ company_currency.symbol + """</col>
@@ -201,14 +201,14 @@
                     xml += workcenter_header
                     xml += "<lines style='lines'>" + xml_tmp + '</lines>'
                     xml += """<lines style='sub_total'> <row>
-                    <col> """ + _('Work Cost of %s %s') % (str(number), product.uom_id.name) +""": </col>
+                    <col> """ + _('Work Cost of %s %s') % (str(number), product_uom_name) +""": </col>
                     <col/>
                     <col/>
                     <col/>
                     <col t='yes'>"""+ rml_obj.formatLang(total2, digits=purchase_price_digits) +' '+ company_currency.symbol +"""</col>
                     </row></lines>'"""
                 xml += """<lines style='total'> <row>
-                    <col> """ + _('Total Cost of %s %s') % (str(number), product.uom_id.name) + """: </col>
+                    <col> """ + _('Total Cost of %s %s') % (str(number), product_uom_name) + """: </col>
                     <col/>
                     <col t='yes'/>
                     <col t='yes'>"""+ rml_obj.formatLang(total_strd+total2, digits=purchase_price_digits) +' '+ company_currency.symbol + """</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