Merge lp:~openerp-dev/openobject-addons/6.0-xmlreport-improvements-nep into lp:openobject-addons/6.0

Proposed by Nehal Panchal (OpenERP)
Status: Needs review
Proposed branch: lp:~openerp-dev/openobject-addons/6.0-xmlreport-improvements-nep
Merge into: lp:openobject-addons/6.0
Diff against target: 163 lines (+18/-18)
7 files modified
auction/report/huissier.py (+1/-1)
auction/report/total.py (+4/-4)
hr_attendance/report/attendance_by_month.py (+1/-1)
hr_holidays/report/holidays_summary_report.py (+3/-3)
hr_timesheet/report/user_timesheet.py (+2/-2)
product/report/pricelist.py (+5/-5)
stock/report/stock_by_location.py (+2/-2)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/6.0-xmlreport-improvements-nep
Reviewer Review Type Date Requested Status
Anup(SerpentCS) Pending
Review via email: mp+65335@code.launchpad.net
To post a comment you must log in.

Unmerged revisions

4669. By Nehal Panchal (OpenERP)

[FIX] auction,hr_attendance,hr_holidays,hr_timesheet,product,stock : XML Reports may crash when characters like &,>,< are passed, Fixed

4668. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

4667. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'auction/report/huissier.py'
2--- auction/report/huissier.py 2011-01-14 00:11:01 +0000
3+++ auction/report/huissier.py 2011-06-21 12:04:00 +0000
4@@ -22,9 +22,9 @@
5 import pooler
6 from osv.osv import osv, orm
7 from report.interface import report_rml
8+from report.interface import toxml
9 #FIXME: use the one from tools and delete the one from report
10 from report.int_to_text import int_to_text
11-from tools import to_xml as toxml
12 from tools import ustr
13
14 class report_custom(report_rml):
15
16=== modified file 'auction/report/total.py'
17--- auction/report/total.py 2011-01-14 00:11:01 +0000
18+++ auction/report/total.py 2011-06-21 12:04:00 +0000
19@@ -27,9 +27,9 @@
20 import report.render
21 import report.common
22 from report.interface import report_rml
23-
24-def toxml(val):
25- return val.replace('&', '&amp;').replace('<','&lt;').replace('>','&gt;').decode('utf-8').encode('latin1')
26+from report.interface import toxml
27+
28+
29
30 class report_custom(report_rml):
31 def __init__(self, name, table, tmpl, xsl):
32@@ -111,7 +111,7 @@
33 <sell_nbr>%d</sell_nbr>
34 <debit>%.2f</debit>
35 </seller>
36-</report>''' % (time.strftime('%d/%m/%Y'), toxml(auction['name']), auction['auction1'], len(lots), est1, est2, unsold, adj, len(buyer), len(paid_ids), comm, emp, unpaid, paid, len(seller), debit)
37+</report>''' % (time.strftime('%d/%m/%Y'), toxml(auction['name']), toxml(auction['auction1']), len(lots), est1, est2, unsold, adj, len(buyer), len(paid_ids), comm, emp, unpaid, paid, len(seller), debit)
38
39 return self.post_process_xml_data(cr, uid, xml, context)
40
41
42=== modified file 'hr_attendance/report/attendance_by_month.py'
43--- hr_attendance/report/attendance_by_month.py 2011-01-17 18:02:22 +0000
44+++ hr_attendance/report/attendance_by_month.py 2011-06-21 12:04:00 +0000
45@@ -103,7 +103,7 @@
46 <date>%s</date>
47 <company>%s</company>
48 </header>
49- ''' % (str(rml_obj.formatLang(time.strftime("%Y-%m-%d"),date=True))+' ' + str(time.strftime("%H:%M")),pooler.get_pool(cr.dbname).get('res.users').browse(cr,uid,uid).company_id.name)
50+ ''' % (str(rml_obj.formatLang(time.strftime("%Y-%m-%d"),date=True))+' ' + str(time.strftime("%H:%M")),toxml(pooler.get_pool(cr.dbname).get('res.users').browse(cr,uid,uid).company_id.name))
51
52 first_date = str(month)
53 som = datetime.strptime(first_date, '%Y-%m-%d %H:%M:%S')
54
55=== modified file 'hr_holidays/report/holidays_summary_report.py'
56--- hr_holidays/report/holidays_summary_report.py 2011-01-17 18:02:22 +0000
57+++ hr_holidays/report/holidays_summary_report.py 2011-06-21 12:04:00 +0000
58@@ -70,7 +70,7 @@
59 display[index]=' '
60 count=''
61
62- data_xml=['<info id="%d" number="%d" val="%s" />' % (row_id,x,display[x]) for x in range(1,len(display)+1) ]
63+ data_xml=['<info id="%d" number="%d" val="%s" />' % (row_id,x,toxml(display[x])) for x in range(1,len(display)+1) ]
64
65 # Computing the xml
66 xml = '''
67@@ -120,7 +120,7 @@
68
69 # date_xml=[]
70 for l in range(0,len(legend)):
71- date_xml += ['<legend row="%d" id="%d" name="%s" color="%s" />' % (l+1,legend[l][0],legend[l][1],legend[l][2])]
72+ date_xml += ['<legend row="%d" id="%d" name="%s" color="%s" />' % (l+1,legend[l][0],toxml(legend[l][1]),toxml(legend[l][2]))]
73
74 date_xml += ['<date month="%s" year="%d" />' % (som.strftime('%B'), som.year),'<days>']
75
76@@ -235,7 +235,7 @@
77 <date>%s</date>
78 <company>%s</company>
79 </header>
80- ''' % (str(rml_obj.formatLang(time.strftime("%Y-%m-%d"),date=True))+' ' + str(time.strftime("%H:%M")),pooler.get_pool(cr.dbname).get('res.users').browse(cr,uid,uid).company_id.name)
81+ ''' % (str(rml_obj.formatLang(time.strftime("%Y-%m-%d"),date=True))+' ' + str(time.strftime("%H:%M")),toxml(pooler.get_pool(cr.dbname).get('res.users').browse(cr,uid,uid).company_id.name))
82
83 # Computing the xml
84 xml='''<?xml version="1.0" encoding="UTF-8" ?>
85
86=== modified file 'hr_timesheet/report/user_timesheet.py'
87--- hr_timesheet/report/user_timesheet.py 2011-02-07 11:38:37 +0000
88+++ hr_timesheet/report/user_timesheet.py 2011-06-21 12:04:00 +0000
89@@ -78,7 +78,7 @@
90
91 for presence in cr.dictfetchall():
92 day = int(presence['date'][-2:])
93- account = accounts.setdefault((presence['account_id'], presence['name']), {})
94+ account = accounts.setdefault((presence['account_id'], toxml(presence['name'])), {})
95 account[day] = account.get(day, 0.0) + presence['amount']
96
97 xml = '''
98@@ -94,7 +94,7 @@
99 <date>%s</date>
100 <company>%s</company>
101 </header>
102- ''' % (str(rml_obj.formatLang(time.strftime("%Y-%m-%d"),date=True))+' ' + str(time.strftime("%H:%M")),pooler.get_pool(cr.dbname).get('res.users').browse(cr,uid,user_id).company_id.name)
103+ ''' % (str(rml_obj.formatLang(time.strftime("%Y-%m-%d"),date=True))+' ' + str(time.strftime("%H:%M")),toxml(pooler.get_pool(cr.dbname).get('res.users').browse(cr,uid,user_id).company_id.name))
104
105 account_xml = []
106 for account, telems in accounts.iteritems():
107
108=== modified file 'product/report/pricelist.py'
109--- product/report/pricelist.py 2011-02-15 10:55:46 +0000
110+++ product/report/pricelist.py 2011-06-21 12:04:00 +0000
111@@ -62,8 +62,8 @@
112 date = datetime.date.today()
113 str_date=date.strftime("%d/%m/%Y")
114 product_xml.append('<cols>'+cols+'</cols>')
115- product_xml.append('<pricelist> %s </pricelist>'%currency['name'])
116- product_xml.append('<currency> %s </currency>'%currency['currency_id'][1])
117+ product_xml.append('<pricelist> %s </pricelist>'% toxml(currency['name']))
118+ product_xml.append('<currency> %s </currency>'% toxml(currency['currency_id'][1]))
119 product_xml.append('<date> %s </date>'%str_date)
120 product_xml.append("<product>")
121
122@@ -74,7 +74,7 @@
123 products = pool.get('product.product').read(cr, uid, product_ids, ['id','name','code'])
124 pro = []
125 i=0
126- pro.append('<pro name="%s" categ="true">' % (categ_name[0]['name']))
127+ pro.append('<pro name="%s" categ="true">' % toxml(categ_name[0]['name']))
128 temp = []
129 for q in qty:
130 temp.append('<price name=" " />')
131@@ -85,9 +85,9 @@
132 x['name'] = x['name'].replace("&","&amp;")
133 x['name'] = x['name'].replace("\"","&quot;")
134 if x['code']:
135- pro.append('<pro name="[%s] %s" >' % (x['code'], x['name']))
136+ pro.append('<pro name="[%s] %s" >' % (x['code'], toxml(x['name'])))
137 else:
138- pro.append('<pro name="%s" >' % (x['name']))
139+ pro.append('<pro name="%s" >' % toxml(x['name']))
140 temp = []
141 for q in qty:
142 price_dict = pool.get('product.pricelist').price_get(cr, uid, [price_list_id], x['id'], q, context=context)
143
144=== modified file 'stock/report/stock_by_location.py'
145--- stock/report/stock_by_location.py 2011-01-14 00:11:01 +0000
146+++ stock/report/stock_by_location.py 2011-06-21 12:04:00 +0000
147@@ -50,14 +50,14 @@
148 xml = '<row>'
149 location_name = pooler.get_pool(cr.dbname).get('stock.location').read(cr, uid, [location_id], ['name'])
150 xml += "<col para='yes' tree='yes' space='" + str(3*level) + "mm'>"
151- xml += location_name[0]['name'] + '</col>'
152+ xml += toxml(location_name[0]['name']) + '</col>'
153
154 prod_info = pooler.get_pool(cr.dbname).get('stock.location')._product_get(cr, uid, location_id)
155 xml += "<col>"
156 for prod_id in prod_info.keys():
157 if prod_info[prod_id] != 0.0:
158 prod_name = pooler.get_pool(cr.dbname).get('product.product').read(cr, uid, [prod_id], ['name'])
159- xml += prod_name[0]['name'] + '\n'
160+ xml += toxml(prod_name[0]['name']) + '\n'
161 xml += '</col>'
162
163 xml += "<col>"