Merge lp:~openerp-dev/openobject-addons/trunk-bug-834004-ksa into lp:openobject-addons

Proposed by Kirti Savalia(OpenERP)
Status: Merged
Merged at revision: 5494
Proposed branch: lp:~openerp-dev/openobject-addons/trunk-bug-834004-ksa
Merge into: lp:openobject-addons
Diff against target: 110 lines (+12/-13)
1 file modified
mrp/report/price.py (+12/-13)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/trunk-bug-834004-ksa
Reviewer Review Type Date Requested Status
Rucha (Open ERP) (community) Approve
Kirti Savalia(OpenERP) (community) Needs Resubmitting
qdp (OpenERP) Needs Fixing
Review via email: mp+73749@code.launchpad.net

Description of the change

predefined entities problem in product cost structure.

To post a comment you must log in.
Revision history for this message
Rucha (Open ERP) (rpa-openerp) :
review: Approve
Revision history for this message
qdp (OpenERP) (qdp) wrote :

1- shouldn't it be tools.to_xml?
2- to_xml is already replacing '&' by '&', so no need to do it again

review: Needs Fixing
Revision history for this message
Kirti Savalia(OpenERP) (ksa-openerp) :
review: Needs Resubmitting
Revision history for this message
Rucha (Open ERP) (rpa-openerp) wrote :

its very strange that we need to use to_xml 2 times on the values
and the report is being correctly printed with & only if we have it like "&",
we need to find whats the problem,

also I don't like the variable names,
uom_id is actually name of uom, please change it,
also do the same changes on other variables in it where you find its not understandable properly

thanks

review: Needs Fixing
Revision history for this message
qdp (OpenERP) (qdp) wrote :

As we are trying to keep a clean merge proposal list on which review is needed, i'm also setting your merge proposal in "work in progress". Set it back to "needs review" when your work is over and it will automatcally appears in our TODO-list.

Thanks,
Quentin

Revision history for this message
Kirti Savalia(OpenERP) (ksa-openerp) wrote :

Hello,

use to_xml 2 time because this problem occur in server side.now it is fixed in https://bugs.launchpad.net/openobject-server/+bug/885299

Thanks.

review: Needs Resubmitting
Revision history for this message
Rucha (Open ERP) (rpa-openerp) wrote :

it seems ok now, you may remove this line:
15 #FIXME: we should use toxml

