Merge lp:~serpentcs/sale-reports/sale-serpentcs into lp:~sale-core-editors/sale-reports/7.0

Proposed by Nishant Jogi (Serpent Consulting Services)
Status: Work in progress
Proposed branch: lp:~serpentcs/sale-reports/sale-serpentcs
Merge into: lp:~sale-core-editors/sale-reports/7.0
Diff against target: 1146 lines (+1083/-0)
12 files modified
sale_delivery_exact_webkit/__init__.py (+22/-0)
sale_delivery_exact_webkit/__openerp__.py (+44/-0)
sale_delivery_exact_webkit/report/__init__.py (+23/-0)
sale_delivery_exact_webkit/report/sale_order.mako (+211/-0)
sale_delivery_exact_webkit/report/sale_order.py (+44/-0)
sale_delivery_exact_webkit/sale_report.xml (+197/-0)
sale_webkit/__init__.py (+23/-0)
sale_webkit/__openerp__.py (+43/-0)
sale_webkit/report/__init__.py (+23/-0)
sale_webkit/report/sale_order.mako (+212/-0)
sale_webkit/report/sale_order.py (+44/-0)
sale_webkit/sale_report.xml (+197/-0)
To merge this branch: bzr merge lp:~serpentcs/sale-reports/sale-serpentcs
Reviewer Review Type Date Requested Status
Yannick Vaucher @ Camptocamp moved on github Needs Resubmitting
Maxime Chambreuil (http://www.savoirfairelinux.com) code review Needs Fixing
Review via email: mp+190321@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Maxime Chambreuil (http://www.savoirfairelinux.com) (max3903) wrote :

Hello Nishant,

Can you use local import (from . import ...) in your __init__.py files ?

I am not familiar with webkit report. Don't they need a translation file ?

Thanks.

review: Needs Fixing (code review)
Revision history for this message
Yannick Vaucher @ Camptocamp (yvaucher-c2c) wrote :

This project is now hosted on https://github.com/OCA/sale-reports. Please move your proposal there. This guide may help you https://github.com/OCA/maintainers-tools/wiki/How-to-move-a-Merge-Proposal-to-GitHub

review: Needs Resubmitting (moved on github)

Unmerged revisions

22. By Nishant Jogi (Serpent Consulting Services)

[ADD] Added Sale Reports with rml to webkit conversion.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'sale_delivery_exact_webkit'
2=== added file 'sale_delivery_exact_webkit/__init__.py'
3--- sale_delivery_exact_webkit/__init__.py 1970-01-01 00:00:00 +0000
4+++ sale_delivery_exact_webkit/__init__.py 2013-10-10 09:50:25 +0000
5@@ -0,0 +1,22 @@
6+# -*- coding: utf-8 -*-
7+##############################################################################
8+#
9+# This module uses OpenERP, Open Source Management Solution Framework.
10+# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd.(<http://www.serpentcs.com>)
11+#
12+# This program is free software: you can redistribute it and/or modify
13+# it under the terms of the GNU General Public License as published by
14+# the Free Software Foundation, either version 3 of the License, or
15+# (at your option) any later version.
16+#
17+# This program is distributed in the hope that it will be useful,
18+# but WITHOUT ANY WARRANTY; without even the implied warranty of
19+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20+# GNU General Public License for more details.
21+#
22+# You should have received a copy of the GNU General Public License
23+# along with this program. If not, see <http://www.gnu.org/licenses/>
24+#
25+##############################################################################
26+
27+import report
28
29=== added file 'sale_delivery_exact_webkit/__openerp__.py'
30--- sale_delivery_exact_webkit/__openerp__.py 1970-01-01 00:00:00 +0000
31+++ sale_delivery_exact_webkit/__openerp__.py 2013-10-10 09:50:25 +0000
32@@ -0,0 +1,44 @@
33+# -*- coding: utf-8 -*-
34+##############################################################################
35+#
36+# This module uses OpenERP, Open Source Management Solution Framework.
37+# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd.(<http://www.serpentcs.com>)
38+#
39+# This program is free software: you can redistribute it and/or modify
40+# it under the terms of the GNU General Public License as published by
41+# the Free Software Foundation, either version 3 of the License, or
42+# (at your option) any later version.
43+#
44+# This program is distributed in the hope that it will be useful,
45+# but WITHOUT ANY WARRANTY; without even the implied warranty of
46+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
47+# GNU General Public License for more details.
48+#
49+# You should have received a copy of the GNU General Public License
50+# along with this program. If not, see <http://www.gnu.org/licenses/>
51+#
52+##############################################################################
53+
54+
55+{
56+ "name" : 'An Extension to Sales Management',
57+ "version" : "1.0",
58+ "depends" : ['sale_delivery_exact','report_webkit'],
59+ 'category': 'Sales Management',
60+ 'sequence': 15,
61+ "author" : "Serpent Consulting Services",
62+ "description": """
63+ This module is an extension to Sales Management where we deliver only the available qty of product,
64+ thus no backorder generation.
65+
66+ It is conversion of rml report to Webkit Report.
67+
68+ """,
69+ "website" : "http://www.serpentcs.com",
70+ "data" : [
71+ 'sale_report.xml',
72+ ],
73+ 'installable': True,
74+ 'auto_install': False,
75+ 'application': True,
76+}
77
78=== added directory 'sale_delivery_exact_webkit/report'
79=== added file 'sale_delivery_exact_webkit/report/__init__.py'
80--- sale_delivery_exact_webkit/report/__init__.py 1970-01-01 00:00:00 +0000
81+++ sale_delivery_exact_webkit/report/__init__.py 2013-10-10 09:50:25 +0000
82@@ -0,0 +1,23 @@
83+# -*- coding: utf-8 -*-
84+##############################################################################
85+#
86+# OpenERP, Open Source Management Solution
87+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
88+#
89+# This program is free software: you can redistribute it and/or modify
90+# it under the terms of the GNU Affero General Public License as
91+# published by the Free Software Foundation, either version 3 of the
92+# License, or (at your option) any later version.
93+#
94+# This program is distributed in the hope that it will be useful,
95+# but WITHOUT ANY WARRANTY; without even the implied warranty of
96+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
97+# GNU Affero General Public License for more details.
98+#
99+# You should have received a copy of the GNU Affero General Public License
100+# along with this program. If not, see <http://www.gnu.org/licenses/>.
101+#
102+############################################################################
103+import sale_order
104+
105+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
106
107=== added file 'sale_delivery_exact_webkit/report/sale_order.mako'
108--- sale_delivery_exact_webkit/report/sale_order.mako 1970-01-01 00:00:00 +0000
109+++ sale_delivery_exact_webkit/report/sale_order.mako 2013-10-10 09:50:25 +0000
110@@ -0,0 +1,211 @@
111+<html>
112+<head>
113+ <style type="text/css">
114+ ${css}
115+ </style>
116+</head>
117+<body>
118+ %for o in objects:
119+ <% setLang(o.partner_id.lang) %>
120+ <table class="shipping_address" width="100%">
121+ <tr>
122+ <td width="70%">
123+ <b>${_("Shipping address :")}</b>
124+ ${ (o.partner_shipping_id and o.partner_id.title and o.partner_shipping_id.title.name) or ''}</br>
125+ ${ (o.partner_shipping_id and o.partner_shipping_id.name) or '' }</br>
126+ ${o.partner_shipping_id.street or ''|entity}</br>
127+ %if o.partner_shipping_id.street2 :
128+ ${o.partner_shipping_id.street2 or ''|entity}</br>
129+ %endif
130+ ${o.partner_shipping_id.zip or ''|entity}, ${o.partner_shipping_id.city or ''|entity}</br>
131+ %if o.partner_shipping_id.country_id :
132+ ${o.partner_shipping_id.country_id.name or ''|entity}</br></br>
133+ %endif
134+ </td>
135+ <td width="45%" style="text-align:left">
136+ </br>
137+ ${ (o.partner_shipping_id and o.partner_shipping_id.name) or '' }</br>
138+ ${o.partner_invoice_id.street or ''|entity}</br>
139+ %if o.partner_invoice_id.street2 :
140+ ${o.partner_invoice_id.street2 or ''|entity}</br>
141+ %endif
142+ ${o.partner_invoice_id.zip or ''|entity}, ${o.partner_invoice_id.city or ''|entity}</br>
143+ %if o.partner_invoice_id.country_id :
144+ ${o.partner_invoice_id.country_id.name or ''|entity}</br>
145+ %endif
146+ </br>
147+ ${_("Tel. :")} ${ (o.partner_id.phone) or '' }</br>
148+ %if o.partner_id.fax :
149+ ${_("Fax : ")} ${ o.partner_id.fax or ''|entity}</br>
150+ %endif
151+ %if o.partner_id.vat :
152+ ${_("Vat : ")} ${ o.partner_id.vat or ''|entity}</br>
153+ %endif
154+ </br>
155+ </td>
156+ </tr>
157+ <tr>
158+ <td>
159+ <b>${_("Invoice address :")}</b>
160+ ${ (o.partner_shipping_id and o.partner_id.title and o.partner_shipping_id.title.name) or ''}</br>
161+ ${ (o.partner_shipping_id and o.partner_shipping_id.name) or '' }</br>
162+ ${o.partner_invoice_id.street or ''|entity}</br>
163+ %if o.partner_invoice_id.street2 :
164+ ${o.partner_invoice_id.street2 or ''|entity}</br>
165+ %endif
166+ ${o.partner_invoice_id.zip or ''|entity}, ${o.partner_invoice_id.city or ''|entity}</br>
167+ %if o.partner_invoice_id.country_id :
168+ ${o.partner_invoice_id.country_id.name or ''|entity}</br></br>
169+ %endif
170+ </td>
171+ </tr>
172+ </table>
173+ </br>
174+ %if o.state not in ['draft','sent'] or '':
175+ <p class="title"><b> ${_("Quotation N°") } ${ o.name }</b></p>
176+ %endif
177+ %if o.state in ['draft','sent'] or '':
178+ <p class="title"><b>${_("Order N°") } ${ o.name }</b></p>
179+ %endif
180+ </br>
181+ <table class="basic_table" >
182+ <tr>
183+ <td width="25%"></br>
184+ <b>${_("Your Reference")}</b>
185+ </td>
186+ <td width="25%"></br>
187+ %if o.state in ['draft','sent'] :
188+ <b>${ o.state in ['draft','sent'] or ''|entity } ${_("Date Ordered")}</b>
189+ %endif
190+ %if o.state not in ['draft','sent'] :
191+ <b>${ o.state not in ['draft','sent'] or ''|entity } ${_("Quotation Date")}</b>
192+ %endif
193+ </td></br>
194+ <td width="25%"></br>
195+ <b>${_("Salesperson")}</b>
196+ </td>
197+ <td width="25%"></br>
198+ <b>${_("Payment Term")}</b>
199+ </td>
200+ </tr>
201+
202+ <tr>
203+ <td width="25%">
204+ %if o.client_order_ref :
205+ ${ o.client_order_ref or ''|entity}
206+ %endif
207+ </td>
208+ <td width="25%">
209+ ${ formatLang(o.date_order,date = True) }
210+ </td>
211+ <td width="25%">
212+ ${ (o.user_id and o.user_id.name) or '' }
213+ </td>
214+ <td width="25%">
215+ ${ (o.payment_term and o.payment_term.name) or '' }
216+ </td>
217+ </tr>
218+ </table>
219+ </br>
220+ <table class="tr_bottom_line">
221+ <tr>
222+ <td width="40%">
223+ <b>${_("Description")}</b>
224+ </td>
225+ <td width="10%">
226+ <b>${_("Tax")}</b>
227+ </td>
228+ <td width="10%">
229+ <b>${_("Order Quantity")}</b>
230+ </td>
231+ <td width="10%">
232+ <b>${_("Shipped Quantity")}</b>
233+ </td>
234+ <td width="10%" align="right">
235+ <b>${_("Unit Price")}</b>
236+ </td>
237+ <td width="15%" align="right">
238+ <b>${_("Price")}</b>
239+ </td>
240+ </tr>
241+ </table>
242+
243+
244+ %for line in o.order_line:
245+ <table class="tr_bottom_line_dark_grey">
246+ <tr>
247+ <td width="40%">
248+ ${ format(line.name) }
249+ </td>
250+ <td width="10%">
251+ ${ ', '.join(map(lambda x: x.name, line.tax_id)) }
252+ </td>
253+ <td width="10%">
254+ ${ 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 }
255+ </td>
256+ <td width="15%">
257+ ${ formatLang(line.shipped_qty or 0.0) } ${ line.product_uos and line.product_uos.name or line.product_uom.name }
258+ </td>
259+ <td width="05%" >
260+ ${ formatLang(line.price_unit , digits=get_digits(dp='Product Price')) }
261+ </td>
262+ <td width="15%" style="text-align:right">
263+ ${ formatLang(line.price_subtotal, digits=get_digits(dp='Account'), currency_obj=o.pricelist_id.currency_id) }
264+ </td>
265+ </tr>
266+ </table>
267+ %endfor
268+ <table width="100%">
269+ <tr>
270+ <td width="70%">
271+ </td>
272+ <td width="30%">
273+ <table class="tr_top">
274+ <tr>
275+ <td >
276+ ${_("Net Total :")}
277+ </td>
278+ <td width="40%" style="text-align:right">
279+ ${ formatLang(o.amount_untaxed, dp='Account', currency_obj=o.pricelist_id.currency_id) }
280+ </td>
281+ </tr>
282+ <tr>
283+ <td >
284+ ${_("Taxes :")}
285+ </td>
286+ <td width="40%" style="text-align:right">
287+ ${ formatLang(o.amount_tax, dp='Account', currency_obj=o.pricelist_id.currency_id) }
288+ </td>
289+ </tr>
290+ </table>
291+ </td>
292+ </tr>
293+ <tr>
294+ <td></td>
295+ <td>
296+ <table class="tr_top">
297+ <tr>
298+ <td>
299+ <b>${_("Total :")}</b>
300+ </td>
301+ <td align="right">
302+ <b>${ formatLang(o.amount_total, dp='Account', currency_obj=o.pricelist_id.currency_id) }</b>
303+ </td>
304+ </tr>
305+ </table>
306+ </td>
307+ </tr>
308+ </table>
309+ </br>
310+ <p class="td_f12">${ (format(o.note or '') ) }
311+ <table class="td_f12" width="100%">
312+ <tr>
313+ <td>
314+ ${ 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 '')) }
315+ </td>
316+ </tr>
317+ </table>
318+ <p style="page-break-after:always"></p>
319+ %endfor
320+</body>
321+</html>
322
323=== added file 'sale_delivery_exact_webkit/report/sale_order.py'
324--- sale_delivery_exact_webkit/report/sale_order.py 1970-01-01 00:00:00 +0000
325+++ sale_delivery_exact_webkit/report/sale_order.py 2013-10-10 09:50:25 +0000
326@@ -0,0 +1,44 @@
327+# -*- coding: utf-8 -*-
328+##############################################################################
329+#
330+# OpenERP, Open Source Management Solution
331+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
332+#
333+# This program is free software: you can redistribute it and/or modify
334+# it under the terms of the GNU Affero General Public License as
335+# published by the Free Software Foundation, either version 3 of the
336+# License, or (at your option) any later version.
337+#
338+# This program is distributed in the hope that it will be useful,
339+# but WITHOUT ANY WARRANTY; without even the implied warranty of
340+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
341+# GNU Affero General Public License for more details.
342+#
343+# You should have received a copy of the GNU Affero General Public License
344+# along with this program. If not, see <http://www.gnu.org/licenses/>.
345+#
346+############################################################################
347+import time
348+
349+from openerp.report import report_sxw
350+
351+class order(report_sxw.rml_parse):
352+ def __init__(self, cr, uid, name, context=None):
353+ super(order, self).__init__(cr, uid, name, context=context)
354+ self.localcontext.update({
355+ 'time': time,
356+ 'show_discount':self._show_discount,
357+ })
358+
359+ def _show_discount(self, uid, context=None):
360+ cr = self.cr
361+ try:
362+ group_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'sale', 'group_discount_per_so_line')[1]
363+ except:
364+ return False
365+ return group_id in [x.id for x in self.pool.get('res.users').browse(cr, uid, uid, context=context).groups_id]
366+
367+report_sxw.report_sxw('report.sale.delivery.exact.webkit', 'sale.order', 'addons/sale_delivery_exact_webkit/report/sale_order.mako', parser=order, header="external")
368+
369+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
370+
371
372=== added file 'sale_delivery_exact_webkit/sale_report.xml'
373--- sale_delivery_exact_webkit/sale_report.xml 1970-01-01 00:00:00 +0000
374+++ sale_delivery_exact_webkit/sale_report.xml 2013-10-10 09:50:25 +0000
375@@ -0,0 +1,197 @@
376+<?xml version="1.0"?>
377+<openerp>
378+ <data>
379+ <record id="sale_header" model="ir.header_webkit">
380+ <field name="footer_html"><![CDATA[
381+ <html>
382+ <head>
383+ <meta content="text/html; charset=UTF-8" http-equiv="content-type"/>
384+ <script>
385+ function subst() {
386+ var vars={};
387+ var x=document.location.search.substring(1).split('&');
388+ for(var i in x) {var z=x[i].split('=',2);vars[z[0]] = unescape(z[1]);}
389+ var x=['frompage','topage','page','webpage','section','subsection','subsubsection'];
390+ for(var i in x) {
391+ var y = document.getElementsByClassName(x[i]);
392+ for(var j=0; j<y.length; ++j) y[j].textContent = vars[x[i]];
393+ }
394+ }
395+ </script>
396+ <style type="text/css">
397+
398+ ${css}
399+ </style>
400+ </head>
401+ <body style="border:0; margin: 0;" onload="subst()">
402+ <table class="header" style="border-top: 1px solid black; width: 100%">
403+ <tr >
404+ <td style="text-align:center;font-size:12;" >${ company.rml_footer or '' }</td>
405+ </tr>
406+ <tr >
407+ <td style="text-align:center;font-size:12;" >Contact : ${ user.name }</td>
408+ </tr>
409+ </table> ${_debug or ''|n} </body>
410+ </html>
411+ ]]></field>
412+ <field name="orientation">Portrait</field>
413+ <field name="format">A4</field>
414+ <field name="html"><![CDATA[
415+ <html>
416+ <head>
417+ <meta content="text/html; charset=UTF-8" http-equiv="content-type"/>
418+ <script>
419+ function subst() {
420+ var vars={};
421+ var x=document.location.search.substring(1).split('&');
422+ for(var i in x) {var z=x[i].split('=',2);vars[z[0]] = unescape(z[1]);}
423+ var x=['frompage','topage','page','webpage','section','subsection','subsubsection'];
424+ for(var i in x) {
425+ var y = document.getElementsByClassName(x[i]);
426+ for(var j=0; j<y.length; ++j) y[j].textContent = vars[x[i]];
427+ }
428+ }
429+ </script>
430+ <style type="text/css">
431+
432+ ${css}
433+ </style>
434+ </head>
435+ <body style="border:0; margin: 0;" onload="subst()">
436+ <table class="header" style="border-bottom: 1px solid black; width: 100%">
437+ <tr >
438+ <td style="text-align:left;font-size:12;" width="20%">${ helper.embed_image('png',company.logo,200,50)|n }</td>
439+ <td style="text-align:right;font-size:12;" width="80%"></br></br>${ company.rml_header1 }</td>
440+ </tr>
441+ </table> ${_debug or ''|n} </body>
442+ <p style="text-align:left;font-size:12;">${company.name}</p></br></br>
443+ <table width="100%">
444+ <tr>
445+ <td style="text-align:left;font-size:10;" width="25%">
446+ Phone: ${company.phone or ''}
447+ </td>
448+ <td width="75%"></td>
449+ </tr>
450+
451+ <tr>
452+ <td style="text-align:left;font-size:10; border-bottom: 1px solid black;" width="25%">
453+ Mail: ${company.email}
454+ </td>
455+ <td width="75%"></td>
456+ </tr>
457+ </table>
458+ </html>]]>
459+ </field>
460+ <field eval="45.0" name="margin_top"/>
461+ <field eval="25.0" name="margin_bottom"/>
462+ <field name="css"><![CDATA[
463+
464+ body, table, td, span, div {
465+ font-family: Helvetica, Arial;
466+ }
467+
468+ body {
469+ font-family:Arial;
470+ font-size:9px;
471+
472+ }
473+
474+
475+ .header {
476+ margin-left:0;
477+ text-align:left;
478+ width:300px;
479+ font-size:12;
480+ }
481+ .title {
482+ font-size:16;
483+ font-weight: bold;
484+ font-family: Helvetica, Arial;
485+ }
486+
487+
488+ .basic_table{
489+ width:100%;
490+ text-align:center;
491+ border:1px solid lightGrey;
492+ border-collapse: collapse;
493+ font-family: Helvetica;
494+ padding-bottom:20px;
495+ }
496+
497+ .basic_table td {
498+ border:1px solid lightGrey;
499+ font-size:11px;
500+ font-family: Helvetica;
501+ }
502+
503+ .list_table {
504+ border-bottom:1px solid black;
505+ font-size:11px;
506+ padding-top:20px;
507+ border-collapse: collapse;
508+ font-family: Helvetica;
509+ font-weight: bold;
510+ width:100%;
511+
512+ }
513+ .tbl_header{
514+ width:100%;
515+ font-size:10px;
516+
517+ font-family: Helvetica;
518+ border:1px solid lightGrey;
519+ border-collapse: collapse;
520+ }
521+ .tr_bottom_line{
522+ border-bottom: thin solid black;
523+ width:100%;
524+ font-size:12px;
525+
526+ font-family: Helvetica;
527+ }
528+ .tr_bottom_line_dark_grey{
529+ border-top: thin solid #ccc;
530+ width:100%;
531+ font-size:12px;
532+ font-family: Helvetica;
533+ }
534+ .tr_top{
535+ border-top: 1px solid black;
536+ width:100%;
537+ font-size:12px;
538+ font-family: Helvetica;
539+ text-align:left;
540+ }
541+
542+ .td_f12{
543+ font-size:12px;
544+ font-family: Helvetica;
545+
546+ }
547+ .shipping_address{
548+ margin-top: 10px;
549+ margin-bottom: 10px;
550+ font-size:11px;
551+ text-align:left;
552+ }
553+
554+
555+
556+ ]]>
557+ </field>
558+ <field name="name">Sale Header</field>
559+ </record>
560+
561+ <report auto="False"
562+ id="sale.report_sale_order_webkit"
563+ model="sale.order"
564+ name="sale.delivery.exact.webkit"
565+ file="sale_delivery_exact_webkit/report/sale_order.mako"
566+ string="Quotation / Order"
567+ usage="default"
568+ report_type="webkit"
569+ webkit_header="sale_header"/>
570+
571+ </data>
572+</openerp>
573
574=== added directory 'sale_webkit'
575=== added file 'sale_webkit/__init__.py'
576--- sale_webkit/__init__.py 1970-01-01 00:00:00 +0000
577+++ sale_webkit/__init__.py 2013-10-10 09:50:25 +0000
578@@ -0,0 +1,23 @@
579+# -*- coding: utf-8 -*-
580+##############################################################################
581+#
582+# OpenERP, Open Source Management Solution
583+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
584+#
585+# This program is free software: you can redistribute it and/or modify
586+# it under the terms of the GNU Affero General Public License as
587+# published by the Free Software Foundation, either version 3 of the
588+# License, or (at your option) any later version.
589+#
590+# This program is distributed in the hope that it will be useful,
591+# but WITHOUT ANY WARRANTY; without even the implied warranty of
592+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
593+# GNU Affero General Public License for more details.
594+#
595+# You should have received a copy of the GNU Affero General Public License
596+# along with this program. If not, see <http://www.gnu.org/licenses/>.
597+#
598+############################################################################
599+import report
600+
601+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
602
603=== added file 'sale_webkit/__openerp__.py'
604--- sale_webkit/__openerp__.py 1970-01-01 00:00:00 +0000
605+++ sale_webkit/__openerp__.py 2013-10-10 09:50:25 +0000
606@@ -0,0 +1,43 @@
607+# -*- coding: utf-8 -*-
608+##############################################################################
609+#
610+# OpenERP, Open Source Management Solution
611+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
612+#
613+# This program is free software: you can redistribute it and/or modify
614+# it under the terms of the GNU Affero General Public License as
615+# published by the Free Software Foundation, either version 3 of the
616+# License, or (at your option) any later version.
617+#
618+# This program is distributed in the hope that it will be useful,
619+# but WITHOUT ANY WARRANTY; without even the implied warranty of
620+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
621+# GNU Affero General Public License for more details.
622+#
623+# You should have received a copy of the GNU Affero General Public License
624+# along with this program. If not, see <http://www.gnu.org/licenses/>.
625+#
626+############################################################################
627+
628+{
629+ 'name': 'Sale Webkit',
630+ 'author': 'Serpent Consulting Services',
631+ 'website':'www.serpentcs.com',
632+ 'version': '1.1',
633+ 'depends': ['report_webkit','sale'],
634+ 'category' : 'Sales Management',
635+ 'description': """
636+Manage sales quotations and orders
637+================================
638+ It is conversion of rml report to Webkit Report.
639+
640+ """,
641+ 'data': [
642+ 'sale_report.xml',
643+ ],
644+ 'installable': True,
645+ 'application' : True,
646+ 'auto_install': False,
647+}
648+
649+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
650
651=== added directory 'sale_webkit/report'
652=== added file 'sale_webkit/report/__init__.py'
653--- sale_webkit/report/__init__.py 1970-01-01 00:00:00 +0000
654+++ sale_webkit/report/__init__.py 2013-10-10 09:50:25 +0000
655@@ -0,0 +1,23 @@
656+# -*- coding: utf-8 -*-
657+##############################################################################
658+#
659+# OpenERP, Open Source Management Solution
660+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
661+#
662+# This program is free software: you can redistribute it and/or modify
663+# it under the terms of the GNU Affero General Public License as
664+# published by the Free Software Foundation, either version 3 of the
665+# License, or (at your option) any later version.
666+#
667+# This program is distributed in the hope that it will be useful,
668+# but WITHOUT ANY WARRANTY; without even the implied warranty of
669+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
670+# GNU Affero General Public License for more details.
671+#
672+# You should have received a copy of the GNU Affero General Public License
673+# along with this program. If not, see <http://www.gnu.org/licenses/>.
674+#
675+############################################################################
676+import sale_order
677+
678+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
679
680=== added file 'sale_webkit/report/sale_order.mako'
681--- sale_webkit/report/sale_order.mako 1970-01-01 00:00:00 +0000
682+++ sale_webkit/report/sale_order.mako 2013-10-10 09:50:25 +0000
683@@ -0,0 +1,212 @@
684+<html>
685+<head>
686+ <style type="text/css">
687+ ${css}
688+ </style>
689+</head>
690+<body>
691+ %for o in objects:
692+ <% setLang(o.partner_id.lang) %>
693+
694+ <table class="shipping_address" width="100%">
695+ <tr>
696+ <td width="70%">
697+ <b>${_("Shipping address :")}</b>
698+ ${ (o.partner_shipping_id and o.partner_id.title and o.partner_shipping_id.title.name) or ''}</br>
699+ ${ (o.partner_shipping_id and o.partner_shipping_id.name) or '' }</br>
700+ ${o.partner_shipping_id.street or ''|entity}</br>
701+ %if o.partner_shipping_id.street2 :
702+ ${o.partner_shipping_id.street2 or ''|entity}</br>
703+ %endif
704+ ${o.partner_shipping_id.zip or ''|entity}, ${o.partner_shipping_id.city or ''|entity}</br>
705+ %if o.partner_shipping_id.country_id :
706+ ${o.partner_shipping_id.country_id.name or ''|entity}</br>
707+ %endif
708+ </td>
709+ <td width="45%" style="text-align:left">
710+ </br>
711+ ${ (o.partner_shipping_id and o.partner_shipping_id.name) or '' }</br>
712+ ${o.partner_invoice_id.street or ''|entity}</br>
713+ %if o.partner_invoice_id.street2 :
714+ ${o.partner_invoice_id.street2 or ''|entity}</br>
715+ %endif
716+ ${o.partner_invoice_id.zip or ''|entity}, ${o.partner_invoice_id.city or ''|entity}</br>
717+ %if o.partner_invoice_id.country_id :
718+ ${o.partner_invoice_id.country_id.name or ''|entity}</br>
719+ %endif
720+ </br>
721+ ${_("Tel. :")} ${ (o.partner_id.phone) or '' }</br>
722+ %if o.partner_id.fax :
723+ ${_("Fax : ")} ${ o.partner_id.fax or ''|entity}</br>
724+ %endif
725+ %if o.partner_id.vat :
726+ ${_("Vat : ")} ${ o.partner_id.vat or ''|entity}</br>
727+ %endif
728+ </br>
729+ </td>
730+ </tr>
731+ <tr>
732+ <td>
733+ <b>${_("Invoice address :")}</b>
734+ ${ (o.partner_shipping_id and o.partner_id.title and o.partner_shipping_id.title.name) or ''}</br>
735+ ${ (o.partner_shipping_id and o.partner_shipping_id.name) or '' }</br>
736+ ${o.partner_invoice_id.street or ''|entity}</br>
737+ %if o.partner_invoice_id.street2 :
738+ ${o.partner_invoice_id.street2 or ''|entity}</br>
739+ %endif
740+ ${o.partner_invoice_id.zip or ''|entity}, ${o.partner_invoice_id.city or ''|entity}</br>
741+ %if o.partner_invoice_id.country_id :
742+ ${o.partner_invoice_id.country_id.name or ''|entity}</br>
743+ %endif
744+ </td>
745+ </tr>
746+ </table>
747+
748+ %if o.state not in ['draft','sent'] or '':
749+ <p class="title"><b> ${_("Quotation N°") } ${ o.name }</b></p>
750+ %endif
751+ %if o.state in ['draft','sent'] or '':
752+ <p class="title"><b>${_("Order N°") } ${ o.name }</b></p>
753+ %endif
754+
755+ <table class="basic_table" >
756+ <tr>
757+ <td width="25%"></br>
758+ <b>${_("Your Reference")}</b>
759+ </td>
760+ <td width="25%"></br>
761+ %if o.state in ['draft','sent'] :
762+ <b>${ o.state in ['draft','sent'] or ''|entity } ${_("Date Ordered")}</b>
763+ %endif
764+ %if o.state not in ['draft','sent'] :
765+ <b>${ o.state not in ['draft','sent'] or ''|entity } ${_("Quotation Date")}</b>
766+ %endif
767+ </td></br>
768+ <td width="25%"></br>
769+ <b>${_("Salesperson")}</b>
770+ </td>
771+ <td width="25%"></br>
772+ <b>${_("Payment Term")}</b>
773+ </td>
774+ </tr>
775+
776+ <tr>
777+ <td width="25%">
778+ %if o.client_order_ref :
779+ ${ o.client_order_ref or ''|entity}
780+ %endif
781+ </td>
782+ <td width="25%">
783+ ${ formatLang(o.date_order,date = True) }
784+ </td>
785+ <td width="25%">
786+ ${ (o.user_id and o.user_id.name) or '' }
787+ </td>
788+ <td width="25%">
789+ ${ (o.payment_term and o.payment_term.name) or '' }
790+ </td>
791+ </tr>
792+ </table>
793+ </br>
794+ <table class="tr_bottom_line">
795+ <tr>
796+ <td width="40%">
797+ <b>${_("Description")}</b>
798+ </td>
799+ <td width="10%">
800+ <b>${_("Tax")}</b>
801+ </td>
802+ <td width="10%">
803+ <b>${_("Quantity")}</b>
804+ </td>
805+ <td width="10%" align="right">
806+ <b>${_("Unit Price")}</b>
807+ </td>
808+ <td width="15%" align="right">
809+ <b>${_("Disc.(%)")}</b>
810+ </td>
811+ <td width="15%" align="right">
812+ <b>${_("Price")}</b>
813+ </td>
814+ </tr>
815+ </table>
816+
817+
818+ %for line in o.order_line:
819+ <table class="tr_bottom_line_dark_grey">
820+ <tr>
821+ <td width="40%">
822+ ${ format(line.name) }
823+ </td>
824+ <td width="10%">
825+ ${ ', '.join(map(lambda x: x.name, line.tax_id)) }
826+ </td>
827+ <td width="12%">
828+ ${ 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 }
829+ </td>
830+ <td width="8%" >
831+ ${ formatLang(line.price_unit , digits=get_digits(dp='Product Price')) }
832+ </td>
833+ <td width="15%">
834+ ${ show_discount(user.id) and formatLang(line.discount, digits=get_digits(dp='Discount')) or ''|entity }
835+ </td>
836+ <td width="15%" style="text-align:right">
837+ ${ formatLang(line.price_subtotal, digits=get_digits(dp='Account'), currency_obj=o.pricelist_id.currency_id) }
838+ </td>
839+ </tr>
840+ </table>
841+ %endfor
842+ <table width="100%">
843+ <tr>
844+ <td width="70%">
845+ </td>
846+ <td width="30%">
847+ <table class="tr_top">
848+ <tr>
849+ <td >
850+ ${_("Net Total :")}
851+ </td>
852+ <td width="40%" style="text-align:right">
853+ ${ formatLang(o.amount_untaxed, dp='Account', currency_obj=o.pricelist_id.currency_id) }
854+ </td>
855+ </tr>
856+ <tr>
857+ <td >
858+ ${_("Taxes :")}
859+ </td>
860+ <td width="40%" style="text-align:right">
861+ ${ formatLang(o.amount_tax, dp='Account', currency_obj=o.pricelist_id.currency_id) }
862+ </td>
863+ </tr>
864+ </table>
865+ </td>
866+ </tr>
867+ <tr>
868+ <td></td>
869+ <td>
870+ <table class="tr_top">
871+ <tr>
872+ <td>
873+ <b>${_("Total :")}</b>
874+ </td>
875+ <td align="right">
876+ <b>${ formatLang(o.amount_total, dp='Account', currency_obj=o.pricelist_id.currency_id) }</b>
877+ </td>
878+ </tr>
879+ </table>
880+ </td>
881+ </tr>
882+ </table>
883+ </br>
884+ <p class="td_f12">${ (format(o.note or '') ) }
885+ <table class="td_f12" width="100%">
886+ <tr>
887+ <td>
888+ ${ 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 '')) }
889+ </td>
890+ </tr>
891+ </table>
892+ <p style="page-break-after:always"></p>
893+ %endfor
894+</body>
895+</html>
896
897=== added file 'sale_webkit/report/sale_order.py'
898--- sale_webkit/report/sale_order.py 1970-01-01 00:00:00 +0000
899+++ sale_webkit/report/sale_order.py 2013-10-10 09:50:25 +0000
900@@ -0,0 +1,44 @@
901+# -*- coding: utf-8 -*-
902+##############################################################################
903+#
904+# OpenERP, Open Source Management Solution
905+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
906+#
907+# This program is free software: you can redistribute it and/or modify
908+# it under the terms of the GNU Affero General Public License as
909+# published by the Free Software Foundation, either version 3 of the
910+# License, or (at your option) any later version.
911+#
912+# This program is distributed in the hope that it will be useful,
913+# but WITHOUT ANY WARRANTY; without even the implied warranty of
914+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
915+# GNU Affero General Public License for more details.
916+#
917+# You should have received a copy of the GNU Affero General Public License
918+# along with this program. If not, see <http://www.gnu.org/licenses/>.
919+#
920+############################################################################
921+import time
922+
923+from openerp.report import report_sxw
924+
925+class order(report_sxw.rml_parse):
926+ def __init__(self, cr, uid, name, context=None):
927+ super(order, self).__init__(cr, uid, name, context=context)
928+ self.localcontext.update({
929+ 'time': time,
930+ 'show_discount':self._show_discount,
931+ })
932+
933+ def _show_discount(self, uid, context=None):
934+ cr = self.cr
935+ try:
936+ group_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'sale', 'group_discount_per_so_line')[1]
937+ except:
938+ return False
939+ return group_id in [x.id for x in self.pool.get('res.users').browse(cr, uid, uid, context=context).groups_id]
940+
941+report_sxw.report_sxw('report.sale.order.webkit', 'sale.order', 'addons/sale_webkit/report/sale_order.mako', parser=order, header="external")
942+
943+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
944+
945
946=== added file 'sale_webkit/sale_report.xml'
947--- sale_webkit/sale_report.xml 1970-01-01 00:00:00 +0000
948+++ sale_webkit/sale_report.xml 2013-10-10 09:50:25 +0000
949@@ -0,0 +1,197 @@
950+<?xml version="1.0" encoding="utf-8"?>
951+<openerp>
952+ <data>
953+ <record id="sale_header" model="ir.header_webkit">
954+ <field name="footer_html"><![CDATA[
955+ <html>
956+ <head>
957+ <meta content="text/html; charset=UTF-8" http-equiv="content-type"/>
958+ <script>
959+ function subst() {
960+ var vars={};
961+ var x=document.location.search.substring(1).split('&');
962+ for(var i in x) {var z=x[i].split('=',2);vars[z[0]] = unescape(z[1]);}
963+ var x=['frompage','topage','page','webpage','section','subsection','subsubsection'];
964+ for(var i in x) {
965+ var y = document.getElementsByClassName(x[i]);
966+ for(var j=0; j<y.length; ++j) y[j].textContent = vars[x[i]];
967+ }
968+ }
969+ </script>
970+ <style type="text/css">
971+
972+ ${css}
973+ </style>
974+ </head>
975+ <body style="border:0; margin: 0;" onload="subst()">
976+ <table class="header" style="border-top: 1px solid black; width: 100%">
977+ <tr >
978+ <td style="text-align:center;font-size:12;" >${ company.rml_footer or ''}</td>
979+ </tr>
980+ <tr >
981+ <td style="text-align:center;font-size:12;" >Contact : ${ user.name }</td>
982+ </tr>
983+ </table> ${_debug or ''|n} </body>
984+ </html>
985+ ]]></field>
986+ <field name="orientation">Portrait</field>
987+ <field name="format">A4</field>
988+ <field name="html"><![CDATA[
989+ <html>
990+ <head>
991+ <meta content="text/html; charset=UTF-8" http-equiv="content-type"/>
992+ <script>
993+ function subst() {
994+ var vars={};
995+ var x=document.location.search.substring(1).split('&');
996+ for(var i in x) {var z=x[i].split('=',2);vars[z[0]] = unescape(z[1]);}
997+ var x=['frompage','topage','page','webpage','section','subsection','subsubsection'];
998+ for(var i in x) {
999+ var y = document.getElementsByClassName(x[i]);
1000+ for(var j=0; j<y.length; ++j) y[j].textContent = vars[x[i]];
1001+ }
1002+ }
1003+ </script>
1004+ <style type="text/css">
1005+
1006+ ${css}
1007+ </style>
1008+ </head>
1009+ <body style="border:0; margin: 0;" onload="subst()">
1010+ <table class="header" style="border-bottom: 1px solid black; width: 100%">
1011+ <tr >
1012+ <td style="text-align:left;font-size:12;" width="20%">${ helper.embed_image('png',company.logo,200,50)|n }</td>
1013+ <td style="text-align:right;font-size:12;" width="80%"></br></br>${ company.rml_header1 }</td>
1014+ </tr>
1015+ </table> ${_debug or ''|n} </body>
1016+ <p style="text-align:left;font-size:12;">${company.name}</p></br></br></br>
1017+ <table width="100%">
1018+ <tr>
1019+ <td style="text-align:left;font-size:10;" width="25%">
1020+ Phone: ${company.phone or ''}
1021+ </td>
1022+ <td width="75%"></td>
1023+ </tr>
1024+
1025+ <tr>
1026+ <td style="text-align:left;font-size:10; border-bottom: 1px solid black;" width="25%">
1027+ Mail: ${company.email}
1028+ </td>
1029+ <td width="75%"></td>
1030+ </tr>
1031+ </table>
1032+ </html>]]>
1033+ </field>
1034+ <field eval="45.0" name="margin_top"/>
1035+ <field eval="25.0" name="margin_bottom"/>
1036+ <field name="css"><![CDATA[
1037+
1038+ body, table, td, span, div {
1039+ font-family: Helvetica, Arial;
1040+ }
1041+
1042+ body {
1043+ font-family:Arial;
1044+ font-size:9px;
1045+
1046+ }
1047+
1048+
1049+ .header {
1050+ margin-left:0;
1051+ text-align:left;
1052+ width:300px;
1053+ font-size:12;
1054+ }
1055+ .title {
1056+ font-size:16;
1057+ font-weight: bold;
1058+ font-family: Helvetica, Arial;
1059+ }
1060+
1061+
1062+ .basic_table{
1063+ width:100%;
1064+ text-align:center;
1065+ border:1px solid lightGrey;
1066+ border-collapse: collapse;
1067+ font-family: Helvetica;
1068+ padding-bottom:20px;
1069+ }
1070+
1071+ .basic_table td {
1072+ border:1px solid lightGrey;
1073+ font-size:11px;
1074+ font-family: Helvetica;
1075+ }
1076+
1077+ .list_table {
1078+ border-bottom:1px solid black;
1079+ font-size:11px;
1080+ padding-top:20px;
1081+ border-collapse: collapse;
1082+ font-family: Helvetica;
1083+ font-weight: bold;
1084+ width:100%;
1085+
1086+ }
1087+ .tbl_header{
1088+ width:100%;
1089+ font-size:10px;
1090+
1091+ font-family: Helvetica;
1092+ border:1px solid lightGrey;
1093+ border-collapse: collapse;
1094+ }
1095+ .tr_bottom_line{
1096+ border-bottom: thin solid black;
1097+ width:100%;
1098+ font-size:12px;
1099+
1100+ font-family: Helvetica;
1101+ }
1102+ .tr_bottom_line_dark_grey{
1103+ border-top: thin solid #ccc;
1104+ width:100%;
1105+ font-size:12px;
1106+ font-family: Helvetica;
1107+ }
1108+ .tr_top{
1109+ border-top: 1px solid black;
1110+ width:100%;
1111+ font-size:12px;
1112+ font-family: Helvetica;
1113+ text-align:left;
1114+ }
1115+
1116+ .td_f12{
1117+ font-size:12px;
1118+ font-family: Helvetica;
1119+
1120+ }
1121+ .shipping_address{
1122+ margin-top: 10px;
1123+ margin-bottom: 10px;
1124+ font-size:11px;
1125+ text-align:left;
1126+ }
1127+
1128+
1129+
1130+ ]]>
1131+ </field>
1132+ <field name="name">Sale Header</field>
1133+ </record>
1134+ <report
1135+ auto="False"
1136+ id="report_sale_order"
1137+ model="sale.order"
1138+ name="sale.order.webkit"
1139+ file="sale_webkit/report/sale_order.mako"
1140+ string="Quotation / Order"
1141+ usage="default"
1142+ report_type="webkit"
1143+ webkit_header="sale_header"/>
1144+
1145+ </data>
1146+</openerp>

Subscribers

People subscribed via source and target branches