Merge lp:~openerp-dev/openobject-addons/6.0-opw-6286-ach into lp:openobject-addons/6.0

Proposed by Anup(SerpentCS)
Status: Needs review
Proposed branch: lp:~openerp-dev/openobject-addons/6.0-opw-6286-ach
Merge into: lp:openobject-addons/6.0
Diff against target: 119 lines (+24/-24)
1 file modified
mrp/report/price.py (+24/-24)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/6.0-opw-6286-ach
Reviewer Review Type Date Requested Status
Jay Vora (Serpent Consulting Services) Pending
Review via email: mp+64821@code.launchpad.net

Description of the change

Hello,

 XML report of mrp will crash the report when characters like '&','<','>' are used in the name of the supplier or product.

I have fixed the issue by this.

Thanks,

To post a comment you must log in.
Revision history for this message
Rifakat Husen (OpenERP) (rha-openerp) wrote :

Fix for this issue has already been landed into stable with,
r4967, Revision ID: <email address hidden>

Remarkable efforts, thanks!
Rejecting this merge as this is already been fixed.

Regards,
Rifakat

Unmerged revisions

4654. By Anup(SerpentCS)

[FIX] mrp : XML Reports may crash when characters like &,>,< are passed, Fixed(6286)

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-06-16 13:19:25 +0000
4@@ -55,23 +55,23 @@
5 sellers, sellers_price = '',''
6
7 if prod.seller_id:
8- main_sp_name = "<b>%s</b>\r\n" %(prod.seller_id.name)
9+ main_sp_name = "<b>%s</b>\r\n" %(to_xml(prod.seller_id.name))
10 price = supplier_info_pool.price_get(cr, uid, prod.seller_id.id, prod.id, number*prod_qtty)[prod.seller_id.id]
11 price = product_uom_pool._compute_price(cr, uid, prod.uom_id.id, price, to_uom_id=product_uom.id)
12- main_sp_price = """<b>"""+rml_obj.formatLang(price)+' '+ company_currency.symbol+"""</b>\r\n"""
13+ main_sp_price = """<b>"""+rml_obj.formatLang(price)+' '+ to_xml(company_currency.symbol)+"""</b>\r\n"""
14 sum += prod_qtty*price
15 std_price = product_uom_pool._compute_price(cr, uid, prod.uom_id.id, prod.standard_price, to_uom_id=product_uom.id)
16 main_strd_price = str(std_price) + '\r\n'
17 sum_strd = prod_qtty*std_price
18 for seller_id in prod.seller_ids:
19- sellers += '- <i>'+ seller_id.name.name +'</i>\r\n'
20+ sellers += '- <i>'+ to_xml(seller_id.name.name) +'</i>\r\n'
21 price = supplier_info_pool.price_get(cr, uid, seller_id.name.id, prod.id, number*prod_qtty)[seller_id.name.id]
22 price = product_uom_pool._compute_price(cr, uid, prod.uom_id.id, price, to_uom_id=product_uom.id)
23- sellers_price += """<i>"""+rml_obj.formatLang(price) +' '+ company_currency.symbol +"""</i>\r\n"""
24+ sellers_price += """<i>"""+rml_obj.formatLang(price) +' '+ to_xml(company_currency.symbol) +"""</i>\r\n"""
25 xml += """<col para='yes'> """+ prod_name +""" </col>
26 <col para='yes'> """+ main_sp_name + sellers + """ </col>
27- <col f='yes'>"""+ rml_obj.formatLang(prod_qtty) +' '+ product_uom.name +"""</col>
28- <col f='yes'>"""+ rml_obj.formatLang(float(main_strd_price)) +' '+ company_currency.symbol +"""</col>
29+ <col f='yes'>"""+ rml_obj.formatLang(prod_qtty) +' '+ to_xml(product_uom.name) +"""</col>
30+ <col f='yes'>"""+ rml_obj.formatLang(float(main_strd_price)) +' '+ to_xml(company_currency.symbol) +"""</col>
31 <col f='yes'>""" + main_sp_price + sellers_price + """</col>'"""
32
33 xml += '</row>'
34@@ -83,11 +83,11 @@
35 cost_hour = wrk['hour']*workcenter.costs_hour
36 total = cost_cycle + cost_hour
37 xml = '<row>'
38- xml += "<col para='yes'>" + workcenter.name + '</col>'
39+ xml += "<col para='yes'>" + to_xml(workcenter.name) + '</col>'
40 xml += "<col/>"
41- xml += """<col f='yes'>"""+rml_obj.formatLang(cost_cycle)+' '+ company_currency.symbol + """</col>"""
42- xml += """<col f='yes'>"""+rml_obj.formatLang(cost_hour)+' '+ company_currency.symbol + """</col>"""
43- xml += """<col f='yes'>"""+rml_obj.formatLang(cost_hour + cost_cycle)+' '+ company_currency.symbol + """</col>"""
44+ xml += """<col f='yes'>"""+rml_obj.formatLang(cost_cycle)+' '+ to_xml(company_currency.symbol) + """</col>"""
45+ xml += """<col f='yes'>"""+rml_obj.formatLang(cost_hour)+' '+ to_xml(company_currency.symbol) + """</col>"""
46+ xml += """<col f='yes'>"""+rml_obj.formatLang(cost_hour + cost_cycle)+' '+ to_xml(company_currency.symbol) + """</col>"""
47 xml += '</row>'
48
49 return xml, total
50@@ -102,7 +102,7 @@
51 <PageWidth>595.27</PageWidth>
52 <PageHeight>841.88</PageHeight>
53 <tableSize>55.00mm,58.00mm,29.00mm,29.00mm,29.00mm</tableSize>
54- """ % (user_pool.browse(cr, uid, uid).company_id.name)
55+ """ % (to_xml(user_pool.browse(cr, uid, uid).company_id.name))
56 config_stop = """
57 <report-footer>Generated by OpenERP</report-footer>
58 </config>
59@@ -134,7 +134,7 @@
60 for product in product_pool.browse(cr, uid, ids, context=context):
61 bom_id = bom_pool._bom_find(cr, uid, product.id, product.uom_id.id)
62 title = "<title>%s</title>" %(_("Cost Structure"))
63- title += "<title>%s</title>" %product.name
64+ title += "<title>%s</title>" %to_xml(product.name)
65 xml += "<lines style='header'>" + title + prod_header + "</lines>"
66 if not bom_id:
67 total_strd = number * product.standard_price
68@@ -147,11 +147,11 @@
69 <col para='yes'>-</col>
70 </row></lines>"""
71 xml += """<lines style='total'> <row>
72- <col> """ + _('Total Cost of ') + str(number) +' '+ product.uom_id.name + """: </col>
73+ <col> """ + _('Total Cost of ') + str(number) +' '+ to_xml(product.uom_id.name) + """: </col>
74 <col/>
75 <col f='yes'/>
76- <col t='yes'>"""+ rml_obj.formatLang(total_strd, digits=purchase_price_digits) +' '+ company_currency.symbol + """</col>
77- <col t='yes'>"""+ rml_obj.formatLang(total, digits=purchase_price_digits) +' '+ company_currency.symbol + """</col>
78+ <col t='yes'>"""+ rml_obj.formatLang(total_strd, digits=purchase_price_digits) +' '+ to_xml(company_currency.symbol) + """</col>
79+ <col t='yes'>"""+ rml_obj.formatLang(total, digits=purchase_price_digits) +' '+ to_xml(company_currency.symbol) + """</col>
80 </row></lines>'"""
81 else:
82 bom = bom_pool.browse(cr, uid, bom_id, context=context)
83@@ -174,10 +174,10 @@
84
85 xml += "<lines style='lines'>" + xml_tmp + '</lines>'
86 xml += """<lines style='sub_total'> <row>
87- <col> """ + _('Components Cost of ') + str(number) +' '+ product.uom_id.name + """: </col>
88+ <col> """ + _('Components Cost of ') + str(number) +' '+ to_xml(product.uom_id.name) + """: </col>
89 <col/>
90 <col t='yes'/>
91- <col t='yes'>"""+ rml_obj.formatLang(total_strd, digits=purchase_price_digits) +' '+ company_currency.symbol + """</col>
92+ <col t='yes'>"""+ rml_obj.formatLang(total_strd, digits=purchase_price_digits) +' '+ to_xml(company_currency.symbol) + """</col>
93 <col t='yes'></col>
94 </row></lines>'"""
95
96@@ -191,17 +191,17 @@
97 xml += workcenter_header
98 xml += "<lines style='lines'>" + xml_tmp + '</lines>'
99 xml += """<lines style='sub_total'> <row>
100- <col> """ + _('Work Cost of ') + str(number) +' '+ product.uom_id.name +""": </col>
101- <col/>
102- <col/>
103- <col/>
104- <col t='yes'>"""+ rml_obj.formatLang(total2, digits=purchase_price_digits) +' '+ company_currency.symbol +"""</col>
105+ <col> """ + _('Work Cost of ') + str(number) +' '+ to_xml(product.uom_id.name) +""": </col>
106+ <col/>
107+ <col/>
108+ <col/>
109+ <col t='yes'>"""+ rml_obj.formatLang(total2, digits=purchase_price_digits) +' '+ to_xml(company_currency.symbol) +"""</col>
110 </row></lines>'"""
111 xml += """<lines style='total'> <row>
112- <col> """ + _('Total Cost of ') + str(number) +' '+ product.uom_id.name + """: </col>
113+ <col> """ + _('Total Cost of ') + str(number) +' '+ to_xml(product.uom_id.name) + """: </col>
114 <col/>
115 <col t='yes'/>
116- <col t='yes'>"""+ rml_obj.formatLang(total_strd+total2, digits=purchase_price_digits) +' '+ company_currency.symbol + """</col>
117+ <col t='yes'>"""+ rml_obj.formatLang(total_strd+total2, digits=purchase_price_digits) +' '+ to_xml(company_currency.symbol) + """</col>
118 <col t='yes'></col>
119 </row></lines>'"""
120