Thanks

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-10-02 17:31:16 +0000
3+++ mrp/report/price.py 2011-11-03 13:35:28 +0000
4@@ -22,14 +22,11 @@
5 import time
6 import pooler
7 from report.interface import report_rml
8-#from report.interface import toxml
9 from tools import to_xml
10 from report import report_sxw
11 from datetime import datetime
12 from tools.translate import _
13
14-
15-#FIXME: we should use toxml
16 class report_custom(report_rml):
17 def create_xml(self, cr, uid, ids, datas, context=None):
18 number = (datas.get('form', False) and datas['form']['number']) or 1
19@@ -50,14 +47,15 @@
20 sum_strd = 0
21 prod = product_pool.browse(cr, uid, bom['product_id'])
22
23- prod_name = bom['name']
24+ prod_name = to_xml(bom['name'])
25 prod_qtty = factor * bom['product_qty']
26 product_uom = product_uom_pool.browse(cr, uid, bom['product_uom'], context=context)
27+ product_uom_name = to_xml(product_uom.name)
28 main_sp_price, main_sp_name , main_strd_price = '','',''
29 sellers, sellers_price = '',''
30
31 if prod.seller_id:
32- main_sp_name = "<b>%s</b>\r\n" %(prod.seller_id.name)
33+ main_sp_name = '- <b>'+ to_xml(prod.seller_id.name) +'</b>\r\n'
34 pricelist = prod.seller_id.property_product_pricelist_purchase
35 price = pricelist_pool.price_get(cr,uid,[pricelist.id],
36 prod.id, number*prod_qtty or 1.0, prod.seller_id.id, {
37@@ -70,7 +68,7 @@
38 main_strd_price = str(std_price) + '\r\n'
39 sum_strd = prod_qtty*std_price
40 for seller_id in prod.seller_ids:
41- sellers += '- <i>'+ seller_id.name.name +'</i>\r\n'
42+ sellers += '- <i>'+ to_xml(seller_id.name.name) +'</i>\r\n'
43 pricelist = seller_id.name.property_product_pricelist_purchase
44 price = pricelist_pool.price_get(cr,uid,[pricelist.id],
45 prod.id, number*prod_qtty or 1.0, seller_id.name.id, {
46@@ -80,7 +78,7 @@
47 sellers_price += """<i>"""+rml_obj.formatLang(price) +' '+ company_currency.symbol +"""</i>\r\n"""
48 xml += """<col para='yes'> """+ prod_name +""" </col>
49 <col para='yes'> """+ main_sp_name + sellers + """ </col>
50- <col f='yes'>"""+ rml_obj.formatLang(prod_qtty) +' '+ product_uom.name +"""</col>
51+ <col f='yes'>"""+ rml_obj.formatLang(prod_qtty) +' '+ product_uom_name +"""</col>
52 <col f='yes'>"""+ rml_obj.formatLang(float(main_strd_price)) +' '+ company_currency.symbol +"""</col>
53 <col f='yes'>""" + main_sp_price + sellers_price + """</col>'"""
54
55@@ -93,7 +91,7 @@
56 cost_hour = wrk['hour']*workcenter.costs_hour
57 total = cost_cycle + cost_hour
58 xml = '<row>'
59- xml += "<col para='yes'>" + workcenter.name + '</col>'
60+ xml += "<col para='yes'>" + to_xml(workcenter.name) + '</col>'
61 xml += "<col/>"
62 xml += """<col f='yes'>"""+rml_obj.formatLang(cost_cycle)+' '+ company_currency.symbol + """</col>"""
63 xml += """<col f='yes'>"""+rml_obj.formatLang(cost_hour)+' '+ company_currency.symbol + """</col>"""
64@@ -142,9 +140,10 @@
65 purchase_price_digits = rml_obj.get_digits(dp='Purchase Price')
66
67 for product in product_pool.browse(cr, uid, ids, context=context):
68+ product_uom_name = to_xml(product.uom_id.name)
69 bom_id = bom_pool._bom_find(cr, uid, product.id, product.uom_id.id)
70 title = "<title>%s</title>" %(_("Cost Structure"))
71- title += "<title>%s</title>" %product.name
72+ title += "<title>%s</title>" % (to_xml(product.name))
73 xml += "<lines style='header'>" + title + prod_header + "</lines>"
74 if not bom_id:
75 total_strd = number * product.standard_price
76@@ -157,7 +156,7 @@
77 <col para='yes'>-</col>
78 </row></lines>"""
79 xml += """<lines style='total'> <row>
80- <col> """ + _('Total Cost of %s %s') % (str(number), product.uom_id.name) + """: </col>
81+ <col> """ + _('Total Cost of %s %s') % (str(number), product_uom_name) + """: </col>
82 <col/>
83 <col f='yes'/>
84 <col t='yes'>"""+ rml_obj.formatLang(total_strd, digits=purchase_price_digits) +' '+ company_currency.symbol + """</col>
85@@ -184,7 +183,7 @@
86
87 xml += "<lines style='lines'>" + xml_tmp + '</lines>'
88 xml += """<lines style='sub_total'> <row>
89- <col> """ + _('Components Cost of %s %s') % (str(number), product.uom_id.name) + """: </col>
90+ <col> """ + _('Components Cost of %s %s') % (str(number), product_uom_name) + """: </col>
91 <col/>
92 <col t='yes'/>
93 <col t='yes'>"""+ rml_obj.formatLang(total_strd, digits=purchase_price_digits) +' '+ company_currency.symbol + """</col>
94@@ -201,14 +200,14 @@
95 xml += workcenter_header
96 xml += "<lines style='lines'>" + xml_tmp + '</lines>'
97 xml += """<lines style='sub_total'> <row>
98- <col> """ + _('Work Cost of %s %s') % (str(number), product.uom_id.name) +""": </col>
99+ <col> """ + _('Work Cost of %s %s') % (str(number), product_uom_name) +""": </col>
100 <col/>
101 <col/>
102 <col/>
103 <col t='yes'>"""+ rml_obj.formatLang(total2, digits=purchase_price_digits) +' '+ company_currency.symbol +"""</col>
104 </row></lines>'"""
105 xml += """<lines style='total'> <row>
106- <col> """ + _('Total Cost of %s %s') % (str(number), product.uom_id.name) + """: </col>
107+ <col> """ + _('Total Cost of %s %s') % (str(number), product_uom_name) + """: </col>
108 <col/>
109 <col t='yes'/>
110 <col t='yes'>"""+ rml_obj.formatLang(total_strd+total2, digits=purchase_price_digits) +' '+ company_currency.symbol + """</col>

Subscribers

People subscribed via source and target branches

to all changes: