Merge lp:~openerp-dev/openobject-addons/6.0-opw-50912-skh into lp:openobject-addons/6.0

Proposed by Somesh Khare
Status: Merged
Approved by: Vinay Rana (OpenERP)
Approved revision: 4945
Merged at revision: 4967
Proposed branch: lp:~openerp-dev/openobject-addons/6.0-opw-50912-skh
Merge into: lp:openobject-addons/6.0
Diff against target: 94 lines (+12/-11)
1 file modified
mrp/report/price.py (+12/-11)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/6.0-opw-50912-skh
Reviewer Review Type Date Requested Status
Vinay Rana (OpenERP) (community) Approve
Lorenzo Battistini (community) Approve
Priyesh (OpenERP) Pending
Review via email: mp+84574@code.launchpad.net

Description of the change

Hello,

I have back ported the code from trunk addons revison:5494, for the issue Product Cost Structure report crashes when the having &(Am percent) in the name of the work center and the product name.

Kindly review the issue and please share your view on it.

Thanks,
Somesh Khare

To post a comment you must log in.
Revision history for this message
Lorenzo Battistini (elbati) wrote :
review: Approve
Revision history for this message
Vinay Rana (OpenERP) (vra-openerp) wrote :

As Per My test cases the fixes will solve the issue.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'mrp/report/price.py'
--- mrp/report/price.py 2011-01-14 00:11:01 +0000
+++ mrp/report/price.py 2011-12-06 07:08:24 +0000
@@ -47,15 +47,15 @@
47 sum = 047 sum = 0
48 sum_strd = 048 sum_strd = 0
49 prod = product_pool.browse(cr, uid, bom['product_id'])49 prod = product_pool.browse(cr, uid, bom['product_id'])
5050 prod_name = to_xml(bom['name'])
51 prod_name = bom['name']
52 prod_qtty = factor * bom['product_qty']51 prod_qtty = factor * bom['product_qty']
53 product_uom = product_uom_pool.browse(cr, uid, bom['product_uom'], context=context)52 product_uom = product_uom_pool.browse(cr, uid, bom['product_uom'], context=context)
53 product_uom_name = to_xml(product_uom.name)
54 main_sp_price, main_sp_name , main_strd_price = '','',''54 main_sp_price, main_sp_name , main_strd_price = '','',''
55 sellers, sellers_price = '',''55 sellers, sellers_price = '',''
5656
57 if prod.seller_id:57 if prod.seller_id:
58 main_sp_name = "<b>%s</b>\r\n" %(prod.seller_id.name)58 main_sp_name = '- <b>'+ to_xml(prod.seller_id.name) +'</b>\r\n'
59 price = supplier_info_pool.price_get(cr, uid, prod.seller_id.id, prod.id, number*prod_qtty)[prod.seller_id.id]59 price = supplier_info_pool.price_get(cr, uid, prod.seller_id.id, prod.id, number*prod_qtty)[prod.seller_id.id]
60 price = product_uom_pool._compute_price(cr, uid, prod.uom_id.id, price, to_uom_id=product_uom.id)60 price = product_uom_pool._compute_price(cr, uid, prod.uom_id.id, price, to_uom_id=product_uom.id)
61 main_sp_price = """<b>"""+rml_obj.formatLang(price)+' '+ company_currency.symbol+"""</b>\r\n"""61 main_sp_price = """<b>"""+rml_obj.formatLang(price)+' '+ company_currency.symbol+"""</b>\r\n"""
@@ -64,13 +64,13 @@
64 main_strd_price = str(std_price) + '\r\n'64 main_strd_price = str(std_price) + '\r\n'
65 sum_strd = prod_qtty*std_price65 sum_strd = prod_qtty*std_price
66 for seller_id in prod.seller_ids:66 for seller_id in prod.seller_ids:
67 sellers += '- <i>'+ seller_id.name.name +'</i>\r\n'67 sellers += '- <i>'+ to_xml(seller_id.name.name) +'</i>\r\n'
68 price = supplier_info_pool.price_get(cr, uid, seller_id.name.id, prod.id, number*prod_qtty)[seller_id.name.id]68 price = supplier_info_pool.price_get(cr, uid, seller_id.name.id, prod.id, number*prod_qtty)[seller_id.name.id]
69 price = product_uom_pool._compute_price(cr, uid, prod.uom_id.id, price, to_uom_id=product_uom.id)69 price = product_uom_pool._compute_price(cr, uid, prod.uom_id.id, price, to_uom_id=product_uom.id)
70 sellers_price += """<i>"""+rml_obj.formatLang(price) +' '+ company_currency.symbol +"""</i>\r\n"""70 sellers_price += """<i>"""+rml_obj.formatLang(price) +' '+ company_currency.symbol +"""</i>\r\n"""
71 xml += """<col para='yes'> """+ prod_name +""" </col>71 xml += """<col para='yes'> """+ prod_name +""" </col>
72 <col para='yes'> """+ main_sp_name + sellers + """ </col>72 <col para='yes'> """+ main_sp_name + sellers + """ </col>
73 <col f='yes'>"""+ rml_obj.formatLang(prod_qtty) +' '+ product_uom.name +"""</col>73 <col f='yes'>"""+ rml_obj.formatLang(prod_qtty) +' '+ product_uom_name +"""</col>
74 <col f='yes'>"""+ rml_obj.formatLang(float(main_strd_price)) +' '+ company_currency.symbol +"""</col>74 <col f='yes'>"""+ rml_obj.formatLang(float(main_strd_price)) +' '+ company_currency.symbol +"""</col>
75 <col f='yes'>""" + main_sp_price + sellers_price + """</col>'"""75 <col f='yes'>""" + main_sp_price + sellers_price + """</col>'"""
7676
@@ -83,7 +83,7 @@
83 cost_hour = wrk['hour']*workcenter.costs_hour83 cost_hour = wrk['hour']*workcenter.costs_hour
84 total = cost_cycle + cost_hour84 total = cost_cycle + cost_hour
85 xml = '<row>'85 xml = '<row>'
86 xml += "<col para='yes'>" + workcenter.name + '</col>'86 xml += "<col para='yes'>" + to_xml(workcenter.name) + '</col>'
87 xml += "<col/>"87 xml += "<col/>"
88 xml += """<col f='yes'>"""+rml_obj.formatLang(cost_cycle)+' '+ company_currency.symbol + """</col>"""88 xml += """<col f='yes'>"""+rml_obj.formatLang(cost_cycle)+' '+ company_currency.symbol + """</col>"""
89 xml += """<col f='yes'>"""+rml_obj.formatLang(cost_hour)+' '+ company_currency.symbol + """</col>"""89 xml += """<col f='yes'>"""+rml_obj.formatLang(cost_hour)+' '+ company_currency.symbol + """</col>"""
@@ -132,9 +132,10 @@
132 purchase_price_digits = rml_obj.get_digits(dp='Purchase Price')132 purchase_price_digits = rml_obj.get_digits(dp='Purchase Price')
133133
134 for product in product_pool.browse(cr, uid, ids, context=context):134 for product in product_pool.browse(cr, uid, ids, context=context):
135 product_uom_name = to_xml(product.uom_id.name)
135 bom_id = bom_pool._bom_find(cr, uid, product.id, product.uom_id.id)136 bom_id = bom_pool._bom_find(cr, uid, product.id, product.uom_id.id)
136 title = "<title>%s</title>" %(_("Cost Structure"))137 title = "<title>%s</title>" %(_("Cost Structure"))
137 title += "<title>%s</title>" %product.name138 title += "<title>%s</title>" % (to_xml(product.name))
138 xml += "<lines style='header'>" + title + prod_header + "</lines>"139 xml += "<lines style='header'>" + title + prod_header + "</lines>"
139 if not bom_id:140 if not bom_id:
140 total_strd = number * product.standard_price141 total_strd = number * product.standard_price
@@ -147,7 +148,7 @@
147 <col para='yes'>-</col>148 <col para='yes'>-</col>
148 </row></lines>"""149 </row></lines>"""
149 xml += """<lines style='total'> <row>150 xml += """<lines style='total'> <row>
150 <col> """ + _('Total Cost of ') + str(number) +' '+ product.uom_id.name + """: </col>151 <col> """ + _('Total Cost of %s %s') % (str(number), product_uom_name) + """: </col>
151 <col/>152 <col/>
152 <col f='yes'/>153 <col f='yes'/>
153 <col t='yes'>"""+ rml_obj.formatLang(total_strd, digits=purchase_price_digits) +' '+ company_currency.symbol + """</col>154 <col t='yes'>"""+ rml_obj.formatLang(total_strd, digits=purchase_price_digits) +' '+ company_currency.symbol + """</col>
@@ -174,7 +175,7 @@
174175
175 xml += "<lines style='lines'>" + xml_tmp + '</lines>'176 xml += "<lines style='lines'>" + xml_tmp + '</lines>'
176 xml += """<lines style='sub_total'> <row>177 xml += """<lines style='sub_total'> <row>
177 <col> """ + _('Components Cost of ') + str(number) +' '+ product.uom_id.name + """: </col>178 <col> """ + _('Components Cost of %s %s') % (str(number), product_uom_name) + """: </col>
178 <col/>179 <col/>
179 <col t='yes'/>180 <col t='yes'/>
180 <col t='yes'>"""+ rml_obj.formatLang(total_strd, digits=purchase_price_digits) +' '+ company_currency.symbol + """</col>181 <col t='yes'>"""+ rml_obj.formatLang(total_strd, digits=purchase_price_digits) +' '+ company_currency.symbol + """</col>
@@ -191,14 +192,14 @@
191 xml += workcenter_header192 xml += workcenter_header
192 xml += "<lines style='lines'>" + xml_tmp + '</lines>'193 xml += "<lines style='lines'>" + xml_tmp + '</lines>'
193 xml += """<lines style='sub_total'> <row>194 xml += """<lines style='sub_total'> <row>
194 <col> """ + _('Work Cost of ') + str(number) +' '+ product.uom_id.name +""": </col>195 <col> """ + _('Work Cost of %s %s') % (str(number), product_uom_name) +""": </col>
195 <col/>196 <col/>
196 <col/>197 <col/>
197 <col/>198 <col/>
198 <col t='yes'>"""+ rml_obj.formatLang(total2, digits=purchase_price_digits) +' '+ company_currency.symbol +"""</col>199 <col t='yes'>"""+ rml_obj.formatLang(total2, digits=purchase_price_digits) +' '+ company_currency.symbol +"""</col>
199 </row></lines>'"""200 </row></lines>'"""
200 xml += """<lines style='total'> <row>201 xml += """<lines style='total'> <row>
201 <col> """ + _('Total Cost of ') + str(number) +' '+ product.uom_id.name + """: </col>202 <col> """ + _('Total Cost of %s %s') % (str(number), product_uom_name) + """: </col>
202 <col/>203 <col/>
203 <col t='yes'/>204 <col t='yes'/>
204 <col t='yes'>"""+ rml_obj.formatLang(total_strd+total2, digits=purchase_price_digits) +' '+ company_currency.symbol + """</col>205 <col t='yes'>"""+ rml_obj.formatLang(total_strd+total2, digits=purchase_price_digits) +' '+ company_currency.symbol + """</col>