openerp-community-reviewer team mailing list archive
-
openerp-community-reviewer team
-
Mailing list archive
-
Message #00402
[Merge] lp:~serpentcs/sale-reports/sale-serpentcs into lp:sale-reports
Nishant Jogi has proposed merging lp:~serpentcs/sale-reports/sale-serpentcs into lp:sale-reports.
Requested reviews:
Sale Core Editors (sale-core-editors)
For more details, see:
https://code.launchpad.net/~serpentcs/sale-reports/sale-serpentcs/+merge/190321
--
https://code.launchpad.net/~serpentcs/sale-reports/sale-serpentcs/+merge/190321
Your team OpenERP Community Reviewer is subscribed to branch lp:sale-reports.
=== added directory 'sale_delivery_exact_webkit'
=== added file 'sale_delivery_exact_webkit/__init__.py'
--- sale_delivery_exact_webkit/__init__.py 1970-01-01 00:00:00 +0000
+++ sale_delivery_exact_webkit/__init__.py 2013-10-10 09:50:25 +0000
@@ -0,0 +1,22 @@
+# -*- 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 report
=== added file 'sale_delivery_exact_webkit/__openerp__.py'
--- sale_delivery_exact_webkit/__openerp__.py 1970-01-01 00:00:00 +0000
+++ sale_delivery_exact_webkit/__openerp__.py 2013-10-10 09:50:25 +0000
@@ -0,0 +1,44 @@
+# -*- 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" : 'An Extension to Sales Management',
+ "version" : "1.0",
+ "depends" : ['sale_delivery_exact','report_webkit'],
+ 'category': 'Sales Management',
+ 'sequence': 15,
+ "author" : "Serpent Consulting Services",
+ "description": """
+ This module is an extension to Sales Management where we deliver only the available qty of product,
+ thus no backorder generation.
+
+ It is conversion of rml report to Webkit Report.
+
+ """,
+ "website" : "http://www.serpentcs.com",
+ "data" : [
+ 'sale_report.xml',
+ ],
+ 'installable': True,
+ 'auto_install': False,
+ 'application': True,
+}
=== added directory 'sale_delivery_exact_webkit/report'
=== added file 'sale_delivery_exact_webkit/report/__init__.py'
--- sale_delivery_exact_webkit/report/__init__.py 1970-01-01 00:00:00 +0000
+++ sale_delivery_exact_webkit/report/__init__.py 2013-10-10 09:50:25 +0000
@@ -0,0 +1,23 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero 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 Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+############################################################################
+import sale_order
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added file 'sale_delivery_exact_webkit/report/sale_order.mako'
--- sale_delivery_exact_webkit/report/sale_order.mako 1970-01-01 00:00:00 +0000
+++ sale_delivery_exact_webkit/report/sale_order.mako 2013-10-10 09:50:25 +0000
@@ -0,0 +1,211 @@
+<html>
+<head>
+ <style type="text/css">
+ ${css}
+ </style>
+</head>
+<body>
+ %for o in objects:
+ <% setLang(o.partner_id.lang) %>
+ <table class="shipping_address" width="100%">
+ <tr>
+ <td width="70%">
+ <b>${_("Shipping address :")}</b>
+ ${ (o.partner_shipping_id and o.partner_id.title and o.partner_shipping_id.title.name) or ''}</br>
+ ${ (o.partner_shipping_id and o.partner_shipping_id.name) or '' }</br>
+ ${o.partner_shipping_id.street or ''|entity}</br>
+ %if o.partner_shipping_id.street2 :
+ ${o.partner_shipping_id.street2 or ''|entity}</br>
+ %endif
+ ${o.partner_shipping_id.zip or ''|entity}, ${o.partner_shipping_id.city or ''|entity}</br>
+ %if o.partner_shipping_id.country_id :
+ ${o.partner_shipping_id.country_id.name or ''|entity}</br></br>
+ %endif
+ </td>
+ <td width="45%" style="text-align:left">
+ </br>
+ ${ (o.partner_shipping_id and o.partner_shipping_id.name) or '' }</br>
+ ${o.partner_invoice_id.street or ''|entity}</br>
+ %if o.partner_invoice_id.street2 :
+ ${o.partner_invoice_id.street2 or ''|entity}</br>
+ %endif
+ ${o.partner_invoice_id.zip or ''|entity}, ${o.partner_invoice_id.city or ''|entity}</br>
+ %if o.partner_invoice_id.country_id :
+ ${o.partner_invoice_id.country_id.name or ''|entity}</br>
+ %endif
+ </br>
+ ${_("Tel. :")} ${ (o.partner_id.phone) or '' }</br>
+ %if o.partner_id.fax :
+ ${_("Fax : ")} ${ o.partner_id.fax or ''|entity}</br>
+ %endif
+ %if o.partner_id.vat :
+ ${_("Vat : ")} ${ o.partner_id.vat or ''|entity}</br>
+ %endif
+ </br>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <b>${_("Invoice address :")}</b>
+ ${ (o.partner_shipping_id and o.partner_id.title and o.partner_shipping_id.title.name) or ''}</br>
+ ${ (o.partner_shipping_id and o.partner_shipping_id.name) or '' }</br>
+ ${o.partner_invoice_id.street or ''|entity}</br>
+ %if o.partner_invoice_id.street2 :
+ ${o.partner_invoice_id.street2 or ''|entity}</br>
+ %endif
+ ${o.partner_invoice_id.zip or ''|entity}, ${o.partner_invoice_id.city or ''|entity}</br>
+ %if o.partner_invoice_id.country_id :
+ ${o.partner_invoice_id.country_id.name or ''|entity}</br></br>
+ %endif
+ </td>
+ </tr>
+ </table>
+ </br>
+ %if o.state not in ['draft','sent'] or '':
+ <p class="title"><b> ${_("Quotation N°") } ${ o.name }</b></p>
+ %endif
+ %if o.state in ['draft','sent'] or '':
+ <p class="title"><b>${_("Order N°") } ${ o.name }</b></p>
+ %endif
+ </br>
+ <table class="basic_table" >
+ <tr>
+ <td width="25%"></br>
+ <b>${_("Your Reference")}</b>
+ </td>
+ <td width="25%"></br>
+ %if o.state in ['draft','sent'] :
+ <b>${ o.state in ['draft','sent'] or ''|entity } ${_("Date Ordered")}</b>
+ %endif
+ %if o.state not in ['draft','sent'] :
+ <b>${ o.state not in ['draft','sent'] or ''|entity } ${_("Quotation Date")}</b>
+ %endif
+ </td></br>
+ <td width="25%"></br>
+ <b>${_("Salesperson")}</b>
+ </td>
+ <td width="25%"></br>
+ <b>${_("Payment Term")}</b>
+ </td>
+ </tr>
+
+ <tr>
+ <td width="25%">
+ %if o.client_order_ref :
+ ${ o.client_order_ref or ''|entity}
+ %endif
+ </td>
+ <td width="25%">
+ ${ formatLang(o.date_order,date = True) }
+ </td>
+ <td width="25%">
+ ${ (o.user_id and o.user_id.name) or '' }
+ </td>
+ <td width="25%">
+ ${ (o.payment_term and o.payment_term.name) or '' }
+ </td>
+ </tr>
+ </table>
+ </br>
+ <table class="tr_bottom_line">
+ <tr>
+ <td width="40%">
+ <b>${_("Description")}</b>
+ </td>
+ <td width="10%">
+ <b>${_("Tax")}</b>
+ </td>
+ <td width="10%">
+ <b>${_("Order Quantity")}</b>
+ </td>
+ <td width="10%">
+ <b>${_("Shipped Quantity")}</b>
+ </td>
+ <td width="10%" align="right">
+ <b>${_("Unit Price")}</b>
+ </td>
+ <td width="15%" align="right">
+ <b>${_("Price")}</b>
+ </td>
+ </tr>
+ </table>
+
+
+ %for line in o.order_line:
+ <table class="tr_bottom_line_dark_grey">
+ <tr>
+ <td width="40%">
+ ${ format(line.name) }
+ </td>
+ <td width="10%">
+ ${ ', '.join(map(lambda x: x.name, line.tax_id)) }
+ </td>
+ <td width="10%">
+ ${ formatLang(line.product_uos and line.product_uos_qty or line.product_uom_qty) } ${ line.product_uos and line.product_uos.name or line.product_uom.name }
+ </td>
+ <td width="15%">
+ ${ formatLang(line.shipped_qty or 0.0) } ${ line.product_uos and line.product_uos.name or line.product_uom.name }
+ </td>
+ <td width="05%" >
+ ${ formatLang(line.price_unit , digits=get_digits(dp='Product Price')) }
+ </td>
+ <td width="15%" style="text-align:right">
+ ${ formatLang(line.price_subtotal, digits=get_digits(dp='Account'), currency_obj=o.pricelist_id.currency_id) }
+ </td>
+ </tr>
+ </table>
+ %endfor
+ <table width="100%">
+ <tr>
+ <td width="70%">
+ </td>
+ <td width="30%">
+ <table class="tr_top">
+ <tr>
+ <td >
+ ${_("Net Total :")}
+ </td>
+ <td width="40%" style="text-align:right">
+ ${ formatLang(o.amount_untaxed, dp='Account', currency_obj=o.pricelist_id.currency_id) }
+ </td>
+ </tr>
+ <tr>
+ <td >
+ ${_("Taxes :")}
+ </td>
+ <td width="40%" style="text-align:right">
+ ${ formatLang(o.amount_tax, dp='Account', currency_obj=o.pricelist_id.currency_id) }
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>
+ <table class="tr_top">
+ <tr>
+ <td>
+ <b>${_("Total :")}</b>
+ </td>
+ <td align="right">
+ <b>${ formatLang(o.amount_total, dp='Account', currency_obj=o.pricelist_id.currency_id) }</b>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ </br>
+ <p class="td_f12">${ (format(o.note or '') ) }
+ <table class="td_f12" width="100%">
+ <tr>
+ <td>
+ ${ format(o.payment_term and o.payment_term.note or (o.partner_id.property_payment_term and o.partner_id.property_payment_term.note or '')) }
+ </td>
+ </tr>
+ </table>
+ <p style="page-break-after:always"></p>
+ %endfor
+</body>
+</html>
=== added file 'sale_delivery_exact_webkit/report/sale_order.py'
--- sale_delivery_exact_webkit/report/sale_order.py 1970-01-01 00:00:00 +0000
+++ sale_delivery_exact_webkit/report/sale_order.py 2013-10-10 09:50:25 +0000
@@ -0,0 +1,44 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero 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 Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero 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=None):
+ super(order, self).__init__(cr, uid, name, context=context)
+ self.localcontext.update({
+ 'time': time,
+ 'show_discount':self._show_discount,
+ })
+
+ def _show_discount(self, uid, context=None):
+ cr = self.cr
+ try:
+ group_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'sale', 'group_discount_per_so_line')[1]
+ except:
+ return False
+ return group_id in [x.id for x in self.pool.get('res.users').browse(cr, uid, uid, context=context).groups_id]
+
+report_sxw.report_sxw('report.sale.delivery.exact.webkit', 'sale.order', 'addons/sale_delivery_exact_webkit/report/sale_order.mako', parser=order, header="external")
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
=== added file 'sale_delivery_exact_webkit/sale_report.xml'
--- sale_delivery_exact_webkit/sale_report.xml 1970-01-01 00:00:00 +0000
+++ sale_delivery_exact_webkit/sale_report.xml 2013-10-10 09:50:25 +0000
@@ -0,0 +1,197 @@
+<?xml version="1.0"?>
+<openerp>
+ <data>
+ <record id="sale_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, Arial;
+ }
+
+ body {
+ font-family:Arial;
+ font-size:9px;
+
+ }
+
+
+ .header {
+ margin-left:0;
+ text-align:left;
+ width:300px;
+ font-size:12;
+ }
+ .title {
+ font-size:16;
+ font-weight: bold;
+ font-family: Helvetica, Arial;
+ }
+
+
+ .basic_table{
+ width:100%;
+ text-align:center;
+ border:1px solid lightGrey;
+ border-collapse: collapse;
+ font-family: Helvetica;
+ padding-bottom:20px;
+ }
+
+ .basic_table td {
+ border:1px solid lightGrey;
+ font-size:11px;
+ font-family: Helvetica;
+ }
+
+ .list_table {
+ border-bottom:1px solid black;
+ font-size:11px;
+ padding-top:20px;
+ border-collapse: collapse;
+ font-family: Helvetica;
+ font-weight: bold;
+ width:100%;
+
+ }
+ .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-top: thin solid #ccc;
+ width:100%;
+ font-size:12px;
+ font-family: Helvetica;
+ }
+ .tr_top{
+ border-top: 1px solid black;
+ width:100%;
+ font-size:12px;
+ font-family: Helvetica;
+ text-align:left;
+ }
+
+ .td_f12{
+ font-size:12px;
+ font-family: Helvetica;
+
+ }
+ .shipping_address{
+ margin-top: 10px;
+ margin-bottom: 10px;
+ font-size:11px;
+ text-align:left;
+ }
+
+
+
+ ]]>
+ </field>
+ <field name="name">Sale Header</field>
+ </record>
+
+ <report auto="False"
+ id="sale.report_sale_order_webkit"
+ model="sale.order"
+ name="sale.delivery.exact.webkit"
+ file="sale_delivery_exact_webkit/report/sale_order.mako"
+ string="Quotation / Order"
+ usage="default"
+ report_type="webkit"
+ webkit_header="sale_header"/>
+
+ </data>
+</openerp>
=== added directory 'sale_webkit'
=== added file 'sale_webkit/__init__.py'
--- sale_webkit/__init__.py 1970-01-01 00:00:00 +0000
+++ sale_webkit/__init__.py 2013-10-10 09:50:25 +0000
@@ -0,0 +1,23 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero 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 Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+############################################################################
+import report
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added file 'sale_webkit/__openerp__.py'
--- sale_webkit/__openerp__.py 1970-01-01 00:00:00 +0000
+++ sale_webkit/__openerp__.py 2013-10-10 09:50:25 +0000
@@ -0,0 +1,43 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero 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 Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+############################################################################
+
+{
+ 'name': 'Sale Webkit',
+ 'author': 'Serpent Consulting Services',
+ 'website':'www.serpentcs.com',
+ 'version': '1.1',
+ 'depends': ['report_webkit','sale'],
+ 'category' : 'Sales Management',
+ 'description': """
+Manage sales quotations and orders
+================================
+ It is conversion of rml report to Webkit Report.
+
+ """,
+ 'data': [
+ 'sale_report.xml',
+ ],
+ 'installable': True,
+ 'application' : True,
+ 'auto_install': False,
+}
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added directory 'sale_webkit/report'
=== added file 'sale_webkit/report/__init__.py'
--- sale_webkit/report/__init__.py 1970-01-01 00:00:00 +0000
+++ sale_webkit/report/__init__.py 2013-10-10 09:50:25 +0000
@@ -0,0 +1,23 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero 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 Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+############################################################################
+import sale_order
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added file 'sale_webkit/report/sale_order.mako'
--- sale_webkit/report/sale_order.mako 1970-01-01 00:00:00 +0000
+++ sale_webkit/report/sale_order.mako 2013-10-10 09:50:25 +0000
@@ -0,0 +1,212 @@
+<html>
+<head>
+ <style type="text/css">
+ ${css}
+ </style>
+</head>
+<body>
+ %for o in objects:
+ <% setLang(o.partner_id.lang) %>
+
+ <table class="shipping_address" width="100%">
+ <tr>
+ <td width="70%">
+ <b>${_("Shipping address :")}</b>
+ ${ (o.partner_shipping_id and o.partner_id.title and o.partner_shipping_id.title.name) or ''}</br>
+ ${ (o.partner_shipping_id and o.partner_shipping_id.name) or '' }</br>
+ ${o.partner_shipping_id.street or ''|entity}</br>
+ %if o.partner_shipping_id.street2 :
+ ${o.partner_shipping_id.street2 or ''|entity}</br>
+ %endif
+ ${o.partner_shipping_id.zip or ''|entity}, ${o.partner_shipping_id.city or ''|entity}</br>
+ %if o.partner_shipping_id.country_id :
+ ${o.partner_shipping_id.country_id.name or ''|entity}</br>
+ %endif
+ </td>
+ <td width="45%" style="text-align:left">
+ </br>
+ ${ (o.partner_shipping_id and o.partner_shipping_id.name) or '' }</br>
+ ${o.partner_invoice_id.street or ''|entity}</br>
+ %if o.partner_invoice_id.street2 :
+ ${o.partner_invoice_id.street2 or ''|entity}</br>
+ %endif
+ ${o.partner_invoice_id.zip or ''|entity}, ${o.partner_invoice_id.city or ''|entity}</br>
+ %if o.partner_invoice_id.country_id :
+ ${o.partner_invoice_id.country_id.name or ''|entity}</br>
+ %endif
+ </br>
+ ${_("Tel. :")} ${ (o.partner_id.phone) or '' }</br>
+ %if o.partner_id.fax :
+ ${_("Fax : ")} ${ o.partner_id.fax or ''|entity}</br>
+ %endif
+ %if o.partner_id.vat :
+ ${_("Vat : ")} ${ o.partner_id.vat or ''|entity}</br>
+ %endif
+ </br>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <b>${_("Invoice address :")}</b>
+ ${ (o.partner_shipping_id and o.partner_id.title and o.partner_shipping_id.title.name) or ''}</br>
+ ${ (o.partner_shipping_id and o.partner_shipping_id.name) or '' }</br>
+ ${o.partner_invoice_id.street or ''|entity}</br>
+ %if o.partner_invoice_id.street2 :
+ ${o.partner_invoice_id.street2 or ''|entity}</br>
+ %endif
+ ${o.partner_invoice_id.zip or ''|entity}, ${o.partner_invoice_id.city or ''|entity}</br>
+ %if o.partner_invoice_id.country_id :
+ ${o.partner_invoice_id.country_id.name or ''|entity}</br>
+ %endif
+ </td>
+ </tr>
+ </table>
+
+ %if o.state not in ['draft','sent'] or '':
+ <p class="title"><b> ${_("Quotation N°") } ${ o.name }</b></p>
+ %endif
+ %if o.state in ['draft','sent'] or '':
+ <p class="title"><b>${_("Order N°") } ${ o.name }</b></p>
+ %endif
+
+ <table class="basic_table" >
+ <tr>
+ <td width="25%"></br>
+ <b>${_("Your Reference")}</b>
+ </td>
+ <td width="25%"></br>
+ %if o.state in ['draft','sent'] :
+ <b>${ o.state in ['draft','sent'] or ''|entity } ${_("Date Ordered")}</b>
+ %endif
+ %if o.state not in ['draft','sent'] :
+ <b>${ o.state not in ['draft','sent'] or ''|entity } ${_("Quotation Date")}</b>
+ %endif
+ </td></br>
+ <td width="25%"></br>
+ <b>${_("Salesperson")}</b>
+ </td>
+ <td width="25%"></br>
+ <b>${_("Payment Term")}</b>
+ </td>
+ </tr>
+
+ <tr>
+ <td width="25%">
+ %if o.client_order_ref :
+ ${ o.client_order_ref or ''|entity}
+ %endif
+ </td>
+ <td width="25%">
+ ${ formatLang(o.date_order,date = True) }
+ </td>
+ <td width="25%">
+ ${ (o.user_id and o.user_id.name) or '' }
+ </td>
+ <td width="25%">
+ ${ (o.payment_term and o.payment_term.name) or '' }
+ </td>
+ </tr>
+ </table>
+ </br>
+ <table class="tr_bottom_line">
+ <tr>
+ <td width="40%">
+ <b>${_("Description")}</b>
+ </td>
+ <td width="10%">
+ <b>${_("Tax")}</b>
+ </td>
+ <td width="10%">
+ <b>${_("Quantity")}</b>
+ </td>
+ <td width="10%" align="right">
+ <b>${_("Unit Price")}</b>
+ </td>
+ <td width="15%" align="right">
+ <b>${_("Disc.(%)")}</b>
+ </td>
+ <td width="15%" align="right">
+ <b>${_("Price")}</b>
+ </td>
+ </tr>
+ </table>
+
+
+ %for line in o.order_line:
+ <table class="tr_bottom_line_dark_grey">
+ <tr>
+ <td width="40%">
+ ${ format(line.name) }
+ </td>
+ <td width="10%">
+ ${ ', '.join(map(lambda x: x.name, line.tax_id)) }
+ </td>
+ <td width="12%">
+ ${ formatLang(line.product_uos and line.product_uos_qty or line.product_uom_qty) } ${ line.product_uos and line.product_uos.name or line.product_uom.name }
+ </td>
+ <td width="8%" >
+ ${ formatLang(line.price_unit , digits=get_digits(dp='Product Price')) }
+ </td>
+ <td width="15%">
+ ${ show_discount(user.id) and formatLang(line.discount, digits=get_digits(dp='Discount')) or ''|entity }
+ </td>
+ <td width="15%" style="text-align:right">
+ ${ formatLang(line.price_subtotal, digits=get_digits(dp='Account'), currency_obj=o.pricelist_id.currency_id) }
+ </td>
+ </tr>
+ </table>
+ %endfor
+ <table width="100%">
+ <tr>
+ <td width="70%">
+ </td>
+ <td width="30%">
+ <table class="tr_top">
+ <tr>
+ <td >
+ ${_("Net Total :")}
+ </td>
+ <td width="40%" style="text-align:right">
+ ${ formatLang(o.amount_untaxed, dp='Account', currency_obj=o.pricelist_id.currency_id) }
+ </td>
+ </tr>
+ <tr>
+ <td >
+ ${_("Taxes :")}
+ </td>
+ <td width="40%" style="text-align:right">
+ ${ formatLang(o.amount_tax, dp='Account', currency_obj=o.pricelist_id.currency_id) }
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>
+ <table class="tr_top">
+ <tr>
+ <td>
+ <b>${_("Total :")}</b>
+ </td>
+ <td align="right">
+ <b>${ formatLang(o.amount_total, dp='Account', currency_obj=o.pricelist_id.currency_id) }</b>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ </br>
+ <p class="td_f12">${ (format(o.note or '') ) }
+ <table class="td_f12" width="100%">
+ <tr>
+ <td>
+ ${ format(o.payment_term and o.payment_term.note or (o.partner_id.property_payment_term and o.partner_id.property_payment_term.note or '')) }
+ </td>
+ </tr>
+ </table>
+ <p style="page-break-after:always"></p>
+ %endfor
+</body>
+</html>
=== added file 'sale_webkit/report/sale_order.py'
--- sale_webkit/report/sale_order.py 1970-01-01 00:00:00 +0000
+++ sale_webkit/report/sale_order.py 2013-10-10 09:50:25 +0000
@@ -0,0 +1,44 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero 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 Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero 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=None):
+ super(order, self).__init__(cr, uid, name, context=context)
+ self.localcontext.update({
+ 'time': time,
+ 'show_discount':self._show_discount,
+ })
+
+ def _show_discount(self, uid, context=None):
+ cr = self.cr
+ try:
+ group_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'sale', 'group_discount_per_so_line')[1]
+ except:
+ return False
+ return group_id in [x.id for x in self.pool.get('res.users').browse(cr, uid, uid, context=context).groups_id]
+
+report_sxw.report_sxw('report.sale.order.webkit', 'sale.order', 'addons/sale_webkit/report/sale_order.mako', parser=order, header="external")
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
=== added file 'sale_webkit/sale_report.xml'
--- sale_webkit/sale_report.xml 1970-01-01 00:00:00 +0000
+++ sale_webkit/sale_report.xml 2013-10-10 09:50:25 +0000
@@ -0,0 +1,197 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+ <data>
+ <record id="sale_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></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, Arial;
+ }
+
+ body {
+ font-family:Arial;
+ font-size:9px;
+
+ }
+
+
+ .header {
+ margin-left:0;
+ text-align:left;
+ width:300px;
+ font-size:12;
+ }
+ .title {
+ font-size:16;
+ font-weight: bold;
+ font-family: Helvetica, Arial;
+ }
+
+
+ .basic_table{
+ width:100%;
+ text-align:center;
+ border:1px solid lightGrey;
+ border-collapse: collapse;
+ font-family: Helvetica;
+ padding-bottom:20px;
+ }
+
+ .basic_table td {
+ border:1px solid lightGrey;
+ font-size:11px;
+ font-family: Helvetica;
+ }
+
+ .list_table {
+ border-bottom:1px solid black;
+ font-size:11px;
+ padding-top:20px;
+ border-collapse: collapse;
+ font-family: Helvetica;
+ font-weight: bold;
+ width:100%;
+
+ }
+ .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-top: thin solid #ccc;
+ width:100%;
+ font-size:12px;
+ font-family: Helvetica;
+ }
+ .tr_top{
+ border-top: 1px solid black;
+ width:100%;
+ font-size:12px;
+ font-family: Helvetica;
+ text-align:left;
+ }
+
+ .td_f12{
+ font-size:12px;
+ font-family: Helvetica;
+
+ }
+ .shipping_address{
+ margin-top: 10px;
+ margin-bottom: 10px;
+ font-size:11px;
+ text-align:left;
+ }
+
+
+
+ ]]>
+ </field>
+ <field name="name">Sale Header</field>
+ </record>
+ <report
+ auto="False"
+ id="report_sale_order"
+ model="sale.order"
+ name="sale.order.webkit"
+ file="sale_webkit/report/sale_order.mako"
+ string="Quotation / Order"
+ usage="default"
+ report_type="webkit"
+ webkit_header="sale_header"/>
+
+ </data>
+</openerp>
Follow ups