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
1=== modified file 'mrp/report/price.py'
2--- mrp/report/price.py 2011-01-14 00:11:01 +0000
3+++ mrp/report/price.py 2011-12-06 07:08:24 +0000
4@@ -47,15 +47,15 @@
5 sum = 0
6 sum_strd = 0
7 prod = product_pool.browse(cr, uid, bom['product_id'])
8-
9- prod_name = bom['name']
10+ prod_name = to_xml(bom['name'])
11 prod_qtty = factor * bom['product_qty']
12 product_uom = product_uom_pool.browse(cr, uid, bom['product_uom'], context=context)
13+ product_uom_name = to_xml(product_uom.name)
14 main_sp_price, main_sp_name , main_strd_price = '','',''
15 sellers, sellers_price = '',''
16
17 if prod.seller_id:
18- main_sp_name = "<b>%s</b>\r\n" %(prod.seller_id.name)
19+ main_sp_name = '- <b>'+ to_xml(prod.seller_id.name) +'</b>\r\n'
20 price = supplier_info_pool.price_get(cr, uid, prod.seller_id.id, prod.id, number*prod_qtty)[prod.seller_id.id]
21 price = product_uom_pool._compute_price(cr, uid, prod.uom_id.id, price, to_uom_id=product_uom.id)
22 main_sp_price = """<b>"""+rml_obj.formatLang(price)+' '+ company_currency.symbol+"""</b>\r\n"""
23@@ -64,13 +64,13 @@
24 main_strd_price = str(std_price) + '\r\n'
25 sum_strd = prod_qtty*std_price
26 for seller_id in prod.seller_ids:
27- sellers += '- <i>'+ seller_id.name.name +'</i>\r\n'
28+ sellers += '- <i>'+ to_xml(seller_id.name.name) +'</i>\r\n'
29 price = supplier_info_pool.price_get(cr, uid, seller_id.name.id, prod.id, number*prod_qtty)[seller_id.name.id]
30 price = product_uom_pool._compute_price(cr, uid, prod.uom_id.id, price, to_uom_id=product_uom.id)
31 sellers_price += """<i>"""+rml_obj.formatLang(price) +' '+ company_currency.symbol +"""</i>\r\n"""
32 xml += """<col para='yes'> """+ prod_name +""" </col>
33 <col para='yes'> """+ main_sp_name + sellers + """ </col>
34- <col f='yes'>"""+ rml_obj.formatLang(prod_qtty) +' '+ product_uom.name +"""</col>
35+ <col f='yes'>"""+ rml_obj.formatLang(prod_qtty) +' '+ product_uom_name +"""</col>
36 <col f='yes'>"""+ rml_obj.formatLang(float(main_strd_price)) +' '+ company_currency.symbol +"""</col>
37 <col f='yes'>""" + main_sp_price + sellers_price + """</col>'"""
38
39@@ -83,7 +83,7 @@
40 cost_hour = wrk['hour']*workcenter.costs_hour
41 total = cost_cycle + cost_hour
42 xml = '<row>'
43- xml += "<col para='yes'>" + workcenter.name + '</col>'
44+ xml += "<col para='yes'>" + to_xml(workcenter.name) + '</col>'
45 xml += "<col/>"
46 xml += """<col f='yes'>"""+rml_obj.formatLang(cost_cycle)+' '+ company_currency.symbol + """</col>"""
47 xml += """<col f='yes'>"""+rml_obj.formatLang(cost_hour)+' '+ company_currency.symbol + """</col>"""
48@@ -132,9 +132,10 @@
49 purchase_price_digits = rml_obj.get_digits(dp='Purchase Price')
50
51 for product in product_pool.browse(cr, uid, ids, context=context):
52+ product_uom_name = to_xml(product.uom_id.name)
53 bom_id = bom_pool._bom_find(cr, uid, product.id, product.uom_id.id)
54 title = "<title>%s</title>" %(_("Cost Structure"))
55- title += "<title>%s</title>" %product.name
56+ title += "<title>%s</title>" % (to_xml(product.name))
57 xml += "<lines style='header'>" + title + prod_header + "</lines>"
58 if not bom_id:
59 total_strd = number * product.standard_price
60@@ -147,7 +148,7 @@
61 <col para='yes'>-</col>
62 </row></lines>"""
63 xml += """<lines style='total'> <row>
64- <col> """ + _('Total Cost of ') + str(number) +' '+ product.uom_id.name + """: </col>
65+ <col> """ + _('Total Cost of %s %s') % (str(number), product_uom_name) + """: </col>
66 <col/>
67 <col f='yes'/>
68 <col t='yes'>"""+ rml_obj.formatLang(total_strd, digits=purchase_price_digits) +' '+ company_currency.symbol + """</col>
69@@ -174,7 +175,7 @@
70
71 xml += "<lines style='lines'>" + xml_tmp + '</lines>'
72 xml += """<lines style='sub_total'> <row>
73- <col> """ + _('Components Cost of ') + str(number) +' '+ product.uom_id.name + """: </col>
74+ <col> """ + _('Components Cost of %s %s') % (str(number), product_uom_name) + """: </col>
75 <col/>
76 <col t='yes'/>
77 <col t='yes'>"""+ rml_obj.formatLang(total_strd, digits=purchase_price_digits) +' '+ company_currency.symbol + """</col>
78@@ -191,14 +192,14 @@
79 xml += workcenter_header
80 xml += "<lines style='lines'>" + xml_tmp + '</lines>'
81 xml += """<lines style='sub_total'> <row>
82- <col> """ + _('Work Cost of ') + str(number) +' '+ product.uom_id.name +""": </col>
83+ <col> """ + _('Work Cost of %s %s') % (str(number), product_uom_name) +""": </col>
84 <col/>
85 <col/>
86 <col/>
87 <col t='yes'>"""+ rml_obj.formatLang(total2, digits=purchase_price_digits) +' '+ company_currency.symbol +"""</col>
88 </row></lines>'"""
89 xml += """<lines style='total'> <row>
90- <col> """ + _('Total Cost of ') + str(number) +' '+ product.uom_id.name + """: </col>
91+ <col> """ + _('Total Cost of %s %s') % (str(number), product_uom_name) + """: </col>
92 <col/>
93 <col t='yes'/>
94 <col t='yes'>"""+ rml_obj.formatLang(total_strd+total2, digits=purchase_price_digits) +' '+ company_currency.symbol + """</col>