← Back to team overview

openobject-italia-core-devs team mailing list archive

[Merge] lp:~agilebg/openobject-italia/adding_l10n_it_DDT_webkit_7 into lp:openobject-italia/7.0

 

Lorenzo Battistini - Agile BG has proposed merging lp:~agilebg/openobject-italia/adding_l10n_it_DDT_webkit_7 into lp:openobject-italia/7.0.

Requested reviews:
  OpenERP Italia core devs (openobject-italia-core-devs)

For more details, see:
https://code.launchpad.net/~agilebg/openobject-italia/adding_l10n_it_DDT_webkit_7/+merge/194900
-- 
https://code.launchpad.net/~agilebg/openobject-italia/adding_l10n_it_DDT_webkit_7/+merge/194900
Your team OpenERP Italia core devs is requested to review the proposed merge of lp:~agilebg/openobject-italia/adding_l10n_it_DDT_webkit_7 into lp:openobject-italia/7.0.
=== added directory 'l10n_it_DDT_webkit'
=== added file 'l10n_it_DDT_webkit/__init__.py'
--- l10n_it_DDT_webkit/__init__.py	1970-01-01 00:00:00 +0000
+++ l10n_it_DDT_webkit/__init__.py	2013-11-12 16:53:55 +0000
@@ -0,0 +1,25 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Copyright (C) 2013
+#    Associazione OpenERP Italia (<http://www.openerp-italia.org>)
+#
+#    Copyright (c) 2013 Agile Business Group (http://www.agilebg.com)
+#    @author Lorenzo Battistini
+#
+#    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 'l10n_it_DDT_webkit/__openerp__.py'
--- l10n_it_DDT_webkit/__openerp__.py	1970-01-01 00:00:00 +0000
+++ l10n_it_DDT_webkit/__openerp__.py	2013-11-12 16:53:55 +0000
@@ -0,0 +1,38 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Copyright (C) 2013
+#    Associazione OpenERP Italia (<http://www.openerp-italia.org>)
+#
+#    Copyright (c) 2013 Agile Business Group (http://www.agilebg.com)
+#    @author Lorenzo Battistini
+#
+#    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': 'DDT report using Webkit Library',
+    'version': '1.0',
+    'category': 'Reports/Webkit',
+    'description': """
+This module adds the webkit DDT report
+    """,
+    'author': 'Agile Business Group',
+    'website': 'http://www.agilebg.com',
+    'depends': ['report_webkit', 'l10n_it_sale', 'base_headers_webkit'],
+    'data': ['report.xml'],
+    'installable': True,
+    'active': False,
+}

=== added directory 'l10n_it_DDT_webkit/report'
=== added file 'l10n_it_DDT_webkit/report.xml'
--- l10n_it_DDT_webkit/report.xml	1970-01-01 00:00:00 +0000
+++ l10n_it_DDT_webkit/report.xml	2013-11-12 16:53:55 +0000
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+  <data>
+
+    <report id="ddt_webkit"
+            name="ddt_webkit"
+            auto="False"
+            model="stock.picking.out"
+            file="l10n_it_DDT_webkit/report/ddt.mako"
+            string="DDT"
+            report_type="webkit"
+            header="False"
+            webkit_header="base_headers_webkit.base_reports_portrait_header" />
+
+  </data>
+</openerp>

=== added file 'l10n_it_DDT_webkit/report/__init__.py'
--- l10n_it_DDT_webkit/report/__init__.py	1970-01-01 00:00:00 +0000
+++ l10n_it_DDT_webkit/report/__init__.py	2013-11-12 16:53:55 +0000
@@ -0,0 +1,24 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Copyright (C) 2013
+#    Associazione OpenERP Italia (<http://www.openerp-italia.org>)
+#
+#    Copyright (c) 2013 Agile Business Group (http://www.agilebg.com)
+#    @author Lorenzo Battistini
+#
+#    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 stock_report

