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
=== modified file 'mrp/report/price.py'
--- mrp/report/price.py 2011-10-02 17:31:16 +0000
+++ mrp/report/price.py 2011-11-03 13:35:28 +0000
@@ -22,14 +22,11 @@
22import time22import time
23import pooler23import pooler
24from report.interface import report_rml24from report.interface import report_rml
25#from report.interface import toxml
26from tools import to_xml25from tools import to_xml
27from report import report_sxw26from report import report_sxw
28from datetime import datetime27from datetime import datetime
29from tools.translate import _28from tools.translate import _
3029
31
32#FIXME: we should use toxml
33class report_custom(report_rml):30class report_custom(report_rml):
34 def create_xml(self, cr, uid, ids, datas, context=None):31 def create_xml(self, cr, uid, ids, datas, context=None):
35 number = (datas.get('form', False) and datas['form']['number']) or 132 number = (datas.get('form', False) and datas['form']['number']) or 1
@@ -50,14 +47,15 @@
50 sum_strd = 047 sum_strd = 0
51 prod = product_pool.browse(cr, uid, bom['product_id'])48 prod = product_pool.browse(cr, uid, bom['product_id'])
5249
53 prod_name = bom['name']50 prod_name = to_xml(bom['name'])
54 prod_qtty = factor * bom['product_qty']51 prod_qtty = factor * bom['product_qty']
55 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)
56 main_sp_price, main_sp_name , main_strd_price = '','',''54 main_sp_price, main_sp_name , main_strd_price = '','',''
57 sellers, sellers_price = '',''55 sellers, sellers_price = '',''
5856
59 if prod.seller_id:57 if prod.seller_id:
60 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'
61 pricelist = prod.seller_id.property_product_pricelist_purchase59 pricelist = prod.seller_id.property_product_pricelist_purchase
62 price = pricelist_pool.price_get(cr,uid,[pricelist.id],60 price = pricelist_pool.price_get(cr,uid,[pricelist.id],
63 prod.id, number*prod_qtty or 1.0, prod.seller_id.id, {61 prod.id, number*prod_qtty or 1.0, prod.seller_id.id, {
@@ -70,7 +68,7 @@
70 main_strd_price = str(std_price) + '\r\n'68 main_strd_price = str(std_price) + '\r\n'
71 sum_strd = prod_qtty*std_price69 sum_strd = prod_qtty*std_price
72 for seller_id in prod.seller_ids:70 for seller_id in prod.seller_ids:
73 sellers += '- <i>'+ seller_id.name.name +'</i>\r\n'71 sellers += '- <i>'+ to_xml(seller_id.name.name) +'</i>\r\n'
74 pricelist = seller_id.name.property_product_pricelist_purchase72 pricelist = seller_id.name.property_product_pricelist_purchase
75 price = pricelist_pool.price_get(cr,uid,[pricelist.id],73 price = pricelist_pool.price_get(cr,uid,[pricelist.id],
76 prod.id, number*prod_qtty or 1.0, seller_id.name.id, {74 prod.id, number*prod_qtty or 1.0, seller_id.name.id, {
@@ -80,7 +78,7 @@
80 sellers_price += """<i>"""+rml_obj.formatLang(price) +' '+ company_currency.symbol +"""</i>\r\n"""78 sellers_price += """<i>"""+rml_obj.formatLang(price) +' '+ company_currency.symbol +"""</i>\r\n"""
81 xml += """<col para='yes'> """+ prod_name +""" </col>79 xml += """<col para='yes'> """+ prod_name +""" </col>
82 <col para='yes'> """+ main_sp_name + sellers + """ </col>80 <col para='yes'> """+ main_sp_name + sellers + """ </col>
83 <col f='yes'>"""+ rml_obj.formatLang(prod_qtty) +' '+ product_uom.name +"""</col>81 <col f='yes'>"""+ rml_obj.formatLang(prod_qtty) +' '+ product_uom_name +"""</col>
84 <col f='yes'>"""+ rml_obj.formatLang(float(main_strd_price)) +' '+ company_currency.symbol +"""</col>82 <col f='yes'>"""+ rml_obj.formatLang(float(main_strd_price)) +' '+ company_currency.symbol +"""</col>
85 <col f='yes'>""" + main_sp_price + sellers_price + """</col>'"""83 <col f='yes'>""" + main_sp_price + sellers_price + """</col>'"""
8684
@@ -93,7 +91,7 @@
93 cost_hour = wrk['hour']*workcenter.costs_hour91 cost_hour = wrk['hour']*workcenter.costs_hour
94 total = cost_cycle + cost_hour92 total = cost_cycle + cost_hour
95 xml = '<row>'93 xml = '<row>'
96 xml += "<col para='yes'>" + workcenter.name + '</col>'94 xml += "<col para='yes'>" + to_xml(workcenter.name) + '</col>'
97 xml += "<col/>"95 xml += "<col/>"
98 xml += """<col f='yes'>"""+rml_obj.formatLang(cost_cycle)+' '+ company_currency.symbol + """</col>"""96 xml += """<col f='yes'>"""+rml_obj.formatLang(cost_cycle)+' '+ company_currency.symbol + """</col>"""
99 xml += """<col f='yes'>"""+rml_obj.formatLang(cost_hour)+' '+ company_currency.symbol + """</col>"""97 xml += """<col f='yes'>"""+rml_obj.formatLang(cost_hour)+' '+ company_currency.symbol + """</col>"""
@@ -142,9 +140,10 @@
142 purchase_price_digits = rml_obj.get_digits(dp='Purchase Price')140 purchase_price_digits = rml_obj.get_digits(dp='Purchase Price')
143141
144 for product in product_pool.browse(cr, uid, ids, context=context):142 for product in product_pool.browse(cr, uid, ids, context=context):
143 product_uom_name = to_xml(product.uom_id.name)
145 bom_id = bom_pool._bom_find(cr, uid, product.id, product.uom_id.id)144 bom_id = bom_pool._bom_find(cr, uid, product.id, product.uom_id.id)
146 title = "<title>%s</title>" %(_("Cost Structure"))145 title = "<title>%s</title>" %(_("Cost Structure"))
147 title += "<title>%s</title>" %product.name146 title += "<title>%s</title>" % (to_xml(product.name))
148 xml += "<lines style='header'>" + title + prod_header + "</lines>"147 xml += "<lines style='header'>" + title + prod_header + "</lines>"
149 if not bom_id:148 if not bom_id:
150 total_strd = number * product.standard_price149 total_strd = number * product.standard_price
@@ -157,7 +156,7 @@
157 <col para='yes'>-</col>156 <col para='yes'>-</col>
158 </row></lines>"""157 </row></lines>"""
159 xml += """<lines style='total'> <row>158 xml += """<lines style='total'> <row>
160 <col> """ + _('Total Cost of %s %s') % (str(number), product.uom_id.name) + """: </col>159 <col> """ + _('Total Cost of %s %s') % (str(number), product_uom_name) + """: </col>
161 <col/>160 <col/>
162 <col f='yes'/>161 <col f='yes'/>
163 <col t='yes'>"""+ rml_obj.formatLang(total_strd, digits=purchase_price_digits) +' '+ company_currency.symbol + """</col>162 <col t='yes'>"""+ rml_obj.formatLang(total_strd, digits=purchase_price_digits) +' '+ company_currency.symbol + """</col>
@@ -184,7 +183,7 @@
184183
185 xml += "<lines style='lines'>" + xml_tmp + '</lines>'184 xml += "<lines style='lines'>" + xml_tmp + '</lines>'
186 xml += """<lines style='sub_total'> <row>185 xml += """<lines style='sub_total'> <row>
187 <col> """ + _('Components Cost of %s %s') % (str(number), product.uom_id.name) + """: </col>186 <col> """ + _('Components Cost of %s %s') % (str(number), product_uom_name) + """: </col>
188 <col/>187 <col/>
189 <col t='yes'/>188 <col t='yes'/>
190 <col t='yes'>"""+ rml_obj.formatLang(total_strd, digits=purchase_price_digits) +' '+ company_currency.symbol + """</col>189 <col t='yes'>"""+ rml_obj.formatLang(total_strd, digits=purchase_price_digits) +' '+ company_currency.symbol + """</col>
@@ -201,14 +200,14 @@
201 xml += workcenter_header200 xml += workcenter_header
202 xml += "<lines style='lines'>" + xml_tmp + '</lines>'201 xml += "<lines style='lines'>" + xml_tmp + '</lines>'
203 xml += """<lines style='sub_total'> <row>202 xml += """<lines style='sub_total'> <row>
204 <col> """ + _('Work Cost of %s %s') % (str(number), product.uom_id.name) +""": </col>203 <col> """ + _('Work Cost of %s %s') % (str(number), product_uom_name) +""": </col>
205 <col/>204 <col/>
206 <col/>205 <col/>
207 <col/>206 <col/>
208 <col t='yes'>"""+ rml_obj.formatLang(total2, digits=purchase_price_digits) +' '+ company_currency.symbol +"""</col>207 <col t='yes'>"""+ rml_obj.formatLang(total2, digits=purchase_price_digits) +' '+ company_currency.symbol +"""</col>
209 </row></lines>'"""208 </row></lines>'"""
210 xml += """<lines style='total'> <row>209 xml += """<lines style='total'> <row>
211 <col> """ + _('Total Cost of %s %s') % (str(number), product.uom_id.name) + """: </col>210 <col> """ + _('Total Cost of %s %s') % (str(number), product_uom_name) + """: </col>
212 <col/>211 <col/>
213 <col t='yes'/>212 <col t='yes'/>
214 <col t='yes'>"""+ rml_obj.formatLang(total_strd+total2, digits=purchase_price_digits) +' '+ company_currency.symbol + """</col>213 <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: