Merge lp:~camptocamp/sale-reports/7.0-sync-webkit-reports-20130926 into lp:~sale-core-editors/sale-reports/7.0

Proposed by Yannick Vaucher @ Camptocamp
Status: Merged
Merged at revision: 24
Proposed branch: lp:~camptocamp/sale-reports/7.0-sync-webkit-reports-20130926
Merge into: lp:~sale-core-editors/sale-reports/7.0
Diff against target: 401 lines (+187/-121)
1 file modified
sale_order_webkit/report/sale_order.mako (+187/-121)
To merge this branch: bzr merge lp:~camptocamp/sale-reports/7.0-sync-webkit-reports-20130926
Reviewer Review Type Date Requested Status
Maxime Chambreuil (http://www.savoirfairelinux.com) code review Approve
Guewen Baconnier @ Camptocamp Approve
Nicolas Bessi - Camptocamp (community) Approve
Review via email: mp+187702@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Nicolas Bessi - Camptocamp (nbessi-c2c-deactivatedaccount) wrote :

 <th class="list_main_headers" style="width: 100%">
277 + <table style="width:100%">
278 + <tr>
279 + <th class="main_col1">${_("Description")}</th>

I'm not sure about this one. Why do you include this table into header?

Else LGTM

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

After disscution with Yannick

LGTM

review: Approve
Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) :
review: Approve
Revision history for this message
Maxime Chambreuil (http://www.savoirfairelinux.com) (max3903) :
review: Approve (code review)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'sale_order_webkit/report/sale_order.mako'
2--- sale_order_webkit/report/sale_order.mako 2013-06-19 09:14:41 +0000
3+++ sale_order_webkit/report/sale_order.mako 2013-09-26 09:49:38 +0000
4@@ -3,46 +3,96 @@
5 <style type="text/css">
6 ${css}
7
8-.list_sale_table {
9+.list_main_table {
10 border:thin solid #E3E4EA;
11 text-align:center;
12 border-collapse: collapse;
13 }
14-.list_sale_table th {
15+table.list_main_table {
16+ margin-top: 20px;
17+}
18+.list_main_headers {
19+ padding: 0;
20+}
21+.list_main_headers th {
22+ border: thin solid #000000;
23+ padding-right:3px;
24+ padding-left:3px;
25 background-color: #EEEEEE;
26- border: thin solid #000000;
27 text-align:center;
28 font-size:12;
29 font-weight:bold;
30- padding-right:3px;
31- padding-left:3px;
32 }
33-.list_sale_table td {
34- border-top: thin solid #EEEEEE;
35- text-align:left;
36- font-size:12;
37+.list_main_table td {
38 padding-right:3px;
39 padding-left:3px;
40 padding-top:3px;
41 padding-bottom:3px;
42 }
43-.list_sale_table thead {
44- display:table-header-group;
45-}
46-
47-td.formatted_note {
48+.list_main_lines,
49+.list_main_footers {
50+ padding: 0;
51+}
52+.list_main_footers {
53+ padding-top: 15px;
54+}
55+.list_main_lines td,
56+.list_main_footers td,
57+.list_main_footers th {
58+ border-style: none;
59+ text-align:left;
60+ font-size:12;
61+ padding:0;
62+}
63+.list_main_footers th {
64+ text-align:right;
65+}
66+
67+td .total_empty_cell {
68+ width: 77%;
69+}
70+td .total_sum_cell {
71+ width: 13%;
72+}
73+
74+.nobreak {
75+ page-break-inside: avoid;
76+}
77+caption.formatted_note {
78 text-align:left;
79 border-right:thin solid #EEEEEE;
80 border-left:thin solid #EEEEEE;
81 border-top:thin solid #EEEEEE;
82 padding-left:10px;
83 font-size:11;
84-}
85-
86-
87-
88-.no_bloc {
89- border-top: thin solid #ffffff ;
90+ caption-side: bottom;
91+}
92+caption.formatted_note p {
93+ margin: 0;
94+}
95+
96+.main_col1 {
97+ width: 40%;
98+}
99+td.main_col1 {
100+ text-align:left;
101+}
102+.main_col2,
103+.main_col3,
104+.main_col4,
105+.main_col6 {
106+ width: 10%;
107+}
108+.main_col5 {
109+ width: 7%;
110+}
111+td.main_col5 {
112+ text-align: center;
113+ font-style:italic;
114+ font-size: 10;
115+}
116+.main_col7 {
117+ width: 13%;
118 }
119
120 .right_table {
121@@ -54,16 +104,19 @@
122 font-size:12;
123 }
124
125-tfoot.totals tr:first-child td{
126- padding-top: 15px;
127+th.date {
128+ width: 90px;
129 }
130
131-
132 td.amount, th.amount {
133 text-align: right;
134 white-space: nowrap;
135 }
136
137+td.date {
138+ white-space: nowrap;
139+ width: 90px;
140+}
141
142 .address .recipient .shipping .invoice {
143 font-size: 12px;
144@@ -76,8 +129,27 @@
145 <%
146 def carriage_returns(text):
147 return text.replace('\n', '<br />')
148-
149 %>
150+
151+ <%def name="address(partner)">
152+ <%doc>
153+ XXX add a helper for address in report_webkit module as this won't be suported in v8.0
154+ </%doc>
155+ %if partner.parent_id:
156+ <tr><td class="name">${partner.parent_id.name or ''}</td></tr>
157+ <tr><td>${partner.title and partner.title.name or ''} ${partner.name}</td></tr>
158+ <% address_lines = partner.contact_address.split("\n")[1:] %>
159+ %else:
160+ <tr><td class="name">${partner.title and partner.title.name or ''} ${partner.name}</td></tr>
161+ <% address_lines = partner.contact_address.split("\n") %>
162+ %endif
163+ %for part in address_lines:
164+ % if part:
165+ <tr><td>${part}</td></tr>
166+ % endif
167+ %endfor
168+ </%def>
169+
170 %for order in objects:
171 <% setLang(order.partner_id.lang) %>
172 <%
173@@ -85,53 +157,17 @@
174 %>
175 <div class="address">
176 <table class="recipient">
177- %if order.partner_id.parent_id:
178- <tr><td class="name">${order.partner_id.parent_id.name or ''}</td></tr>
179- <tr><td>${order.partner_id.title and order.partner_id.title.name or ''} ${order.partner_id.name }</td></tr>
180- <% address_lines = order.partner_id.contact_address.split("\n")[1:] %>
181- %else:
182- <tr><td class="name">${order.partner_id.title and order.partner_id.title.name or ''} ${order.partner_id.name }</td></tr>
183- <% address_lines = order.partner_id.contact_address.split("\n") %>
184- %endif
185- %for part in address_lines:
186- %if part:
187- <tr><td>${part}</td></tr>
188- %endif
189- %endfor
190+ ${address(partner=order.partner_id)}
191 </table>
192
193 <table class="shipping">
194- <tr><td class="address_title">${_("Shipping address:")}</td></tr>
195- %if order.partner_shipping_id.parent_id:
196- <tr><td>${order.partner_shipping_id.parent_id.name or ''}</td></tr>
197- <tr><td>${order.partner_shipping_id.title and order.partner_shipping_id.title.name or ''} ${order.partner_shipping_id.name }</td></tr>
198- <% address_lines = order.partner_shipping_id.contact_address.split("\n")[1:] %>
199- %else:
200- <tr><td>${order.partner_shipping_id.title and order.partner_shipping_id.title.name or ''} ${order.partner_shipping_id.name }</td></tr>
201- <% address_lines = order.partner_shipping_id.contact_address.split("\n") %>
202- %endif
203- %for part in address_lines:
204- %if part:
205- <tr><td>${part}</td></tr>
206- %endif
207- %endfor
208+ <tr><td class="address_title">${_("Shipping address:")}</td></tr>
209+ ${address(partner=order.partner_shipping_id)}
210 </table>
211
212 <table class="invoice">
213- <tr><td class="address_title">${_("Invoice address:")}</td></tr>
214- %if order.partner_invoice_id.parent_id:
215- <tr><td>${order.partner_invoice_id.parent_id.name or ''}</td></tr>
216- <tr><td>${order.partner_invoice_id.title and order.partner_invoice_id.title.name or ''} ${order.partner_invoice_id.name }</td></tr>
217- <% address_lines = order.partner_invoice_id.contact_address.split("\n")[1:] %>
218- %else:
219- <tr><td>${order.partner_invoice_id.title and order.partner_invoice_id.title.name or ''} ${order.partner_invoice_id.name }</td></tr>
220- <% address_lines = order.partner_invoice_id.contact_address.split("\n") %>
221- %endif
222- %for part in address_lines:
223- %if part:
224- <tr><td>${part}</td></tr>
225- %endif
226- %endfor
227+ <tr><td class="address_title">${_("Invoice address:")}</td></tr>
228+ ${address(partner=order.partner_invoice_id)}
229 </table>
230 </div>
231
232@@ -139,13 +175,13 @@
233
234 <table class="basic_table" width="100%">
235 <tr>
236- <td style="font-weight:bold;">${quotation and _("Date Ordered") or _("Quotation Date")}</td>
237- <td style="font-weight:bold;">${_("Your Reference")}</td>
238- <td style="font-weight:bold;">${_("Salesman")}</td>
239- <td style="font-weight:bold;">${_('Payment Term')}</td>
240+ <th class="date">${quotation and _("Date Ordered") or _("Quotation Date")}</td>
241+ <th>${_("Your Reference")}</td>
242+ <th>${_("Salesman")}</td>
243+ <th>${_('Payment Term')}</td>
244 </tr>
245 <tr>
246- <td>${formatLang(order.date_order, date=True)}</td>
247+ <td class="date">${formatLang(order.date_order, date=True)}</td>
248 <td>${order.client_order_ref or ''}</td>
249 <td>${order.user_id and order.user_id.name or ''}</td>
250 <td>${order.payment_term and order.payment_term.note or ''}</td>
251@@ -154,59 +190,91 @@
252
253 <div>
254 %if order.note1:
255- <p class="std_text"> ${order.note1| n} </p>
256+ <p class="std_text"> ${order.note1 | n} </p>
257 %endif
258 </div>
259
260- <table class="list_sale_table" width="100%" style="margin-top: 20px;">
261- <thead>
262- <tr>
263- <th>${_("Description")}</th>
264- <th class="amount">${_("Quantity")}</th>
265- <th class="amount">${_("UoM")}</th>
266- <th class="amount">${_("Unit Price")}</th>
267- <th>${_("VAT")}</th>
268- <th class="amount">${_("Disc.(%)")}</th>
269- <th class="amount">${_("Price")}</th>
270- </tr>
271- </thead>
272- <tbody>
273+ <table class="list_main_table" width="100%">
274+ <thead>
275+ <tr>
276+ <th class="list_main_headers" style="width: 100%">
277+ <table style="width:100%">
278+ <tr>
279+ <th class="main_col1">${_("Description")}</th>
280+ <th class="amount main_col2">${_("Quantity")}</th>
281+ <th class="amount main_col3">${_("UoM")}</th>
282+ <th class="amount main_col4">${_("Unit Price")}</th>
283+ <th class="main_col5">${_("VAT")}</th>
284+ <th class="amount main_col6">${_("Disc.(%)")}</th>
285+ <th class="amount main_col7">${_("Price")}</th>
286+ </tr>
287+ </table>
288+ </th>
289+ </tr>
290+ </thead>
291+ <tbody>
292 %for line in order.order_line:
293- <tr class="line">
294- <td style="text-align:left; " >${ line.name }</td>
295- <td class="amount" width="7.5%">${ formatLang(line.product_uos and line.product_uos_qty or line.product_uom_qty) }</td>
296- <td style="text-align:center;">${ line.product_uos and line.product_uos.name or line.product_uom.name }</td>
297- <td class="amount" width="8%">${formatLang(line.price_unit)}</td>
298- <td style="font-style:italic; font-size: 10;">${ ', '.join([tax.description or tax.name for tax in line.tax_id]) }</td>
299- <td class="amount" width="10%">${line.discount and formatLang(line.discount, digits=get_digits(dp='Sale Price')) or ''} ${line.discount and '%' or ''}</td>
300- <td class="amount" width="13%">${formatLang(line.price_subtotal, digits=get_digits(dp='Sale Price'))}&nbsp;${order.pricelist_id.currency_id.symbol}</td>
301- </tr>
302- %if line.formatted_note:
303- <tr>
304- <td class="formatted_note" colspan="7">
305- ${line.formatted_note| n}
306- </td>
307- </tr>
308- %endif
309+ <tr>
310+ <td class="list_main_lines" style="width: 100%">
311+ <div class="nobreak">
312+ <table style="width:100%">
313+ <tr>
314+ <td class="main_col1">${ line.name }</td>
315+ <td class="amount main_col2">${ formatLang(line.product_uos and line.product_uos_qty or line.product_uom_qty) }</td>
316+ <td class="amount main_col3">${ line.product_uos and line.product_uos.name or line.product_uom.name }</td>
317+ <td class="amount main_col4">${formatLang(line.price_unit)}</td>
318+ <td class="main_col5">${ ', '.join([tax.description or tax.name for tax in line.tax_id]) }</td>
319+ <td class="amount main_col6">${line.discount and formatLang(line.discount, digits=get_digits(dp='Sale Price')) or ''} ${line.discount and '%' or ''}</td>
320+ <td class="amount main_col7">${formatLang(line.price_subtotal, digits=get_digits(dp='Sale Price'))}&nbsp;${order.pricelist_id.currency_id.symbol}</td>
321+ </tr>
322+ %if line.formatted_note:
323+ <caption class="formatted_note">
324+ ${line.formatted_note| n}
325+ </caption>
326+ %endif
327+ </table>
328+ </div>
329+ </td>
330+ </tr>
331 %endfor
332- </tbody>
333- <tfoot class="totals">
334- <tr>
335- <td colspan="5" style="border-style:none"/>
336- <td style="border-style:none"><b>${_("Net Total:")}</b></td>
337- <td class="amount" style="border-style:none">${formatLang(order.amount_untaxed, get_digits(dp='Sale Price'))} ${order.pricelist_id.currency_id.symbol}</td>
338- </tr>
339- <tr>
340- <td colspan="5" style="border-style:none"/>
341- <td style="border-style:none" ><b>${_("Taxes:")}</b></td>
342- <td class="amount"style="border-style:none" >${formatLang(order.amount_tax, get_digits(dp='Sale Price'))} ${order.pricelist_id.currency_id.symbol}</td>
343- </tr>
344- <tr>
345- <td colspan="5" style="border-style:none"/>
346- <td style="border-style:none"><b>${_("Total:")}</b></td>
347- <td class="amount" style="border-style:none">${formatLang(order.amount_total, get_digits(dp='Sale Price'))} ${order.pricelist_id.currency_id.symbol}</td>
348- </tr>
349- </tfoot>
350+ </tbody>
351+ <tfoot class="totals">
352+ <tr>
353+ <td class="list_main_footers" style="width: 100%">
354+ <div class="nobreak">
355+ <table style="width:100%">
356+ <tr>
357+ <td class="total_empty_cell"/>
358+ <th>
359+ ${_("Net Total:")}
360+ </th>
361+ <td class="amount total_sum_cell">
362+ ${formatLang(order.amount_untaxed, get_digits(dp='Sale Price'))} ${order.pricelist_id.currency_id.symbol}
363+ </td>
364+ </tr>
365+ <tr>
366+ <td class="total_empty_cell"/>
367+ <th>
368+ ${_("Taxes:")}
369+ </th>
370+ <td class="amount total_sum_cell">
371+ ${formatLang(order.amount_tax, get_digits(dp='Sale Price'))} ${order.pricelist_id.currency_id.symbol}
372+ </td>
373+ </tr>
374+ <tr>
375+ <td class="total_empty_cell"/>
376+ <th>
377+ ${_("Total:")}
378+ </th>
379+ <td class="amount total_sum_cell">
380+ <b>${formatLang(order.amount_total, get_digits(dp='Sale Price'))} ${order.pricelist_id.currency_id.symbol}</b>
381+ </td>
382+ </tr>
383+ </table>
384+ </div>
385+ </td>
386+ </tr>
387+ </tfoot>
388 </table>
389
390 %if order.note :
391@@ -215,9 +283,7 @@
392 %if order.note2:
393 <p class="std_text">${order.note2 | n}</p>
394 %endif
395-
396- <p style="page-break-after: always"/>
397- <br/>
398+ <p style="page-break-after:always"/>
399 %endfor
400 </body>
401 </html>

Subscribers

People subscribed via source and target branches