Merge lp:~camptocamp/sale-reports/sale-reports-add-so-webkit into lp:~sale-core-editors/sale-reports/7.0

Proposed by Nicolas Bessi - Camptocamp
Status: Merged
Merged at revision: 10
Proposed branch: lp:~camptocamp/sale-reports/sale-reports-add-so-webkit
Merge into: lp:~sale-core-editors/sale-reports/7.0
Diff against target: 818 lines (+765/-0)
10 files modified
sale_order_webkit/__init__.py (+22/-0)
sale_order_webkit/__openerp__.py (+46/-0)
sale_order_webkit/i18n/fr.po (+98/-0)
sale_order_webkit/i18n/sale_order_webkit.pot (+98/-0)
sale_order_webkit/report/__init__.py (+22/-0)
sale_order_webkit/report/sale_order.mako (+269/-0)
sale_order_webkit/report/sale_order.py (+41/-0)
sale_order_webkit/sale.py (+72/-0)
sale_order_webkit/sale_report.xml (+13/-0)
sale_order_webkit/view/sale_view.xml (+84/-0)
To merge this branch: bzr merge lp:~camptocamp/sale-reports/sale-reports-add-so-webkit
Reviewer Review Type Date Requested Status
Niels Huylebroeck (community) Approve
Guewen Baconnier @ Camptocamp code review, no test Approve
Alexandre Fayolle - camptocamp code review, no test Pending
Review via email: mp+144875@code.launchpad.net

This proposal supersedes a proposal from 2013-01-24.

Description of the change

Port of sale order webkit report + add HTML not and sale conditions
+ fix file licence

To post a comment you must log in.
Revision history for this message
Yannick Vaucher @ Camptocamp (yvaucher-c2c) wrote : Posted in a previous version of this proposal

LGTM

I just think the dependancies on 'base' and 'report_webkit' modules aren't necessary in __openerp__.py as already inherited from base_header_webkit

review: Approve (code and spelling)
Revision history for this message
Alexandre Fayolle - camptocamp (alexandre-fayolle-c2c) wrote : Posted in a previous version of this proposal

628 + if company_vat:
629 + return company_vat
630 + else:
631 + return False

I think this can be rewritten as "return company_vat"

review: Needs Fixing (code review, no test)
Revision history for this message
Nicolas Bessi - Camptocamp (nbessi-c2c-deactivatedaccount) wrote :

Just fixed the if statement

Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote :

LGTM

review: Approve (code review, no test)
Revision history for this message
Nicolas Bessi - Camptocamp (nbessi-c2c-deactivatedaccount) wrote :

Hello,

If nobody has an objection can we merge this module. It starts to be blocking.

Regards

Nicolas

Revision history for this message
Niels Huylebroeck (red15) wrote :

Considering the changes in the v7 for the partner address it would be advised to also use the date formatting as used in the default sale order.