=== added file 'l10n_it_DDT_webkit/report/ddt.mako'
--- l10n_it_DDT_webkit/report/ddt.mako	1970-01-01 00:00:00 +0000
+++ l10n_it_DDT_webkit/report/ddt.mako	2013-11-12 16:53:55 +0000
@@ -0,0 +1,119 @@
+<html>
+<head>
+    <style type="text/css">
+        ${css}
+    </style>
+</head>
+
+<body>
+    <%page expression_filter="entity"/>
+    <%
+    def carriage_returns(text):
+        return text.replace('\n', '<br />')
+    %>
+    %for picking in objects:
+        <% setLang(picking.partner_id.lang) %>
+        <div class="address">
+            <table class="recipient">
+                %if picking.partner_id.parent_id:
+                <tr><td class="name">${picking.partner_id.parent_id.name or ''}</td></tr>
+                <tr><td>${picking.partner_id.title and picking.partner_id.title.name or ''} ${picking.partner_id.name }</td></tr>
+                <% address_lines = picking.partner_id.contact_address.split("\n")[1:] %>
+                %else:
+                <tr><td class="name">${picking.partner_id.title and picking.partner_id.title.name or ''} ${picking.partner_id.name }</td></tr>
+                <% address_lines = picking.partner_id.contact_address.split("\n") %>
+                %endif
+                %for part in address_lines:
+                    %if part:
+                    <tr><td>${part}</td></tr>
+                    %endif
+                %endfor
+            </table>
+            <%
+            invoice_addr = invoice_address(picking)
+            %>
+            <table class="invoice">
+                <tr><td class="address_title">${_("Invoice address:")}</td></tr>
+                <tr><td>${invoice_addr.title and invoice_addr.title.name or ''} ${invoice_addr.name }</td></tr>
+                %if invoice_addr.contact_address:
+                    <% address_lines = invoice_addr.contact_address.split("\n") %>
+                    %for part in address_lines:
+                        %if part:
+                        <tr><td>${part}</td></tr>
+                        %endif
+                    %endfor
+                %endif
+            </table>
+        </div>
+        
+        <h1 style="clear:both;">DDT n.:  ${picking.ddt_number or ''}</h1>
+        
+        <table class="basic_table" width="100%">
+            <tr>
+                <td style="font-weight:bold;">${_('Contact')}</td>
+                <td style="font-weight:bold;">${_('Origin')}</td>
+                <td style="font-weight:bold;">${_('DDT date')}</td>
+                <td style="font-weight:bold;">${_('Weight')}</td>
+                <td style="font-weight:bold;">${_('Delivery Method')}</td>
+            </tr>
+            <tr>
+                <td>${user.name}</td>
+                <td>${picking.origin or ''}</td>
+                <td>${formatLang(picking.ddt_date, date=True)}</td>
+                <td>${picking.weight}</td>
+                <td>${picking.carrier_id and picking.carrier_id.name or ''}</td>
+            </tr>
+        </table>
+         <br />
+         <br />
+        <table class="basic_table" width="100%">
+            <tr>
+                <td style="font-weight:bold;">${_('Description of goods')}</td>
+                <td style="font-weight:bold;">${_("Reason For Transportation")}</td>
+                <td style="font-weight:bold;">${_("Carriage condition")}</td>
+                <td style="font-weight:bold;">${_('Scheduled Date')}</td>
+            </tr>
+            <tr>
+                <td>${picking.goods_description_id and picking.goods_description_id.name or '' }</td>
+                <td>${picking.transportation_reason_id and picking.transportation_reason_id.name or ''}</td>
+                <td>${picking.carriage_condition_id and picking.carriage_condition_id.name or ''}</td>
+                <td>${formatLang(picking.min_date, date=True)}</td>
+            </tr>
+        </table>
+        <table class="list_sale_table" width="100%" style="margin-top: 20px;">
+            <thead>
+                <tr>
+                    <th style="text-align:left; ">${_("Description")}</th>
+                    <th style="text-align:left; ">${_("Serial Number")}</th>
+                    <th class="amount">${_("Quantity")}</th>
+                </tr>
+            </thead>
+            <tbody>
+            %for line in picking.move_lines:
+                <tr class="line" >
+                    <td style="text-align:left; " >${ line.name }</td>
+                    <td style="text-align:left; " >${ line.prodlot_id and line.prodlot_id.name or ''}</td>
+                    <td class="amount" >${ formatLang(line.product_qty) } ${line.product_uom.name}</td>
+                </tr>
+            %endfor
+        </table>
+        
+        <br/>
+        %if picking.note :
+            <p class="std_text">${picking.note | carriage_returns}</p>
+        %endif
+    <br/><br/><br/><br/>
+     <table class="basic_table" width="100%">
+            <tr>
+                <td style="font-weight:bold;">Data Ritiro</td>
+                <td style="font-weight:bold;">Firma</td>
+            </tr>
+            <tr>
+                <td><br /></td>
+                <td><br /><br /></td>
+            </tr>
+        </table>
+         <p style="page-break-after: always"/>
+    %endfor
+</body>
+</html>

=== added file 'l10n_it_DDT_webkit/report/stock_report.py'
--- l10n_it_DDT_webkit/report/stock_report.py	1970-01-01 00:00:00 +0000
+++ l10n_it_DDT_webkit/report/stock_report.py	2013-11-12 16:53:55 +0000
@@ -0,0 +1,52 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Copyright (C) 2013
+#    Associazione OpenERP Italia (<http://www.openerp-italia.org>)
+#
+#    Copyright (c) 2013 Agile Business Group (http://www.agilebg.com)
+#    @author Lorenzo Battistini
+#
+#    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 operator
+from report import report_sxw
+import pooler
+import time
+
+
+class DeliverySlip(report_sxw.rml_parse):
+
+    def _get_invoice_address(self, picking):
+        if picking.sale_id:
+            return picking.sale_id.partner_invoice_id
+        partner_obj = self.pool.get('res.partner')
+        invoice_address_id = picking.partner_id.address_get(
+            adr_pref=['invoice']
+        )['invoice']
+        return partner_obj.browse(
+            self.cr, self.uid, invoice_address_id)
+
+    def __init__(self, cr, uid, name, context):
+        super(DeliverySlip, self).__init__(cr, uid, name, context=context)
+        self.localcontext.update({
+            'time': time,
+            'invoice_address': self._get_invoice_address,
+            })
+
+report_sxw.report_sxw('report.ddt_webkit',
+                      'stock.picking',
+                      'addons/l10n_it_DDT_webkit/report/ddt.mako',
+                      parser=DeliverySlip)


Follow ups