[IMP]:mrp:improved Cost Structure report with new report format.
bzr revid: apa@tinyerp.com-20100820112524-9ttzdxbjwi0ti1qi
This commit is contained in:
parent
bd1f0ec92c
commit
f2ef891e57
|
@ -69,10 +69,10 @@ class report_custom(report_rml):
|
|||
|
||||
xml += "<col para='yes'>" + prod_name + '</col>'
|
||||
xml += "<col para='yes'>" + main_sp_name + sellers + '</col>'
|
||||
xml += "<col para='yes'>" + str(prod_qtty) + '</col>'
|
||||
xml += "<col para='yes'>" + product_uom.name + '</col>'
|
||||
xml += "<col para='yes'>" + main_strd_price + '</col>'
|
||||
xml += "<col para='yes'>" + main_sp_price + sellers_price + '</col>'
|
||||
xml += "<col f='yes'>" + str(prod_qtty) + '</col>'
|
||||
xml += "<col f='yes'>" + product_uom.name + '</col>'
|
||||
xml += "<col f='yes'>" + main_strd_price + '</col>'
|
||||
xml += "<col f='yes'>" + main_sp_price + sellers_price + '</col>'
|
||||
|
||||
|
||||
xml += '</row>'
|
||||
|
@ -87,9 +87,9 @@ class report_custom(report_rml):
|
|||
xml += "<col para='yes'>" + workcenter.name + '</col>'
|
||||
xml += "<col/>"
|
||||
xml += "<col/>"
|
||||
xml += "<col para='yes'>" + str(cost_cycle) + '</col>'
|
||||
xml += "<col para='yes'>" + str(cost_hour) + '</col>'
|
||||
xml += "<col para='yes'>" + str(cost_hour + cost_cycle) + '</col>'
|
||||
xml += "<col f='yes'>" + str(cost_cycle) + '</col>'
|
||||
xml += "<col f='yes'>" + str(cost_hour) + '</col>'
|
||||
xml += "<col f='yes'>" + str(cost_hour + cost_cycle) + '</col>'
|
||||
xml += '</row>'
|
||||
|
||||
return xml, total
|
||||
|
@ -102,7 +102,7 @@ class report_custom(report_rml):
|
|||
<PageSize>210.00mm,297.00mm</PageSize>
|
||||
<PageWidth>595.27</PageWidth>
|
||||
<PageHeight>841.88</PageHeight>
|
||||
<tableSize>60.00mm,60.00mm, 20.00mm, 20.00mm, 20.00mm, 20.00mm</tableSize>
|
||||
<tableSize>55.00mm,55.00mm, 20.00mm, 22.00mm, 22.00mm, 25.00mm</tableSize>
|
||||
"""
|
||||
config_stop = """
|
||||
<report-footer>Generated by OpenERP</report-footer>
|
||||
|
@ -114,30 +114,30 @@ class report_custom(report_rml):
|
|||
<row>
|
||||
<col>%s</col>
|
||||
<col/>
|
||||
<col/>
|
||||
<col>%s</col>
|
||||
<col>%s</col>
|
||||
<col>%s</col>
|
||||
<col t='yes'/>
|
||||
<col t='yes'>%s</col>
|
||||
<col t='yes'>%s</col>
|
||||
<col t='yes'>%s</col>
|
||||
</row>
|
||||
</lines>
|
||||
""" % (_('Work Center name'), _('Cycles Cost'), _('Hourly Cost'),_('Work Cost'))
|
||||
prod_header = """
|
||||
<row>
|
||||
<col para='yes'>%s</col>
|
||||
<col para='yes'>%s</col>
|
||||
<col para='yes'>%s</col>
|
||||
<col para='yes'>%s</col>
|
||||
<col para='yes'>%s</col>
|
||||
<col para='yes'>%s</col>
|
||||
<col>%s</col>
|
||||
<col>%s</col>
|
||||
<col t='yes'>%s</col>
|
||||
<col t='yes'>%s</col>
|
||||
<col t='yes'>%s</col>
|
||||
<col t='yes'>%s</col>
|
||||
</row>
|
||||
""" % (_('Componet'), _('Componet suppliers'), _('Quantity'), _('Uom'), _('Cost Unit Price per Uom'), _('Supplier Unit Price per Uom'))
|
||||
""" % (_('Componet'), _('Componet suppliers'), _('Quantity'), _('Uom'), _('Cost Price per Uom'), _('Supplier Price per Uom'))
|
||||
|
||||
company_currency = user_pool.browse(cr, uid, uid).company_id.currency_id.id
|
||||
for product in product_pool.browse(cr, uid, ids, context=context):
|
||||
bom_id = bom_pool._bom_find(cr, uid, product.id, product.uom_id.id)
|
||||
title = "<title>%s</title>" %(_("Cost Structure"))
|
||||
title += "<title>%s</title>" %product.name
|
||||
xml += "<lines style='header'>" + title + prod_header + "</lines>"
|
||||
xml += "<lines style='header'>" + title + prod_header + "</lines>"
|
||||
if not bom_id:
|
||||
total_strd = number * product.standard_price
|
||||
total = number * product_pool.price_get(cr, uid, [product.id], 'standard_price')[product.id]
|
||||
|
@ -153,9 +153,9 @@ class report_custom(report_rml):
|
|||
<col>%s %s %s %s : </col>
|
||||
<col/>
|
||||
<col/>
|
||||
<col/>
|
||||
<col>%s</col>
|
||||
<col>%s</col>
|
||||
<col f='yes'/>
|
||||
<col f='yes'>%s</col>
|
||||
<col f='yes'>%s</col>
|
||||
</row></lines>'"""%(_('Total Cost'), _('of'), str(number), product.uom_id.name, str(total_strd), str(total))
|
||||
else:
|
||||
bom = bom_pool.browse(cr, uid, bom_id, context=context)
|
||||
|
@ -164,9 +164,9 @@ class report_custom(report_rml):
|
|||
total = 0
|
||||
total_strd = 0
|
||||
parent_bom = {
|
||||
'product_qty': bom.product_qty,
|
||||
'name': bom.product_id.name,
|
||||
'product_uom': bom.product_uom.id,
|
||||
'product_qty': bom.product_qty,
|
||||
'name': bom.product_id.name,
|
||||
'product_uom': bom.product_uom.id,
|
||||
'product_id': bom.product_id.id
|
||||
}
|
||||
xml_tmp = ''
|
||||
|
@ -175,15 +175,15 @@ class report_custom(report_rml):
|
|||
xml_tmp += txt
|
||||
total += sum
|
||||
total_strd += sum_strd
|
||||
|
||||
|
||||
xml += "<lines style='lines'>" + xml_tmp + '</lines>'
|
||||
xml += """<lines style='sub_total'> <row>
|
||||
<col>%s %s %s %s : </col>
|
||||
<col/>
|
||||
<col/>
|
||||
<col/>
|
||||
<col>%s</col>
|
||||
<col>%s</col>
|
||||
<col t='yes'/>
|
||||
<col t='yes'>%s</col>
|
||||
<col t='yes'>%s</col>
|
||||
</row></lines>'"""%(_('Cost'), _('of'), str(number), product.uom_id.name, str(total_strd), str(total))
|
||||
|
||||
total2 = 0
|
||||
|
@ -201,18 +201,19 @@ class report_custom(report_rml):
|
|||
<col/>
|
||||
<col/>
|
||||
<col/>
|
||||
<col>%s</col>
|
||||
<col t='yes'>%s</col>
|
||||
</row></lines>'"""%(_('Work Cost'), _('of'), str(number), product.uom_id.name, str(total2))
|
||||
xml += """<lines style='total'> <row>
|
||||
<col>%s %s %s %s : </col>
|
||||
<col/>
|
||||
<col/>
|
||||
<col/>
|
||||
<col>%s</col>
|
||||
<col>%s</col>
|
||||
<col t='yes'/>
|
||||
<col t='yes'>%s</col>
|
||||
<col t='yes'>%s</col>
|
||||
</row></lines>'"""%(_('Total Cost'), _('of'), str(number), product.uom_id.name, str(total_strd+total2), str(total+total2))
|
||||
|
||||
xml = '<?xml version="1.0" ?><report>' + config_start + config_stop + xml + '</report>'
|
||||
|
||||
return xml
|
||||
|
||||
report_custom('report.product.price', 'product.product', '', 'addons/mrp/report/price.xsl')
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
<xsl:import href="custom_default.xsl"/>
|
||||
<xsl:import href="custom_rml.xsl"/>
|
||||
|
||||
|
||||
<xsl:template match="/">
|
||||
<xsl:call-template name="rml"/>
|
||||
</xsl:template>
|
||||
|
@ -12,35 +12,37 @@
|
|||
|
||||
<xsl:template name="stylesheet">
|
||||
<paraStyle name="title" fontName="Helvetica-Bold" fontSize="22" alignment="center"/>
|
||||
|
||||
<paraStyle name="terp_default_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="terp_tblheader_General" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT"/>
|
||||
<paraStyle name="terp_tblheader_Details_Right" fontName="Helvetica" fontSize="8.0" leading="10" alignment="RIGHT"/>
|
||||
<paraStyle name="terp_tblheader_Details_Right_bold" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="RIGHT"/>
|
||||
|
||||
<blockTableStyle id="header">
|
||||
<blockBackground colorName="grey" start="0,0" stop="-1,0"/>
|
||||
<blockValign value="TOP"/>
|
||||
<blockAlignment value="RIGHT"/>
|
||||
<lineStyle kind="GRID" colorName="black"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,0" stop="-1,-1"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="lines">
|
||||
<blockValign value="TOP"/>
|
||||
<blockAlignment value="RIGHT"/>
|
||||
<lineStyle kind="GRID" colorName="black"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,0" stop="-1,-1"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="total">
|
||||
<blockBackground colorName="grey" start="0,0" stop="-1,0"/>
|
||||
<blockValign value="TOP"/>
|
||||
<blockAlignment value="RIGHT"/>
|
||||
<lineStyle kind="GRID" colorName="black"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#FFFFFF" start="0,0" stop="-1,-1"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="sub_total">
|
||||
<blockBackground colorName="lightgrey" start="0,0" stop="-1,0"/>
|
||||
<blockValign value="TOP"/>
|
||||
<blockAlignment value="RIGHT"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#FFFFFF" start="0,0" stop="-1,-1"/>
|
||||
</blockTableStyle>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="story">
|
||||
<xsl:apply-templates select="report"/>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template match="report">
|
||||
<xsl:apply-templates select="config"/>
|
||||
<xsl:apply-templates select="title"/>
|
||||
|
@ -66,7 +68,7 @@
|
|||
<tr>
|
||||
<xsl:for-each select="field">
|
||||
<td>
|
||||
<para>
|
||||
<para style="terp_tblheader_General">
|
||||
<xsl:value-of select="."/>
|
||||
</para>
|
||||
</td>
|
||||
|
@ -75,22 +77,28 @@
|
|||
</xsl:template>
|
||||
|
||||
<xsl:template match="lines">
|
||||
|
||||
<xsl:apply-templates select="title"/>
|
||||
<blockTable>
|
||||
<xsl:attribute name="style"><xsl:value-of select="@style"/></xsl:attribute>
|
||||
<xsl:attribute name="colWidths">
|
||||
<xsl:value-of select="../config/tableSize"/>
|
||||
</xsl:attribute>
|
||||
|
||||
<xsl:apply-templates select="row"/>
|
||||
|
||||
</blockTable>
|
||||
|
||||
<xsl:if test="@style!='header'">
|
||||
<spacer length="2mm" width="2mm"/>
|
||||
|
||||
</xsl:if>
|
||||
<xsl:if test="@style='total'">
|
||||
<xsl:if test="position() < last()">
|
||||
<pageBreak/>
|
||||
</xsl:if>
|
||||
</xsl:if>
|
||||
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="row">
|
||||
|
@ -105,22 +113,32 @@
|
|||
<xsl:when test="@para='yes'">
|
||||
<xsl:choose>
|
||||
<xsl:when test="@tree='yes'">
|
||||
<para>
|
||||
<para style="terp_default_8">
|
||||
<xsl:attribute name="leftIndent"><xsl:value-of select="@space"/></xsl:attribute>
|
||||
<xsl:value-of select="."/>
|
||||
</para>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<para>
|
||||
<para style="terp_default_8">
|
||||
<xsl:value-of select="."/>
|
||||
</para>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xpre>
|
||||
<xsl:when test="@f='yes'">
|
||||
<para style="terp_tblheader_Details_Right">
|
||||
<xsl:value-of select="."/>
|
||||
</xpre>
|
||||
</para>
|
||||
</xsl:when>
|
||||
<xsl:when test="@t='yes'">
|
||||
<para style="terp_tblheader_Details_Right_bold">
|
||||
<xsl:value-of select="."/>
|
||||
</para>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<para style="terp_tblheader_General">
|
||||
<xsl:value-of select="."/>
|
||||
</para>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</td>
|
||||
|
|
Loading…
Reference in New Issue