Merge lp:~camptocamp/account-invoice-report/7.0-fix-1231329 into lp:~account-core-editors/account-invoice-report/7.0

Proposed by Yannick Vaucher @ Camptocamp
Status: Merged
Merged at revision: 42
Proposed branch: lp:~camptocamp/account-invoice-report/7.0-fix-1231329
Merge into: lp:~account-core-editors/account-invoice-report/7.0
Diff against target: 415 lines (+189/-131)
1 file modified
invoice_webkit/report/account_invoice.mako (+189/-131)
To merge this branch: bzr merge lp:~camptocamp/account-invoice-report/7.0-fix-1231329
Reviewer Review Type Date Requested Status
Joël Grand-Guillaume @ camptocamp code review, no tests Approve
Pedro Manuel Baeza code review, no test Approve
Review via email: mp+187697@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Pedro Manuel Baeza (pedro.baeza) wrote :

LGTM. I have not tested, but sintactically seems correct.

Thank you.

review: Approve (code review, no test)
42. By Yannick Vaucher @ Camptocamp

[FIX] remove extra endif

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

Added a little fix

Revision history for this message
Joël Grand-Guillaume @ camptocamp (jgrandguillaume-c2c) wrote :

LGTM

review: Approve (code review, no tests)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'invoice_webkit/report/account_invoice.mako'
2--- invoice_webkit/report/account_invoice.mako 2013-08-24 08:11:45 +0000
3+++ invoice_webkit/report/account_invoice.mako 2013-10-17 09:31:03 +0000
4@@ -3,42 +3,97 @@
5 <style type="text/css">
6 ${css}
7
8-.list_invoice_table {
9+.list_main_table {
10 border:thin solid #E3E4EA;
11 text-align:center;
12 border-collapse: collapse;
13 }
14-.list_invoice_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_invoice_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_invoice_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+ caption-side: bottom;
85+}
86+caption.formatted_note p {
87+ margin: 0;
88 }
89
90+.main_col1 {
91+ width: 40%;
92+}
93+td.main_col1 {
94+ text-align:left;
95+}
96+.main_col2,
97+.main_col3,
98+.main_col4,
99+.main_col6 {
100+ width: 10%;
101+}
102+.main_col5 {
103+ width: 7%;
104+}
105+td.main_col5 {
106+ text-align: center;
107+ font-style:italic;
108+ font-size: 10;
109+}
110+.main_col7 {
111+ width: 13%;
112+}
113
114 .list_bank_table {
115 text-align:center;
116@@ -113,11 +168,6 @@
117 display:table-header-group;
118 }
119
120-
121-.no_bloc {
122- border-top: thin solid #ffffff ;
123-}
124-
125 .right_table {
126 right: 4cm;
127 width:"100%";
128@@ -127,10 +177,6 @@
129 font-size:12;
130 }
131
132-tfoot.totals tr:first-child td{
133- padding-top: 15px;
134-}
135-
136 th.date {
137 width: 90px;
138 }
139@@ -139,19 +185,6 @@
140 text-align: right;
141 white-space: nowrap;
142 }
143-.header_table {
144- text-align: center;
145- border: 1px solid lightGrey;
146- border-collapse: collapse;
147-}
148-.header_table th {
149- font-size: 12px;
150- border: 1px solid lightGrey;
151-}
152-.header_table td {
153- font-size: 12px;
154- border: 1px solid lightGrey;
155-}
156
157 td.date {
158 white-space: nowrap;
159@@ -163,6 +196,9 @@
160 }
161 .address .recipient {
162 font-size: 12px;
163+ margin-left: 350px;
164+ margin-right: 120px;
165+ float: right;
166 }
167
168 </style>
169@@ -174,45 +210,44 @@
170 return text.replace('\n', '<br />')
171 %>
172
173+ <%def name="address(partner, commercial_partner=None)">
174+ <%doc>
175+ XXX add a helper for address in report_webkit module as this won't be suported in v8.0
176+ </%doc>
177+ <% company_partner = False %>
178+ %if commercial_partner:
179+ %if commercial_partner.id != partner.id:
180+ <% company_partner = commercial_partner %>
181+ %endif
182+ %elif partner.parent_id:
183+ <% company_partner = partner.parent_id %>
184+ %endif
185+
186+ %if company_partner:
187+ <tr><td class="name">${company_partner.name or ''}</td></tr>
188+ <tr><td>${partner.title and partner.title.name or ''} ${partner.name}</td></tr>
189+ <% address_lines = partner.contact_address.split("\n")[1:] %>
190+ %else:
191+ <tr><td class="name">${partner.title and partner.title.name or ''} ${partner.name}</td></tr>
192+ <% address_lines = partner.contact_address.split("\n") %>
193+ %endif
194+ %for part in address_lines:
195+ % if part:
196+ <tr><td>${part}</td></tr>
197+ % endif
198+ %endfor
199+ </%def>
200+
201 %for inv in objects:
202 <% setLang(inv.partner_id.lang) %>
203 <div class="address">
204- %if hasattr(inv, 'commercial_partner_id'):
205- <table class="recipient">
206- %if inv.partner_id.id != inv.commercial_partner_id.id:
207- <tr><td class="name">${inv.commercial_partner_id.name or ''}</td></tr>
208- <tr><td>${inv.partner_id.title and inv.partner_id.title.name or ''} ${inv.partner_id.name }</td></tr>
209- %else:
210- <tr><td class="name">${inv.partner_id.title and inv.partner_id.title.name or ''} ${inv.partner_id.name }</td></tr>
211- %endif
212- %if inv.partner_id.parent_id:
213- <% address_lines = inv.partner_id.contact_address.split("\n")[1:] %>
214- %else:
215- <% address_lines = inv.partner_id.contact_address.split("\n") %>
216- %endif
217- %for part in address_lines:
218- %if part:
219- <tr><td>${part}</td></tr>
220- %endif
221- %endfor
222- </table>
223- %else:
224- <table class="recipient">
225- %if inv.partner_id.parent_id:
226- <tr><td class="name">${inv.partner_id.parent_id.name or ''}</td></tr>
227- <tr><td>${inv.partner_id.title and inv.partner_id.title.name or ''} ${inv.partner_id.name }</td></tr>
228- <% address_lines = inv.partner_id.contact_address.split("\n")[1:] %>
229- %else:
230- <tr><td class="name">${inv.partner_id.title and inv.partner_id.title.name or ''} ${inv.partner_id.name }</td></tr>
231- <% address_lines = inv.partner_id.contact_address.split("\n") %>
232- %endif
233- %for part in address_lines:
234- %if part:
235- <tr><td>${part}</td></tr>
236- %endif
237- %endfor
238- </table>
239- %endif
240+ <table class="recipient">
241+ %if hasattr(inv, 'commercial_partner_id'):
242+ ${address(partner=inv.partner_id, commercial_partner=inv.commercial_partner_id)}
243+ %else:
244+ ${address(partner=inv.partner_id)}
245+ %endif
246+ </table>
247 </div>
248 <h1 style="clear: both; padding-top: 20px;">
249 %if inv.type == 'out_invoice' and inv.state == 'proforma2':
250@@ -253,69 +288,92 @@
251 </table>
252
253 <div>
254- %if inv.note1 :
255+ %if inv.note1:
256 <p class="std_text"> ${inv.note1 | n} </p>
257 %endif
258 </div>
259
260- <table class="list_invoice_table" width="100%" style="margin-top: 20px;">
261- <thead>
262- <tr>
263- <th>${_("Description")}</th>
264- <th>${_("Qty")}</th>
265- <th>${_("UoM")}</th>
266- <th>${_("Unit Price")}</th>
267- <th>${_("Taxes")}</th>
268- <th>${_("Disc.(%)")}</th>
269- <th>${_("Net Sub Total")}</th>
270- </tr>
271- </thead>
272- <tbody>
273- %for line in inv.invoice_line :
274- <tr >
275- <td>${line.name or ''}</td>
276- <td class="amount">${formatLang(line.quantity or 0.0,digits=get_digits(dp='Account'))}</td>
277- <td class="amount">${line.uos_id and line.uos_id.name or ''}</td>
278- <td class="amount">${formatLang(line.price_unit)}</td>
279- <td style="font-style:italic; font-size: 10;text-align:center;" >${ ', '.join([ tax.description or tax.name for tax in line.invoice_line_tax_id ])}</td>
280- <td class="amount" width="10%">${line.discount and formatLang(line.discount, digits=get_digits(dp='Account')) or ''} ${line.discount and '%' or ''}</td>
281- <td class="amount" width="13%">${formatLang(line.price_subtotal, digits=get_digits(dp='Account'))} ${inv.currency_id.symbol}</td>
282- </tr>
283- %if line.formatted_note:
284- <tr>
285- <td class="formatted_note" colspan="7">
286- ${line.formatted_note| n}
287- </td>
288- </tr>
289- %endif
290+ <table class="list_main_table" width="100%">
291+ <thead>
292+ <tr>
293+ <th class="list_main_headers" style="width: 100%">
294+ <table style="width:100%">
295+ <tr>
296+ <th class="main_col1">${_("Description")}</th>
297+ <th class="amount main_col2">${_("Qty")}</th>
298+ <th class="amount main_col3">${_("UoM")}</th>
299+ <th class="amount main_col4">${_("Unit Price")}</th>
300+ <th class="main_col5">${_("Taxes")}</th>
301+ <th class="amount main_col6">${_("Disc.(%)")}</th>
302+ <th class="amount main_col7">${_("Net Sub Total")}</th>
303+ </tr>
304+ </table>
305+ </th>
306+ </tr>
307+ </thead>
308+ <tbody>
309+ %for line in inv.invoice_line:
310+ <tr>
311+ <td class="list_main_lines" style="width: 100%">
312+ <div class="nobreak">
313+ <table style="width:100%">
314+ <tr>
315+ <td class="main_col1">${line.product_id and line.product_id.code or ''} ${line.product_id and line.product_id.name or ''}</td>
316+ <td class="amount main_col2">${formatLang(line.quantity or 0.0,digits=get_digits(dp='Account'))}</td>
317+ <td class="amount main_col3">${line.uos_id and line.uos_id.name or ''}</td>
318+ <td class="amount main_col4">${formatLang(line.price_unit)}</td>
319+ <td class="main_col5">${ ', '.join([tax.description or tax.name for tax in line.invoice_line_tax_id])}</td>
320+ <td class="amount main_col6">${line.discount and formatLang(line.discount, digits=get_digits(dp='Account')) or ''} ${line.discount and '%' or ''}</td>
321+ <td class="amount main_col7">${formatLang(line.price_subtotal, digits=get_digits(dp='Account'))} ${inv.currency_id.symbol}</td>
322+ </tr>
323+ %if line.formatted_note:
324+ <caption class="formatted_note">
325+ ${line.formatted_note| n}
326+ </caption>
327+ %endif
328+ </table>
329+ </div>
330+ </td>
331+ </tr>
332 %endfor
333- </tbody>
334- <tfoot class="totals">
335- <tr>
336- <td colspan="6" style="text-align:right;border-right: thin solid #ffffff ;border-left: thin solid #ffffff ;">
337- <b>${_("Net :")}</b>
338- </td>
339- <td class="amount" style="border-right: thin solid #ffffff ;border-left: thin solid #ffffff ;">
340+ </tbody>
341+ <tfoot class="totals">
342+ <tr>
343+ <td class="list_main_footers" style="width: 100%">
344+ <div class="nobreak">
345+ <table style="width:100%">
346+ <tr>
347+ <td class="total_empty_cell"/>
348+ <th>
349+ ${_("Net :")}
350+ </th>
351+ <td class="amount total_sum_cell">
352 ${formatLang(inv.amount_untaxed, digits=get_digits(dp='Account'))} ${inv.currency_id.symbol}
353- </td>
354- </tr>
355- <tr class="no_bloc">
356- <td colspan="6" style="text-align:right; border-top: thin solid #ffffff ; border-right: thin solid #ffffff ;border-left: thin solid #ffffff ;">
357- <b>${_("Taxes:")}</b>
358- </td>
359- <td class="amount" style="border-right: thin solid #ffffff ;border-top: thin solid #ffffff ;border-left: thin solid #ffffff ;">
360- ${formatLang(inv.amount_tax, digits=get_digits(dp='Account'))} ${inv.currency_id.symbol}
361- </td>
362- </tr>
363- <tr>
364- <td colspan="6" style="border-right: thin solid #ffffff ;border-top: thin solid #ffffff ;border-left: thin solid #ffffff ;border-bottom: thin solid #ffffff ;text-align:right;">
365- <b>${_("Total:")}</b>
366- </td>
367- <td class="amount" style="border-right: thin solid #ffffff ;border-top: thin solid #ffffff ;border-left: thin solid #ffffff ;border-bottom: thin solid #ffffff ;">
368- <b>${formatLang(inv.amount_total, digits=get_digits(dp='Account'))} ${inv.currency_id.symbol}</b>
369- </td>
370- </tr>
371- </tfoot>
372+ </td>
373+ </tr>
374+ <tr>
375+ <td class="total_empty_cell"/>
376+ <th>
377+ ${_("Taxes:")}
378+ </th>
379+ <td class="amount total_sum_cell">
380+ ${formatLang(inv.amount_tax, digits=get_digits(dp='Account'))} ${inv.currency_id.symbol}
381+ </td>
382+ </tr>
383+ <tr>
384+ <td class="total_empty_cell"/>
385+ <th>
386+ ${_("Total:")}
387+ </th>
388+ <td class="amount total_sum_cell">
389+ <b>${formatLang(inv.amount_total, digits=get_digits(dp='Account'))} ${inv.currency_id.symbol}</b>
390+ </td>
391+ </tr>
392+ </table>
393+ </div>
394+ </td>
395+ </tr>
396+ </tfoot>
397 </table>
398 <br/>
399 <table class="list_total_table" width="60%" >
400@@ -375,13 +433,13 @@
401 %if inv.note2 :
402 <p class="std_text">${inv.note2 | n}</p>
403 %endif
404- %if inv.fiscal_position and inv.fiscal_position.note :
405+ %if inv.fiscal_position and inv.fiscal_position.note:
406 <br/>
407 <p class="std_text">
408 ${inv.fiscal_position.note | n}
409 </p>
410 %endif
411- <p style="page-break-after:always"></p>
412+ <p style="page-break-after:always"/>
413 %endfor
414 </body>
415 </html>

Subscribers

People subscribed via source and target branches