openerp-community-reviewer team mailing list archive
-
openerp-community-reviewer team
-
Mailing list archive
-
Message #04354
[Merge] lp:~camptocamp/openerp-mrp-reports/7.0-add_serpentcs_mrp_repair_webkit-afe into lp:openerp-mrp-reports
Alexandre Fayolle - camptocamp has proposed merging lp:~camptocamp/openerp-mrp-reports/7.0-add_serpentcs_mrp_repair_webkit-afe into lp:openerp-mrp-reports.
Requested reviews:
OpenERP Community Reviewer/Maintainer (openerp-community-reviewer)
For more details, see:
https://code.launchpad.net/~camptocamp/openerp-mrp-reports/7.0-add_serpentcs_mrp_repair_webkit-afe/+merge/209044
Extraction of mrp_repair_report from lp:~serpentcs/openobject-addons/7.0-webkit-reports for inclusion in OCA
--
https://code.launchpad.net/~camptocamp/openerp-mrp-reports/7.0-add_serpentcs_mrp_repair_webkit-afe/+merge/209044
Your team OpenERP Community Reviewer/Maintainer is requested to review the proposed merge of lp:~camptocamp/openerp-mrp-reports/7.0-add_serpentcs_mrp_repair_webkit-afe into lp:openerp-mrp-reports.
=== added directory 'mrp_repair_webkit'
=== added file 'mrp_repair_webkit/__init__.py'
--- mrp_repair_webkit/__init__.py 1970-01-01 00:00:00 +0000
+++ mrp_repair_webkit/__init__.py 2014-03-03 11:20:32 +0000
@@ -0,0 +1,24 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# This module uses OpenERP, Open Source Management Solution Framework.
+# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd.(<http://www.serpentcs.com>)
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>
+#
+##############################################################################
+from . import report
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
=== added file 'mrp_repair_webkit/__openerp__.py'
--- mrp_repair_webkit/__openerp__.py 1970-01-01 00:00:00 +0000
+++ mrp_repair_webkit/__openerp__.py 2014-03-03 11:20:32 +0000
@@ -0,0 +1,42 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# This module uses OpenERP, Open Source Management Solution Framework.
+# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd.(<http://www.serpentcs.com>)
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>
+#
+##############################################################################
+
+
+{
+ 'name': 'Repairs Management',
+ 'version': '1.0',
+ 'category': 'Manufacturing',
+ 'description': """
+The aim is to have a complete module to manage all products repairs.
+====================================================================
+ It is conversion of rml report to Webkit Report.
+
+""",
+ 'author': 'Serpent Consulting Services Pvt. Ltd.',
+ 'website': 'http://www.serpentcs.com',
+ 'depends': ['mrp_repair', 'report_webkit'],
+ 'data': [
+ 'mrp_repair_report.xml',
+ ],
+ 'installable': True,
+ 'auto_install': False,
+}
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added file 'mrp_repair_webkit/mrp_repair_report.xml'
--- mrp_repair_webkit/mrp_repair_report.xml 1970-01-01 00:00:00 +0000
+++ mrp_repair_webkit/mrp_repair_report.xml 2014-03-03 11:20:32 +0000
@@ -0,0 +1,194 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+ <data>
+ <record id="mrp_header" model="ir.header_webkit">
+ <field name="footer_html"><![CDATA[
+ <html>
+ <head>
+ <meta content="text/html; charset=UTF-8" http-equiv="content-type"/>
+ <script>
+ function subst() {
+ var vars={};
+ var x=document.location.search.substring(1).split('&');
+ for(var i in x) {var z=x[i].split('=',2);vars[z[0]] = unescape(z[1]);}
+ var x=['frompage','topage','page','webpage','section','subsection','subsubsection'];
+ for(var i in x) {
+ var y = document.getElementsByClassName(x[i]);
+ for(var j=0; j<y.length; ++j) y[j].textContent = vars[x[i]];
+ }
+ }
+ </script>
+ <style type="text/css">
+
+ ${css}
+ </style>
+ </head>
+ <body style="border:0; margin: 0;" onload="subst()">
+ <table class="header" style="border-top: 1px solid black; width: 100%">
+ <tr >
+ <td style="text-align:center;font-size:12;" >${ company.rml_footer or '' }</td>
+ </tr>
+ <tr >
+ <td style="text-align:center;font-size:12;" >Contact : ${ user.name }</td>
+ </tr>
+ </table> ${_debug or ''|n} </body>
+ </html>
+ ]]></field>
+ <field name="orientation">Portrait</field>
+ <field name="format">A4</field>
+ <field name="html"><![CDATA[
+ <html>
+ <head>
+ <meta content="text/html; charset=UTF-8" http-equiv="content-type"/>
+ <script>
+ function subst() {
+ var vars={};
+ var x=document.location.search.substring(1).split('&');
+ for(var i in x) {var z=x[i].split('=',2);vars[z[0]] = unescape(z[1]);}
+ var x=['frompage','topage','page','webpage','section','subsection','subsubsection'];
+ for(var i in x) {
+ var y = document.getElementsByClassName(x[i]);
+ for(var j=0; j<y.length; ++j) y[j].textContent = vars[x[i]];
+ }
+ }
+ </script>
+ <style type="text/css">
+
+ ${css}
+ </style>
+ </head>
+ <body style="border:0; margin: 0;" onload="subst()">
+ <table class="header" style="border-bottom: 1px solid black; width: 100%">
+ <tr >
+ <td style="text-align:left;font-size:12;" width="20%">${ helper.embed_image('png',company.logo,200,50)|n }</td>
+ <td style="text-align:right;font-size:12;" width="80%"></br></br>${ company.rml_header1 }</td>
+ </tr>
+ </table> ${_debug or ''|n} </body>
+ <p style="text-align:left;font-size:12;">${company.name}</p></br></br>
+ <table width="100%">
+ <tr>
+ <td style="text-align:left;font-size:10;" width="25%">
+ Phone: ${company.phone or ''}
+ </td>
+ <td width="75%"></td>
+ </tr>
+
+ <tr>
+ <td style="text-align:left;font-size:10; border-bottom: 1px solid black;" width="25%">
+ Mail: ${company.email}
+ </td>
+ <td width="75%"></td>
+ </tr>
+ </table>
+ </html>]]>
+ </field>
+ <field eval="45.0" name="margin_top"/>
+ <field eval="25.0" name="margin_bottom"/>
+ <field name="css"><![CDATA[
+
+ body, table, td, span, div {
+ font-family: Helvetica;
+ }
+
+ body {
+ font-family;
+ font-size:9;
+
+ }
+
+
+ .header {
+ margin-left:0;
+ text-align:left;
+ width:300px;
+ font-size:12;
+ }
+ .title {
+ font-size:16px;
+ font-weight: bold;
+ font-family: Helvetica;
+ padding-bottom:20px;
+ padding-top:20px;
+ }
+
+
+ .basic_table{
+ width:100%;
+ text-align:center;
+ border:1px solid lightGrey;
+ border-collapse: collapse;
+ font-family: Helvetica;
+ padding-bottom:20px;
+ padding-top:20px;
+ }
+
+ .basic_table td {
+ border:1px solid lightGrey;
+ font-size:11px;
+ font-family: Helvetica;
+ padding:3px 3px 3px 3px;
+ }
+
+ .list_table {
+ border-bottom:1px solid black;
+ font-size:13px;
+ border-collapse: collapse;
+ font-family: Helvetica;
+ font-weight: bold;
+ width:100%;
+ padding-top:30px;
+ }
+ .add{
+ width:100%;
+ font-size:12px;
+ font-family: Helvetica; }
+ .tbl_header{
+ width:100%;
+ font-size:10px;
+ font-family: Helvetica;
+ border:1px solid lightGrey;
+ border-collapse: collapse;
+ }
+ .tr_bottom_line{
+ border-bottom: thin solid black;
+ width:100%;
+ font-size:12px;
+ font-family: Helvetica;
+ }
+ .tr_bottom_line_dark_grey{
+ border-bottom: thin solid #ccc;
+ width:100%;
+ font-size:12px;
+ font-family: Helvetica;
+ padding-left: 3px ;
+ }
+ .tr_top{
+ border-top: 1px solid black;
+ width:100%;
+ font-size:12px;
+ font-family: Helvetica;
+ }
+
+ .td_f12{
+ font-size:12px;
+ font-family: Helvetica;
+ }
+
+
+
+ ]]>
+ </field>
+ <field name="name">MRP Header</field>
+ </record>
+
+ <report
+ id="report_mrp_repair_webkit"
+ string="Quotation / Order"
+ model="mrp.repair"
+ name="repair.order.webkit"
+ file="mrp_repair_webkit/report/order.mako"
+ auto="False"
+ report_type="webkit"
+ webkit_header="mrp_header"/>
+ </data>
+</openerp>
=== added directory 'mrp_repair_webkit/report'
=== added file 'mrp_repair_webkit/report/__init__.py'
--- mrp_repair_webkit/report/__init__.py 1970-01-01 00:00:00 +0000
+++ mrp_repair_webkit/report/__init__.py 2014-03-03 11:20:32 +0000
@@ -0,0 +1,25 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# This module uses OpenERP, Open Source Management Solution Framework.
+# Copyright (C) 2013-Today Serpent Consulting Services Pvt. Ltd.(<http://www.serpentcs.com>)
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>
+#
+##############################################################################
+
+from . import order
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
=== added file 'mrp_repair_webkit/report/order.mako'
--- mrp_repair_webkit/report/order.mako 1970-01-01 00:00:00 +0000
+++ mrp_repair_webkit/report/order.mako 2014-03-03 11:20:32 +0000
@@ -0,0 +1,235 @@
+<html>
+ <head>
+ <style type="text/css">
+ ${css}
+ </style>
+ <title>qutation_order.pdf</title>
+ </head>
+ <body>
+ %for o in objects:
+ <table class="add">
+ <tr>
+ <td width="70%">
+ </br>
+ <b>Shipping address :</b></br>
+ ${ o.partner_id.name }</br>
+ ${ o.address_id.street or '' }</br>
+ ${ o.address_id.city or '' } ${ o.address_id.zip or '' }</br>
+ ${ o.address_id.country_id.name or '' }</br>
+ %if (o.address_id.phone):
+ Tel. : ${ o.address_id.phone or '' }</br>
+ %endif
+ %if o.address_id.fax:
+ Fax : ${ o.address_id.fax or '' }</br>
+ %endif
+ %if o.address_id.vat:
+ ${ o.address_id.vat or '' }</br>
+ %endif
+
+
+ </td>
+ <td width="30%" colspan="2">
+ ${ o.partner_id.name or '' }
+ ${ o.default_address_id.street or '' }</br>
+ ${ o.default_address_id.city or '' } ${ o.default_address_id.zip or '' }</br>
+ ${ o.default_address_id.country_id.name or '' }</br>
+ %if (o.default_address_id.phone):
+ Tel. : ${ o.default_address_id.phone or '' }</br>
+ %endif
+ %if o.default_address_id.fax:
+ Fax : ${ o.default_address_id.fax or '' }</br>
+ %endif
+ %if o.default_address_id.vat:
+ ${ o.default_address_id.vat or '' }
+ %endif
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <b>Invoice address :</b></br>
+ ${ o.partner_id and o.partner_id.property_payment_term.name or ''}</br>
+ ${ o.partner_invoice_id.name or ''}</br>
+ ${ o.partner_invoice_id.street or '' }</br>
+ ${ o.partner_invoice_id.city or '' } ${ o.partner_invoice_id.zip or '' }</br>
+ ${ o.partner_invoice_id.country_id.name or '' }</br>
+ %if (o.partner_invoice_id.phone):
+ Tel. : ${ o.partner_invoice_id.phone or '' }</br>
+ %endif
+ %if o.partner_invoice_id.fax:
+ Fax : ${ o.partner_invoice_id.fax or '' }</br>
+ %endif
+ %if o.partner_invoice_id.vat:
+ ${ o.partner_invoice_id.vat or '' }
+ %endif
+
+ </td>
+ </tr>
+ </table>
+ <p class="title">
+ %if o.state <> 'draft' or '':
+ Repair Quotation N° : ${ o.name }
+ %endif
+ %if o.state=='draft' or '' :
+ Repair Order N° : ${ o.name }
+ %endif
+ </p>
+ <table class="basic_table">
+ <tr>
+ <td class="25%">
+ <b>${_("Product to Repair")} </b>
+ </td>
+ <td class="25%">
+ <b>${_("Lot Number")}</b>
+ </td>
+ <td class="25%">
+ <b>${_("Guarantee Limit")}</b>
+ </td>
+ <td class="25%">
+ <b>${_("Printing Date")}</b>
+ </td>
+ </tr>
+ <tr>
+ <td class="25%">
+ ${ o.product_id.name or '' }
+ </td>
+ <td class="25%">
+ ${ o.prodlot_id.name or ' ' }
+ </td>
+ <td class="25%">
+ ${ formatLang(o.guarantee_limit,date = True) }
+ </td>
+ <td class="25%">
+ ${ formatLang(time.strftime('%Y-%m-%d'),date = True)}
+ </td>
+ </tr>
+ </table>
+ </br>
+ <table class="list_table">
+ <tr>
+ <td width="57%">
+ ${_("Description")}
+ </td>
+ <td width="10%">
+ ${_("Tax")}
+ </td>
+ <td width="10%" align="right">
+ ${_("Quantity")}
+ </td>
+ <td width="8%" align="right">
+ ${_("Unit Price")}
+ </td>
+ <td width="15%" align="right">
+ ${_("Price")}
+ </td>
+ </tr>
+ </table>
+ <h3><b>Operation Line(s)</b></h3>
+ %for line in o.operations:
+ %if line['to_invoice']==True:
+ <table class="tr_bottom_line_dark_grey">
+ <tr>
+ <td width="57%">
+ %if line.type == 'add' or '':
+ (Add)${ line.name }
+ %endif
+ %if line.type == 'remove' or '':
+ (Remove) ${ line.name }
+ %endif
+ </td>
+ <td width="10%">
+ ${ ','.join(map( lambda x: x.name, line.tax_id)) }
+ </td>
+ <td width="10%" align="right">
+ ${ formatLang(line.product_uom_qty) } ${ line.product_uom.name }
+ </td>
+ <td width="8%" align="right">
+ ${ formatLang(line.price_unit) }
+ </td>
+ <td width="15%" align="right">
+ ${ formatLang(line.price_subtotal, currency_obj = o.pricelist_id.currency_id) }
+ </td>
+ </tr>
+ </table>
+ %endif
+ %endfor
+ %if len(o.fees_lines) != 0 :
+
+ <h3><b>Fees Line(s)</b></h3>
+ %for fees in o.fees_lines:
+ %if fees.to_invoice==True:
+ <table class="tr_bottom_line_dark_grey">
+ <tr>
+ <td width="57%">
+ ${ fees.name }
+ </td>
+ <td width="10%">
+ ${ ','.join(map( lambda x: x.name, fees.tax_id)) }
+ </td>
+ <td width="10%" align="right">
+ ${ formatLang(fees.product_uom_qty) } ${ fees.product_uom.name }
+ </td>
+ <td width="8" align="right">
+ ${ formatLang(fees.price_unit) }
+ </td>
+ <td width="15%" align="right">
+ ${ formatLang(fees.price_subtotal, currency_obj = o.pricelist_id.currency_id) }
+ </td>
+ </tr>
+ </table>
+ %endif
+ %endfor
+ %endif
+ <table width="100%">
+ <tr>
+ <td width="70%">
+ </td>
+ <td width="30%">
+ <table class="tr_top">
+ <tr>
+ <td>
+ <b>Net Total :</b>
+ </td>
+ <td align="right">
+ ${ formatLang(o.amount_untaxed, dp='Sale Price', currency_obj=o.pricelist_id.currency_id) }
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <b>${_("Taxes:")}</b>
+ </td>
+ <td align="right">
+ ${ formatLang(o.amount_tax, dp='Account', currency_obj=o.pricelist_id.currency_id) }
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <tr>
+ <td width="70%">
+ </td>
+ <td width="30%">
+ <table class="tr_top">
+ <tr>
+ <td><b>
+ ${_("Total :")}</b>
+ </td>
+ <td align="right"> <b>
+ ${ formatLang(total(o), dp='Sale Price', currency_obj=o.pricelist_id.currency_id) }</b>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ <table width="100%">
+ <tr>
+ <td class="td_f12">
+ ${ o.quotation_notes or '' }
+ </td>
+ </tr>
+ </table>
+ <p style="page-break-after:always">
+ </p>
+ %endfor
+ </body>
+</html>
=== added file 'mrp_repair_webkit/report/order.py'
--- mrp_repair_webkit/report/order.py 1970-01-01 00:00:00 +0000
+++ mrp_repair_webkit/report/order.py 2014-03-03 11:20:32 +0000
@@ -0,0 +1,49 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# This module uses OpenERP, Open Source Management Solution Framework.
+# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd.(<http://www.serpentcs.com>)
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>
+#
+##############################################################################
+import time
+
+from openerp.report import report_sxw
+
+class order(report_sxw.rml_parse):
+ def __init__(self, cr, uid, name, context):
+ super(order, self).__init__(cr, uid, name, context=context)
+ self.localcontext.update({
+ 'time': time,
+ 'total': self.total,
+ })
+
+ def total(self, repair):
+ print "repair",repair
+ total = 0.0
+ for operation in repair.operations:
+ total += operation.price_subtotal
+ for fee in repair.fees_lines:
+ total += fee.price_subtotal
+ total = total + repair.amount_tax
+ return total
+
+report_sxw.report_sxw('report.repair.order.webkit',
+ 'mrp.repair',
+ 'addons/mrp_repair_webkit/report/order.mako',
+ parser=order)
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
Follow ups