In the sale/report/sale_report.rml we can see that instead of showing the street/zip/city/country individually they simply call 'display_adress(address_id)' which takes care of using the formatting as specify on the country of your own company (not necessarily the best method I can think of but it's still better than doing this manually in each report)

Considering the blocking nature of this merge I will give it approve and try to merge it, I just thought it could help you guys in the future for more compatibility with the rest of openerp.

review: Approve
Revision history for this message
Niels Huylebroeck (red15) wrote :

Just noticed that you have not yet committed (at least not here) the module base_headers_webkit ?

Revision history for this message
Nicolas Bessi - Camptocamp (nbessi-c2c-deactivatedaccount) wrote :

Hello,

the header are in this branch:

https://code.launchpad.net/~webkit-utils-core-editors/webkit-utils/7.0

Regards

Nicolas

Revision history for this message
Alexandre Fayolle - camptocamp (alexandre-fayolle-c2c) : Posted in a previous version of this proposal
review: Approve (code review, no test)
Revision history for this message
Nicolas Bessi - Camptocamp (nbessi-c2c-deactivatedaccount) wrote : Posted in a previous version of this proposal

Hello,
This MP has been approved and merged by Alexandre Fayolle indirectly with:

https://code.launchpad.net/~camptocamp/sale-reports/sale-reports-add-so-webkit/+merge/144875

Regards

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== added directory 'sale_order_webkit'
=== added file 'sale_order_webkit/__init__.py'
--- sale_order_webkit/__init__.py 1970-01-01 00:00:00 +0000
+++ sale_order_webkit/__init__.py 2013-01-25 09:44:22 +0000
@@ -0,0 +1,22 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# Copyright (c) 2011 Camptocamp SA (http://www.camptocamp.com)
5# @author Nicolas Bessi, Vincent Renaville, Guewen Baconnier
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21from . import sale
22from . import report
023
=== added file 'sale_order_webkit/__openerp__.py'
--- sale_order_webkit/__openerp__.py 1970-01-01 00:00:00 +0000
+++ sale_order_webkit/__openerp__.py 2013-01-25 09:44:22 +0000
@@ -0,0 +1,46 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# Copyright (c) 2011 Camptocamp SA (http://www.camptocamp.com)
5# @author Nicolas Bessi, Vincent Renaville, Guewen Baconnier
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21
22{'name': 'Sales Order Report using Webkit Library',
23 'version': '1.0.1',
24 'category': 'Reports/Webkit',
25 'description': """
26Sale order webkit
27#################
28
29* Replaces the legacy RML Quotation/Sales Order report by a brand new webkit report.
30* Add header and footer notes
31* Add HTML note on Sale Order lines
32
33Depends on base_header_webkit community addon available here:
34`https://launchpad.net/webkit-utils <https://launchpad.net/webkit-utils>`_
35 """,
36 'author': 'Camptocamp',
37 'website': 'http://www.camptocamp.com',
38 'depends': ['base', 'report_webkit', 'base_headers_webkit', 'sale'],
39 'init_xml': [],
40 'update_xml': ['sale_report.xml',
41 'view/sale_view.xml'],
42 'demo_xml': [],
43 'test': [],
44 'installable': True,
45 'active': False,
46 }
047
=== added directory 'sale_order_webkit/i18n'
=== added file 'sale_order_webkit/i18n/fr.po'
--- sale_order_webkit/i18n/fr.po 1970-01-01 00:00:00 +0000
+++ sale_order_webkit/i18n/fr.po 2013-01-25 09:44:22 +0000
@@ -0,0 +1,98 @@
1# Translation of OpenERP Server.
2# This file contains the translation of the following modules:
3# * sale_order_webkit
4#
5msgid ""
6msgstr ""
7"Project-Id-Version: OpenERP Server 6.0.3\n"
8"Report-Msgid-Bugs-To: support@openerp.com\n"
9"POT-Creation-Date: 2011-12-12 11:13+0000\n"
10"PO-Revision-Date: 2011-12-12 11:13+0000\n"
11"Last-Translator: <>\n"
12"Language-Team: \n"
13"MIME-Version: 1.0\n"
14"Content-Type: text/plain; charset=UTF-8\n"
15"Content-Transfer-Encoding: \n"
16"Plural-Forms: \n"
17
18#. module: sale_order_webkit
19#: report:addons/sale_order_webkit/report/sale_order.mako:78
20msgid "Your Reference"
21msgstr "Votre Référence"
22
23#. module: sale_order_webkit
24#: report:addons/sale_order_webkit/report/sale_order.mako:35
25msgid "Fax"
26msgstr "Fax"
27
28#. module: sale_order_webkit
29#: report:addons/sale_order_webkit/report/sale_order.mako:32
30msgid "Tel"
31msgstr "Tél"
32
33#. module: sale_order_webkit
34#: report:addons/sale_order_webkit/report/sale_order.mako:94
35msgid "Description"
36msgstr "Description"
37
38#. module: sale_order_webkit
39#: report:addons/sale_order_webkit/report/sale_order.mako:79
40msgid "Quotation Date"
41msgstr "Date du devis"
42
43#. module: sale_order_webkit
44#: report:addons/sale_order_webkit/report/sale_order.mako:99
45msgid "Price"
46msgstr "Prix"
47
48#. module: sale_order_webkit
49#: report:addons/sale_order_webkit/report/sale_order.mako:79
50msgid "Date Ordered"
51msgstr "Date de commande"
52
53#. module: sale_order_webkit
54#: report:addons/sale_order_webkit/report/sale_order.mako:81
55msgid "Payment Term"
56msgstr "Condition de règlement"
57
58#. module: sale_order_webkit
59#: report:addons/sale_order_webkit/report/sale_order.mako:38
60msgid "E-mail"
61msgstr "E-mail"
62
63#. module: sale_order_webkit
64#: report:addons/sale_order_webkit/report/sale_order.mako:74
65msgid "Quotation N°"
66msgstr "Devis N°"
67
68#. module: sale_order_webkit
69#: report:addons/sale_order_webkit/report/sale_order.mako:97
70msgid "Unit Price"
71msgstr "Prix unitaire"
72
73#. module: sale_order_webkit
74#: report:addons/sale_order_webkit/report/sale_order.mako:74
75msgid "Order N°"
76msgstr "N° de commande"
77
78#. module: sale_order_webkit
79#: report:addons/sale_order_webkit/report/sale_order.mako:98
80msgid "Disc.(%)"
81msgstr "Rem.(%)"
82
83#. module: sale_order_webkit
84#: report:addons/sale_order_webkit/report/sale_order.mako:80
85msgid "Salesman"
86msgstr "Vendeur"
87
88#. module: sale_order_webkit
89#: report:addons/sale_order_webkit/report/sale_order.mako:41
90#: report:addons/sale_order_webkit/report/sale_order.mako:95
91msgid "VAT"
92msgstr "TVA"
93
94#. module: sale_order_webkit
95#: report:addons/sale_order_webkit/report/sale_order.mako:96
96msgid "Quantity"
97msgstr "Quantité"
98
099
=== added file 'sale_order_webkit/i18n/sale_order_webkit.pot'
--- sale_order_webkit/i18n/sale_order_webkit.pot 1970-01-01 00:00:00 +0000
+++ sale_order_webkit/i18n/sale_order_webkit.pot 2013-01-25 09:44:22 +0000
@@ -0,0 +1,98 @@
1# Translation of OpenERP Server.
2# This file contains the translation of the following modules:
3# * sale_order_webkit
4#
5msgid ""
6msgstr ""
7"Project-Id-Version: OpenERP Server 6.0.3\n"
8"Report-Msgid-Bugs-To: support@openerp.com\n"
9"POT-Creation-Date: 2011-12-12 11:13+0000\n"
10"PO-Revision-Date: 2011-12-12 11:13+0000\n"
11"Last-Translator: <>\n"
12"Language-Team: \n"
13"MIME-Version: 1.0\n"
14"Content-Type: text/plain; charset=UTF-8\n"
15"Content-Transfer-Encoding: \n"
16"Plural-Forms: \n"
17
18#. module: sale_order_webkit
19#: report:addons/sale_order_webkit/report/sale_order.mako:78
20msgid "Your Reference"
21msgstr ""
22
23#. module: sale_order_webkit
24#: report:addons/sale_order_webkit/report/sale_order.mako:35
25msgid "Fax"
26msgstr ""
27
28#. module: sale_order_webkit
29#: report:addons/sale_order_webkit/report/sale_order.mako:32
30msgid "Tel"
31msgstr ""
32
33#. module: sale_order_webkit
34#: report:addons/sale_order_webkit/report/sale_order.mako:94
35msgid "Description"
36msgstr ""
37
38#. module: sale_order_webkit
39#: report:addons/sale_order_webkit/report/sale_order.mako:79
40msgid "Quotation Date"
41msgstr ""
42
43#. module: sale_order_webkit
44#: report:addons/sale_order_webkit/report/sale_order.mako:99
45msgid "Price"
46msgstr ""
47
48#. module: sale_order_webkit
49#: report:addons/sale_order_webkit/report/sale_order.mako:79
50msgid "Date Ordered"
51msgstr ""
52
53#. module: sale_order_webkit
54#: report:addons/sale_order_webkit/report/sale_order.mako:81
55msgid "Payment Term"
56msgstr ""
57
58#. module: sale_order_webkit
59#: report:addons/sale_order_webkit/report/sale_order.mako:38
60msgid "E-mail"
61msgstr ""
62
63#. module: sale_order_webkit
64#: report:addons/sale_order_webkit/report/sale_order.mako:74
65msgid "Quotation N°"
66msgstr ""
67
68#. module: sale_order_webkit
69#: report:addons/sale_order_webkit/report/sale_order.mako:97
70msgid "Unit Price"
71msgstr ""
72
73#. module: sale_order_webkit
74#: report:addons/sale_order_webkit/report/sale_order.mako:74
75msgid "Order N°"
76msgstr ""
77
78#. module: sale_order_webkit
79#: report:addons/sale_order_webkit/report/sale_order.mako:98
80msgid "Disc.(%)"
81msgstr ""
82
83#. module: sale_order_webkit
84#: report:addons/sale_order_webkit/report/sale_order.mako:80
85msgid "Salesman"
86msgstr ""
87
88#. module: sale_order_webkit
89#: report:addons/sale_order_webkit/report/sale_order.mako:41
90#: report:addons/sale_order_webkit/report/sale_order.mako:95
91msgid "VAT"
92msgstr ""
93
94#. module: sale_order_webkit
95#: report:addons/sale_order_webkit/report/sale_order.mako:96
96msgid "Quantity"
97msgstr ""
98
099
=== added directory 'sale_order_webkit/report'
=== added file 'sale_order_webkit/report/__init__.py'
--- sale_order_webkit/report/__init__.py 1970-01-01 00:00:00 +0000
+++ sale_order_webkit/report/__init__.py 2013-01-25 09:44:22 +0000
@@ -0,0 +1,22 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# Copyright (c) 2011 Camptocamp SA (http://www.camptocamp.com)
5# @author Nicolas Bessi, Vincent Renaville, Guewen Baconnier
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21
22from . import sale_order
023
=== added file 'sale_order_webkit/report/sale_order.mako'
--- sale_order_webkit/report/sale_order.mako 1970-01-01 00:00:00 +0000
+++ sale_order_webkit/report/sale_order.mako 2013-01-25 09:44:22 +0000
@@ -0,0 +1,269 @@
1<html>
2<head>
3 <style type="text/css">
4 ${css}
5
6.list_sale_table {
7 border:thin solid #E3E4EA;
8 text-align:center;
9 border-collapse: collapse;
10}
11
12.list_sale_table td {
13 border-top:thin solid #EEEEEE;
14 text-align:right;
15 font-size:12;
16 padding-right:3px;
17 padding-left:3px;
18 padding-top:3px;
19 padding-bottom:3px;
20}
21
22.list_bank_table {
23 text-align:center;
24 border-collapse: collapse;
25}
26
27.list_bank_table td {
28 text-align:left;
29 font-size:12;
30 padding-right:3px;
31 padding-left:3px;
32 padding-top:3px;
33 padding-bottom:3px;
34}
35
36.list_bank_table th {
37 background-color: #EEEEEE;
38 text-align:left;
39 font-size:12;
40 font-weight:bold;
41 padding-right:3px
42 padding-left:3px
43}
44
45.list_sale_table th {
46 background-color: #EEEEEE;
47 border: thin solid #000000;
48 text-align:center;
49 font-size:12;
50 font-weight:bold;
51 padding-right:3px;
52 padding-left:3px;
53}
54
55.list_table thead {
56 display:table-header-group;
57}
58
59
60.list_tax_table {
61}
62.list_tax_table td {
63 text-align:left;
64 font-size:12;
65}
66
67
68.list_table thead {
69 display:table-header-group;
70}
71
72
73.list_total_table {
74 border-collapse: collapse;
75}
76
77.list_total_table td {
78 text-align:right;
79 font-size:12;
80}
81
82.no_bloc {
83 border-top: thin solid #ffffff ;
84}
85
86
87.list_total_table th {
88 background-color: #F7F7F7;
89 border-collapse: collapse;
90}
91
92tfoot.totals tr:first-child td{
93 padding-top: 15px;
94}
95
96.right_table {
97 right: 4cm;
98 width:"100%";
99}
100
101.std_text {
102 font-size:12;
103}
104
105.note {
106 text-align:left;
107 font-size:10;
108 border-top:thin solid #ffffff;
109 border-left:thin solid #ffffff;
110 border-right:thin solid #ffffff;
111}
112
113
114 </style>
115</head>
116<body>
117 <%page expression_filter="entity"/>
118 <%
119 def carriage_returns(text):
120 return text.replace('\n', '<br />')
121
122 %>
123 %for order in objects:
124 <% setLang(order.partner_id.lang) %>
125 <%
126 quotation = order.state == 'draft'
127 %>
128 <div class="address">
129 <table class="recipient">
130 <tr><td class="name">${order.partner_id.title or ''} ${order.partner_id.name }</td></tr>
131 <tr><td>${order.partner_id.street or ''}</td></tr>
132 <tr><td>${order.partner_id.street2 or ''}</td></tr>
133 <tr><td>${order.partner_id.zip or ''} ${order.partner_id.city or ''}</td></tr>
134 %if order.partner_id.state_id:
135 <tr><td>${order.partner_id.state_id.name or ''} </td></tr>
136 %endif
137 %if order.partner_id.country_id:
138 <tr><td>${order.partner_id.country_id.name or ''} </td></tr>
139 %endif
140 %if order.partner_id.phone:
141 <tr><td>${_("Tel")}: ${order.partner_id.phone}</td></tr>
142 %endif
143 %if order.partner_id.fax:
144 <tr><td>${_("Fax")}: ${order.partner_id.fax}</td></tr>
145 %endif
146 %if order.partner_id.email:
147 <tr><td>${_("E-mail")}: ${order.partner_id.email}</td></tr>
148 %endif
149 %if order.partner_id.vat:
150 <tr><td>${_("VAT")}: ${order.partner_id.vat}</td></tr>
151 %endif
152 </table>
153
154 <table class="shipping">
155 <tr><td class="address_title">${_("Shipping address:")}</td></tr>
156 <tr><td >${order.partner_id.title or ''} ${order.partner_id.name }</td></tr>
157 <tr><td>${order.partner_shipping_id.street or ''}</td></tr>
158 <tr><td>${order.partner_shipping_id.street2 or ''}</td></tr>
159 <tr><td>${order.partner_shipping_id.zip or ''} ${order.partner_shipping_id.city or ''}</td></tr>
160 %if order.partner_shipping_id.state_id:
161 <tr><td>${order.partner_shipping_id.state_id.name or ''} </td></tr>
162 %endif
163 %if order.partner_shipping_id.country_id:
164 <tr><td>${order.partner_shipping_id.country_id.name or ''} </td></tr>
165 %endif
166 </table>
167
168 <table class="invoice">
169 <tr><td class="address_title">${_("Invoice address:")}</td></tr>
170 <tr><td>${order.partner_id.title or ''} ${order.partner_id.name }</td></tr>
171 <tr><td>${order.partner_invoice_id.street or ''}</td></tr>
172 <tr><td>${order.partner_invoice_id.street2 or ''}</td></tr>
173 <tr><td>${order.partner_invoice_id.zip or ''} ${order.partner_invoice_id.city or ''}</td></tr>
174 %if order.partner_invoice_id.state_id:
175 <tr><td>${order.partner_invoice_id.state_id.name or ''} </td></tr>
176 %endif
177 %if order.partner_invoice_id.country_id:
178 <tr><td>${order.partner_invoice_id.country_id.name or ''} </td></tr>
179 %endif
180 </table>
181 </div>
182 <div>
183
184 %if order.note1:
185 <p class="std_text"> ${order.note1| n} </p>
186 %endif
187 </div>
188
189 <h1 style="clear:both;">${quotation and _(u'Quotation N°') or _(u'Order N°') } ${order.name}</h1>
190
191 <table class="basic_table" width="100%">
192 <tr>
193 <td style="font-weight:bold;">${quotation and _("Date Ordered") or _("Quotation Date")}</td>
194 <td style="font-weight:bold;">${_("Your Reference")}</td>
195 <td style="font-weight:bold;">${_("Salesman")}</td>
196 <td style="font-weight:bold;">${_('Payment Term')}</td>
197 <td style="font-weight:bold;">${_('Incoterm')}</td>
198 </tr>
199 <tr>
200 <td>${formatLang(order.date_order, date=True)}</td>
201 <td>${order.client_order_ref or ''}</td>
202 <td>${order.user_id and order.user_id.name or ''}</td>
203 <td>${order.payment_term and order.payment_term.name or ''}</td>
204 <td>${''}</td>
205 </tr>
206 </table>
207
208 <table class="list_sale_table" width="100%" style="margin-top: 20px;">
209 <thead>
210 <tr>
211 <th>${_("Description")}</th>
212 <th class="amount">${_("Quantity")}</th>
213 <th class="amount">${_("UoM")}</th>
214 <th class="amount">${_("Unit Price")}</th>
215 <th>${_("VAT")}</th>
216 <th class="amount">${_("Disc.(%)")}</th>
217 <th class="amount">${_("Price")}</th>
218 </tr>
219 </thead>
220 <tbody>
221 %for line in order.order_line:
222 <tr class="line">
223 <td style="text-align:left; " >${ line.name }</td>
224 <td class="amount" width="7.5%">${ formatLang(line.product_uos and line.product_uos_qty or line.product_uom_qty) }</td>
225 <td style="text-align:center;">${ line.product_uos and line.product_uos.name or line.product_uom.name }</td>
226 <td class="amount" width="8%">${formatLang(line.price_unit)}</td>
227 <td style="font-style:italic; font-size: 10;">${ ', '.join([tax.name or '' for tax in line.tax_id]) }</td>
228 <td class="amount" width="10%">${line.discount and formatLang(line.discount, digits=get_digits(dp='Sale Price')) or ''} ${line.discount and '%' or ''}</td>
229 <td class="amount" width="13%">${formatLang(line.price_subtotal, digits=get_digits(dp='Sale Price'))}&nbsp;${order.pricelist_id.currency_id.symbol}</td>
230 </tr>
231 %if line.formatted_note:
232 <tr class="line">
233 <td colspan="7" class="note" style="text-align:left;">${line.formatted_note| n}</td>
234 </tr>
235 %endif
236 %endfor
237 </tbody>
238 <tfoot class="totals">
239 <tr>
240 <td colspan="5" style="border-style:none"/>
241 <td style="border-style:none"><b>${_("Net Total:")}</b></td>
242 <td class="amount" style="border-style:none">${formatLang(order.amount_untaxed, get_digits(dp='Sale Price'))} ${order.pricelist_id.currency_id.symbol}</td>
243 </tr>
244 <tr>
245 <td colspan="5" style="border-style:none"/>
246 <td style="border-style:none" ><b>${_("Taxes:")}</b></td>
247 <td class="amount"style="border-style:none" >${formatLang(order.amount_tax, get_digits(dp='Sale Price'))} ${order.pricelist_id.currency_id.symbol}</td>
248 </tr>
249 <tr>
250 <td colspan="5" style="border-style:none"/>
251 <td style="border-style:none"><b>${_("Total:")}</b></td>
252 <td class="amount" style="border-style:none">${formatLang(order.amount_total, get_digits(dp='Sale Price'))} ${order.pricelist_id.currency_id.symbol}</td>
253 </tr>
254 </tfoot>
255 </table>
256 <p style="margin-top: 20px;">${order.payment_term and order.payment_term.note or '' | carriage_returns}</p>
257
258 %if order.note :
259 <p class="std_text">${order.note | carriage_returns}</p>
260 %endif
261 %if order.note2:
262 <p class="std_text">${order.note2 | n}</p>
263 %endif
264
265 <p style="page-break-after: always"/>
266 <br/>
267 %endfor
268</body>
269</html>
0270
=== added file 'sale_order_webkit/report/sale_order.py'
--- sale_order_webkit/report/sale_order.py 1970-01-01 00:00:00 +0000
+++ sale_order_webkit/report/sale_order.py 2013-01-25 09:44:22 +0000
@@ -0,0 +1,41 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# Copyright (c) 2011 Camptocamp SA (http://www.camptocamp.com)
5# @author Nicolas Bessi, Vincent Renaville, Guewen Baconnier
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21import time
22
23from openerp.report import report_sxw
24from openerp import pooler
25
26
27class SaleOrderReport(report_sxw.rml_parse):
28 def __init__(self, cr, uid, name, context):
29 super(SaleOrderReport, self).__init__(cr, uid, name, context=context)
30 self.localcontext.update({'time': time,
31 'company_vat': self._get_company_vat})
32
33 def _get_company_vat(self):
34 res_users_obj = pooler.get_pool(self.cr.dbname).get('res.users')
35 company_vat = res_users_obj.browse(self.cr, self.uid, self.uid).company_id.partner_id.vat
36 return company_vat
37
38report_sxw.report_sxw('report.sale.order.webkit',
39 'sale.order',
40 'addons/sale_report_webkit/report/sale_order.mako',
41 parser=SaleOrderReport)
042
=== added file 'sale_order_webkit/sale.py'
--- sale_order_webkit/sale.py 1970-01-01 00:00:00 +0000
+++ sale_order_webkit/sale.py 2013-01-25 09:44:22 +0000
@@ -0,0 +1,72 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# Copyright (c) 2011 Camptocamp SA (http://www.camptocamp.com)
5# @author Nicolas Bessi, Vincent Renaville, Guewen Baconnier
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21from openerp.osv import orm, fields
22
23
24class SaleConditionText(orm.Model):
25 """Sale order Textual information"""
26 _name = "sale.condition_text"
27 _description = "sale conditions"
28
29 _columns = {
30 'name': fields.char('Condition summary', required=True, size=128),
31 'type': fields.selection([('header', 'Top condition'),
32 ('footer', 'Bottom condition')],
33 'type', required=True),
34 'text': fields.html('Condition', translate=True, required=True)}
35
36
37class SaleOrder(orm.Model):
38 """Adds condition to SO"""
39
40 _inherit = "sale.order"
41 _description = 'Sale Order'
42
43 _columns = {'text_condition1': fields.many2one('sale.condition_text', 'Header'),
44 'text_condition2': fields.many2one('sale.condition_text', 'Footer'),
45 'note1': fields.html('Header'),
46 'note2': fields.html('Footer')}
47
48 def _set_condition(self, cursor, uid, inv_id, commentid, key):
49 """Set the text of the notes in invoices"""
50 if not commentid:
51 return {}
52 try:
53 lang = self.browse(cursor, uid, inv_id)[0].partner_id.lang
54 except Exception, exc:
55 lang = 'en_US'
56 cond = self.pool.get('sale.condition_text').browse(cursor, uid,
57 commentid, {'lang': lang})
58 return {'value': {key: cond.text}}
59
60 def set_header(self, cursor, uid, inv_id, commentid):
61 return self._set_condition(cursor, uid, inv_id, commentid, 'note1')
62
63 def set_footer(self, cursor, uid, inv_id, commentid):
64 return self._set_condition(cursor, uid, inv_id, commentid, 'note2')
65
66
67class SaleOrderLine(orm.Model):
68 """ADD HTML note to sale order lines"""
69
70 _inherit = "sale.order.line"
71
72 _columns = {'formatted_note': fields.html('Formatted Note')}
073
=== added file 'sale_order_webkit/sale_report.xml'
--- sale_order_webkit/sale_report.xml 1970-01-01 00:00:00 +0000
+++ sale_order_webkit/sale_report.xml 2013-01-25 09:44:22 +0000
@@ -0,0 +1,13 @@
1<?xml version="1.0" encoding="utf-8"?>
2<openerp>
3 <data>
4 <report id="sale.report_sale_order"
5 name="sale.order.webkit"
6 auto="False"
7 model="sale.order"
8 file="sale_order_webkit/report/sale_order.mako"
9 string="Quotation - Order"
10 webkit_header="base_headers_webkit.base_reports_portrait_header"
11 report_type="webkit"/>
12 </data>
13</openerp>
014
=== added directory 'sale_order_webkit/view'
=== added file 'sale_order_webkit/view/sale_view.xml'
--- sale_order_webkit/view/sale_view.xml 1970-01-01 00:00:00 +0000
+++ sale_order_webkit/view/sale_view.xml 2013-01-25 09:44:22 +0000
@@ -0,0 +1,84 @@
1<?xml version="1.0"?>
2<openerp>
3 <data>
4 <!-- Sale condition text views -->
5 <record model="ir.ui.view" id="view_sale_condition_webkit">
6 <field name="name">sale.condition_text.form</field>
7 <field name="model">sale.condition_text</field>
8 <field name="type">form</field>
9 <field name="arch" type="xml">
10 <form string="sale condition text">
11 <field name="name" select="1"/>
12 <field name="type" select="1"/>
13 <field name="text" colspan="4"/>
14 </form>
15 </field>
16 </record>
17 <record model="ir.ui.view" id="view_sale_condition_list_webkit">
18 <field name="name">sale.condition_text.list</field>
19 <field name="model">sale.condition_text</field>
20 <field name="type">tree</field>
21 <field name="priority" eval="6"/>
22 <field name="arch" type="xml">
23 <tree string="Sale condition text">
24 <field name="name" select="1"/>
25 <field name="type" select="1"/>
26 <field name="text"/>
27 </tree>
28 </field>
29 </record>
30 <record model="ir.actions.act_window" id="action_sale_condition_webkit">
31 <field name="name">sale.condition_text</field>
32 <field name="type">ir.actions.act_window</field>
33 <field name="res_model">sale.condition_text</field>
34 <field name="view_type">form</field>
35 <field name="view_mode">tree,form</field>
36 <field name="view_id" ref="view_sale_condition_list_webkit"/>
37 </record>
38 <record model="ir.actions.act_window" id="action_sale_condition_form_webkit">
39 <field name="name">sale.condition_text</field>
40 <field name="type">ir.actions.act_window</field>
41 <field name="res_model">sale.condition_text</field>
42 <field name="view_type">form</field>
43 <field name="view_id" ref="view_sale_condition_webkit"/>
44 </record>
45
46 <!-- Overwrite of sale order / sale order line form view -->
47
48
49 <record model="ir.ui.view" id="sale_order_add_notes_in_invoice_line_1">
50 <field name="name">sale.odrer.form.add.notes</field>
51 <field name="model">sale.order</field>
52 <field name="inherit_id" ref="sale.view_order_form"/>
53 <field name="arch" type="xml">
54 <xpath expr="/form/sheet/notebook/page/field/form/field[@name='name']" position="after">
55 <group>
56 <field name="formatted_note" colspan="4"/>
57 </group>
58 </xpath>
59 </field>
60 </record>
61
62 <record model="ir.ui.view" id="view_order_form">
63 <field name="name">sale.order.form.add.notes</field>
64 <field name="model">sale.order</field>
65 <field name="inherit_id" ref="sale.view_order_form"/>
66 <field name="arch" type="xml">
67 <notebook position="inside">
68 <page string="Conditions">
69 <group>
70 <field name="text_condition1" domain="[('type','=','header')]"
71 on_change="set_header(text_condition1)" colspan="2"/>
72 <field name="text_condition2" domain="[('type','=','footer')]"
73 on_change="set_footer(text_condition2)" colspan="2"/>
74 <field name="note1" colspan="4" nolabel="1" placeholder="Your top conditions here"/>
75 <field name="note2" colspan="4" nolabel="1" placeholder="Your bottom conditions here"/>
76 </group>
77 </page>
78 </notebook>
79 </field>
80 </record>
81
82
83 </data>
84</openerp>

Subscribers

People subscribed via source and target branches