[IMP]: remove replace and improve the report
bzr revid: ksa@tinyerp.com-20111019121549-q0yedbw2fdiihcpg
This commit is contained in:
parent
2ef34dc37b
commit
d7f017cde6
|
@ -50,14 +50,15 @@ class report_custom(report_rml):
|
|||
sum_strd = 0
|
||||
prod = product_pool.browse(cr, uid, bom['product_id'])
|
||||
|
||||
prod_name = to_xml(tools.ustr(bom['name']))
|
||||
prod_name = to_xml(bom['name'])
|
||||
prod_qtty = factor * bom['product_qty']
|
||||
product_uom = product_uom_pool.browse(cr, uid, bom['product_uom'], context=context)
|
||||
uom_id = to_xml(product_uom.name)
|
||||
main_sp_price, main_sp_name , main_strd_price = '','',''
|
||||
sellers, sellers_price = '',''
|
||||
|
||||
if prod.seller_id:
|
||||
main_sp_name = "<b>%s</b>\r\n" %(prod.seller_id.name)
|
||||
main_sp_name = "<b>%s</b>\r\n" %to_xml(prod.seller_id.name)
|
||||
pricelist = prod.seller_id.property_product_pricelist_purchase
|
||||
price = pricelist_pool.price_get(cr,uid,[pricelist.id],
|
||||
prod.id, number*prod_qtty or 1.0, prod.seller_id.id, {
|
||||
|
@ -70,7 +71,7 @@ class report_custom(report_rml):
|
|||
main_strd_price = str(std_price) + '\r\n'
|
||||
sum_strd = prod_qtty*std_price
|
||||
for seller_id in prod.seller_ids:
|
||||
sellers += '- <i>'+ seller_id.name.name +'</i>\r\n'
|
||||
sellers += '- <i>'+ to_xml(seller_id.name.name) +'</i>\r\n'
|
||||
pricelist = seller_id.name.property_product_pricelist_purchase
|
||||
price = pricelist_pool.price_get(cr,uid,[pricelist.id],
|
||||
prod.id, number*prod_qtty or 1.0, seller_id.name.id, {
|
||||
|
@ -78,9 +79,9 @@ class report_custom(report_rml):
|
|||
'date': time.strftime('%Y-%m-%d'),
|
||||
})[pricelist.id]
|
||||
sellers_price += """<i>"""+rml_obj.formatLang(price) +' '+ company_currency.symbol +"""</i>\r\n"""
|
||||
xml += """<col para='yes'> """+ to_xml(tools.ustr(prod_name)) +""" </col>
|
||||
<col para='yes'> """+ to_xml(tools.ustr(main_sp_name)) + to_xml(tools.ustr(sellers)) + """ </col>
|
||||
<col f='yes'>"""+ rml_obj.formatLang(prod_qtty) +' '+ to_xml(tools.ustr(product_uom.name)).replace('&', '&') +"""</col>
|
||||
xml += """<col para='yes'> """+ to_xml(prod_name) +""" </col>
|
||||
<col para='yes'> """+ to_xml(main_sp_name) + to_xml(sellers) + """ </col>
|
||||
<col f='yes'>"""+ rml_obj.formatLang(prod_qtty) +' '+ to_xml(uom_id) +"""</col>
|
||||
<col f='yes'>"""+ rml_obj.formatLang(float(main_strd_price)) +' '+ company_currency.symbol +"""</col>
|
||||
<col f='yes'>""" + main_sp_price + sellers_price + """</col>'"""
|
||||
|
||||
|
@ -89,11 +90,12 @@ class report_custom(report_rml):
|
|||
|
||||
def process_workcenter(wrk):
|
||||
workcenter = workcenter_pool.browse(cr, uid, wrk['workcenter_id'])
|
||||
workcenter_name = to_xml(workcenter.name)
|
||||
cost_cycle = wrk['cycle']*workcenter.costs_cycle
|
||||
cost_hour = wrk['hour']*workcenter.costs_hour
|
||||
total = cost_cycle + cost_hour
|
||||
xml = '<row>'
|
||||
xml += "<col para='yes'>" + to_xml(tools.ustr(workcenter.name)).replace('&', '&') + '</col>'
|
||||
xml += "<col para='yes'>" + to_xml(workcenter_name) + '</col>'
|
||||
xml += "<col/>"
|
||||
xml += """<col f='yes'>"""+rml_obj.formatLang(cost_cycle)+' '+ company_currency.symbol + """</col>"""
|
||||
xml += """<col f='yes'>"""+rml_obj.formatLang(cost_hour)+' '+ company_currency.symbol + """</col>"""
|
||||
|
@ -142,9 +144,11 @@ class report_custom(report_rml):
|
|||
purchase_price_digits = rml_obj.get_digits(dp='Purchase Price')
|
||||
|
||||
for product in product_pool.browse(cr, uid, ids, context=context):
|
||||
product_name = to_xml(product.name)
|
||||
uom_id = to_xml(product.uom_id.name)
|
||||
bom_id = bom_pool._bom_find(cr, uid, product.id, product.uom_id.id)
|
||||
title = "<title>%s</title>" %(_("Cost Structure"))
|
||||
title += "<title>%s</title>" % (to_xml(tools.ustr(product.name))).replace('&', '&')
|
||||
title += "<title>%s</title>" % (to_xml(product_name))
|
||||
xml += "<lines style='header'>" + title + prod_header + "</lines>"
|
||||
if not bom_id:
|
||||
total_strd = number * product.standard_price
|
||||
|
@ -157,7 +161,7 @@ class report_custom(report_rml):
|
|||
<col para='yes'>-</col>
|
||||
</row></lines>"""
|
||||
xml += """<lines style='total'> <row>
|
||||
<col> """ + _('Total Cost of %s %s') % (str(number), to_xml(tools.ustr(product.uom_id.name)).replace('&', '&')) + """: </col>
|
||||
<col> """ + _('Total Cost of %s %s') % (str(number), to_xml(uom_id)) + """: </col>
|
||||
<col/>
|
||||
<col f='yes'/>
|
||||
<col t='yes'>"""+ rml_obj.formatLang(total_strd, digits=purchase_price_digits) +' '+ company_currency.symbol + """</col>
|
||||
|
@ -184,7 +188,7 @@ class report_custom(report_rml):
|
|||
|
||||
xml += "<lines style='lines'>" + xml_tmp + '</lines>'
|
||||
xml += """<lines style='sub_total'> <row>
|
||||
<col> """ + _('Components Cost of %s %s') % (str(number), to_xml(tools.ustr(product.uom_id.name)).replace('&', '&')) + """: </col>
|
||||
<col> """ + _('Components Cost of %s %s') % (str(number), to_xml(uom_id)) + """: </col>
|
||||
<col/>
|
||||
<col t='yes'/>
|
||||
<col t='yes'>"""+ rml_obj.formatLang(total_strd, digits=purchase_price_digits) +' '+ company_currency.symbol + """</col>
|
||||
|
@ -201,14 +205,14 @@ class report_custom(report_rml):
|
|||
xml += workcenter_header
|
||||
xml += "<lines style='lines'>" + xml_tmp + '</lines>'
|
||||
xml += """<lines style='sub_total'> <row>
|
||||
<col> """ + _('Work Cost of %s %s') % (str(number), to_xml(tools.ustr(product.uom_id.name)).replace('&', '&')) +""": </col>
|
||||
<col> """ + _('Work Cost of %s %s') % (str(number), to_xml(uom_id)) +""": </col>
|
||||
<col/>
|
||||
<col/>
|
||||
<col/>
|
||||
<col t='yes'>"""+ rml_obj.formatLang(total2, digits=purchase_price_digits) +' '+ company_currency.symbol +"""</col>
|
||||
</row></lines>'"""
|
||||
xml += """<lines style='total'> <row>
|
||||
<col> """ + _('Total Cost of %s %s') % (str(number), to_xml(tools.ustr(product.uom_id.name)).replace('&', '&')) + """: </col>
|
||||
<col> """ + _('Total Cost of %s %s') % (str(number), to_xml(uom_id)) + """: </col>
|
||||
<col/>
|
||||
<col t='yes'/>
|
||||
<col t='yes'>"""+ rml_obj.formatLang(total_strd+total2, digits=purchase_price_digits) +' '+ company_currency.symbol + """</col>
|
||||
|
|
Loading…
Reference in New Issue