[MODULE] +v1.1.0 from https://www.odoo.com/apps/7.0/account_financial_report_webkit/
[burette/account_financial_report_webkit.git] / report / templates / account_report_partners_ledger.mako
1 ## -*- coding: utf-8 -*-
2 <!DOCTYPE html SYSTEM "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml">
4 <head>
5 <style type="text/css">
6 .overflow_ellipsis {
7 text-overflow: ellipsis;
8 overflow: hidden;
9 white-space: nowrap;
10 }
11
12 ${css}
13 </style>
14 </head>
15 <body>
16 <%!
17 def amount(text):
18 return text.replace('-', '&#8209;') # replace by a non-breaking hyphen (it will not word-wrap between hyphen and numbers)
19 %>
20
21 <%setLang(user.lang)%>
22
23 <%
24 initial_balance_text = {'initial_balance': _('Computed'), 'opening_balance': _('Opening Entries'), False: _('No')}
25 %>
26
27 <div class="act_as_table data_table">
28 <div class="act_as_row labels">
29 <div class="act_as_cell">${_('Chart of Account')}</div>
30 <div class="act_as_cell">${_('Fiscal Year')}</div>
31 <div class="act_as_cell">
32 %if filter_form(data) == 'filter_date':
33 ${_('Dates Filter')}
34 %else:
35 ${_('Periods Filter')}
36 %endif
37 </div>
38 <div class="act_as_cell">${_('Accounts Filter')}</div>
39 <div class="act_as_cell">${_('Target Moves')}</div>
40 <div class="act_as_cell">${_('Initial Balance')}</div>
41 </div>
42 <div class="act_as_row">
43 <div class="act_as_cell">${ chart_account.name }</div>
44 <div class="act_as_cell">${ fiscalyear.name if fiscalyear else '-' }</div>
45 <div class="act_as_cell">
46 ${_('From:')}
47 %if filter_form(data) == 'filter_date':
48 ${formatLang(start_date, date=True) if start_date else u'' }
49 %else:
50 ${start_period.name if start_period else u''}
51 %endif
52 ${_('To:')}
53 %if filter_form(data) == 'filter_date':
54 ${ formatLang(stop_date, date=True) if stop_date else u'' }
55 %else:
56 ${stop_period.name if stop_period else u'' }
57 %endif
58 </div>
59 <div class="act_as_cell">
60 %if partner_ids:
61 ${_('Custom Filter')}
62 %else:
63 ${ display_partner_account(data) }
64 %endif
65 </div>
66 <div class="act_as_cell">${ display_target_move(data) }</div>
67 <div class="act_as_cell">${ initial_balance_text[initial_balance_mode] }</div>
68 </div>
69 </div>
70
71 %for account in objects:
72 %if account.ledger_lines or account.init_balance:
73 <%
74 if not account.partners_order:
75 continue
76 account_total_debit = 0.0
77 account_total_credit = 0.0
78 account_balance_cumul = 0.0
79 account_balance_cumul_curr = 0.0
80 %>
81
82 <div class="account_title bg" style="width: 1080px; margin-top: 20px; font-size: 12px;">${account.code} - ${account.name}</div>
83
84 %for partner_name, p_id, p_ref, p_name in account.partners_order:
85 <%
86 total_debit = 0.0
87 total_credit = 0.0
88 cumul_balance = 0.0
89 cumul_balance_curr = 0.0
90
91 part_cumul_balance = 0.0
92 part_cumul_balance_curr = 0.0
93 %>
94 <div class="act_as_table list_table" style="margin-top: 5px;">
95 <div class="act_as_caption account_title">
96 ${partner_name or _('No Partner')}
97 </div>
98 <div class="act_as_thead">
99 <div class="act_as_row labels">
100 ## date
101 <div class="act_as_cell first_column" style="width: 50px;">${_('Date')}</div>
102 ## period
103 <div class="act_as_cell" style="width: 70px;">${_('Period')}</div>
104 ## move
105 <div class="act_as_cell" style="width: 100px;">${_('Entry')}</div>
106 ## journal
107 <div class="act_as_cell" style="width: 70px;">${_('Journal')}</div>
108 ## partner
109 <div class="act_as_cell" style="width: 100px;">${_('Partner')}</div>
110 ## move reference
111 <div class="act_as_cell" style="width: 60px;">${_('Reference')}</div>
112 ## label
113 <div class="act_as_cell" style="width: 280px;">${_('Label')}</div>
114 ## reconcile
115 <div class="act_as_cell" style="width: 80px;">${_('Rec.')}</div>
116 ## debit
117 <div class="act_as_cell amount" style="width: 80px;">${_('Debit')}</div>
118 ## credit
119 <div class="act_as_cell amount" style="width: 80px;">${_('Credit')}</div>
120 ## balance cumulated
121 <div class="act_as_cell amount" style="width: 80px;">${_('Cumul. Bal.')}</div>
122 %if amount_currency(data):
123 ## currency balance
124 <div class="act_as_cell amount sep_left" style="width: 80px;">${_('Curr. Balance')}</div>
125 ## curency code
126 <div class="act_as_cell amount" style="width: 30px; text-align: right;">${_('Curr.')}</div>
127 %endif
128 </div>
129 </div>
130 <div class="act_as_tbody">
131 <%
132 total_debit = account.init_balance.get(p_id, {}).get('debit') or 0.0
133 total_credit = account.init_balance.get(p_id, {}).get('credit') or 0.0
134 %>
135 %if initial_balance_mode and (total_debit or total_credit):
136 <%
137 part_cumul_balance = account.init_balance.get(p_id, {}).get('init_balance') or 0.0
138 part_cumul_balance_curr = account.init_balance.get(p_id, {}).get('init_balance_currency') or 0.0
139 balance_forward_currency = account.init_balance.get(p_id, {}).get('currency_name') or ''
140
141 cumul_balance += part_cumul_balance
142 cumul_balance_curr += part_cumul_balance_curr
143 %>
144 <div class="act_as_row initial_balance">
145 ## date
146 <div class="act_as_cell first_column"></div>
147 ## period
148 <div class="act_as_cell"></div>
149 ## move
150 <div class="act_as_cell"></div>
151 ## journal
152 <div class="act_as_cell"></div>
153 ## partner
154 <div class="act_as_cell"></div>
155 ## move reference
156 <div class="act_as_cell"></div>
157 ## label
158 <div class="act_as_cell" >${_('Initial Balance')}</div>
159 ## reconcile
160 <div class="act_as_cell"></div>
161 ## debit
162 <div class="act_as_cell amount">${formatLang(total_debit) | amount }</div>
163 ## credit
164 <div class="act_as_cell amount">${formatLang(total_credit) | amount }</div>
165 ## balance cumulated
166 <div class="act_as_cell amount" style="padding-right: 1px;">${formatLang(part_cumul_balance) | amount }</div>
167 %if amount_currency(data):
168 ## currency balance
169 <div class="act_as_cell sep_left amount">${formatLang(part_cumul_balance_curr) | amount }</div>
170 ## curency code
171 <div class="act_as_cell">${balance_forward_currency}</div>
172 %endif
173
174 </div>
175 %endif
176
177 %for line in account.ledger_lines.get(p_id, []):
178 <%
179 total_debit += line.get('debit') or 0.0
180 total_credit += line.get('credit') or 0.0
181
182 label_elements = [line.get('lname') or '']
183 if line.get('invoice_number'):
184 label_elements.append("(%s)" % (line['invoice_number'],))
185 label = ' '.join(label_elements)
186 %>
187 <div class="act_as_row lines">
188 ## date
189 <div class="act_as_cell first_column">${formatLang(line.get('ldate') or '', date=True)}</div>
190 ## period
191 <div class="act_as_cell">${line.get('period_code') or ''}</div>
192 ## move
193 <div class="act_as_cell">${line.get('move_name') or ''}</div>
194 ## journal
195 <div class="act_as_cell">${line.get('jcode') or ''}</div>
196 ## partner
197 <div class="act_as_cell overflow_ellipsis">${line.get('partner_name') or ''}</div>
198 ## move reference
199 <div class="act_as_cell">${line.get('lref') or ''}</div>
200 ## label
201 <div class="act_as_cell">${label}</div>
202 ## reconcile
203 <div class="act_as_cell">${line.get('rec_name') or ''}</div>
204 ## debit
205 <div class="act_as_cell amount">${formatLang(line.get('debit') or 0.0) | amount }</div>
206 ## credit
207 <div class="act_as_cell amount">${formatLang(line.get('credit') or 0.0) | amount }</div>
208 ## balance cumulated
209 <% cumul_balance += line.get('balance') or 0.0 %>
210 <div class="act_as_cell amount" style="padding-right: 1px;">${formatLang(cumul_balance) | amount }</div>
211 %if amount_currency(data):
212 ## currency balance
213 <div class="act_as_cell sep_left amount">${formatLang(line.get('amount_currency') or 0.0) | amount }</div>
214 ## curency code
215 <div class="act_as_cell" style="text-align: right; ">${line.get('currency_code') or ''}</div>
216 %endif
217 </div>
218 %endfor
219 <div class="act_as_row lines labels">
220 ## date
221 <div class="act_as_cell first_column"></div>
222 ## period
223 <div class="act_as_cell"></div>
224 ## move
225 <div class="act_as_cell"></div>
226 ## journal
227 <div class="act_as_cell"></div>
228 ## partner
229 <div class="act_as_cell"></div>
230 ## move reference
231 <div class="act_as_cell"></div>
232 ## label
233 <div class="act_as_cell">${_('Cumulated Balance on Partner')}</div>
234 ## reconcile
235 <div class="act_as_cell"></div>
236 ## debit
237 <div class="act_as_cell amount">${formatLang(total_debit) | amount }</div>
238 ## credit
239 <div class="act_as_cell amount">${formatLang(total_credit) | amount }</div>
240 ## balance cumulated
241 <div class="act_as_cell amount" style="padding-right: 1px;">${formatLang(cumul_balance) | amount }</div>
242 %if amount_currency(data):
243 ## currency balance
244 %if account.currency_id:
245 <div class="act_as_cell amount sep_left">${formatLang(cumul_balance_curr) | amount }</div>
246 %else:
247 <div class="act_as_cell sep_left amount">${ u'-' }</div>
248 %endif
249 ## currency code
250 <div class="act_as_cell" style="text-align: right; padding-right: 1px;">${ account.currency_id.name if account.currency_id else u'' }</div>
251 %endif
252 </div>
253 </div>
254 </div>
255 <%
256 account_total_debit += total_debit
257 account_total_credit += total_credit
258 account_balance_cumul += cumul_balance
259 account_balance_cumul_curr += cumul_balance_curr
260 %>
261 %endfor
262
263 <div class="act_as_table list_table" style="margin-top:5px;">
264 <div class="act_as_row labels" style="font-weight: bold; font-size: 12px;">
265 <div class="act_as_cell first_column" style="width: 450px;">${account.code} - ${account.name}</div>
266 ## label
267 <div class="act_as_cell" style="width: 360px;">${_("Cumulated Balance on Account")}</div>
268 ## debit
269 <div class="act_as_cell amount" style="width: 80px;">${ formatLang(account_total_debit) | amount }</div>
270 ## credit
271 <div class="act_as_cell amount" style="width: 80px;">${ formatLang(account_total_credit) | amount }</div>
272 ## balance cumulated
273 <div class="act_as_cell amount" style="width: 80px; padding-right: 1px;">${ formatLang(account_balance_cumul) | amount }</div>
274 %if amount_currency(data):
275 ## currency balance
276 %if account.currency_id:
277 <div class="act_as_cell amount sep_left" style="width: 80px;">${ formatLang(account_balance_cumul_curr) | amount }</div>
278 %else:
279 <div class="act_as_cell amount sep_left" style="width: 80px;">${ u'-' }</div>
280 %endif
281 ## curency code
282 <div class="act_as_cell amount" style="width: 30px; text-align: right; padding-right: 1px;">${ account.currency_id.name if account.currency_id else u'' }</div>
283 %endif
284 </div>
285 </div>
286 </div>
287 %endif
288 %endfor
289 </body>
290 </html>