Merge lp:~unifield-team/unifield-addons/us-822-addons into lp:unifield-addons
- us-822-addons
- Merge into trunk
Proposed by
jftempo
Status: | Merged |
---|---|
Merged at revision: | 4683 |
Proposed branch: | lp:~unifield-team/unifield-addons/us-822-addons |
Merge into: | lp:unifield-addons |
Diff against target: |
522 lines (+204/-84) 5 files modified
account/account_move_line.py (+12/-0) account/report/account_general_ledger.py (+88/-62) account/report/account_general_ledger_xls.mako (+5/-5) account/wizard/account_report_general_ledger.py (+76/-3) account/wizard/account_report_general_ledger_view.xml (+23/-14) |
To merge this branch: | bzr merge lp:~unifield-team/unifield-addons/us-822-addons |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
UniField Reviewer Team | Pending | ||
Review via email: mp+283761@code.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'account/account_move_line.py' |
2 | --- account/account_move_line.py 2015-10-13 08:21:14 +0000 |
3 | +++ account/account_move_line.py 2016-01-25 08:54:18 +0000 |
4 | @@ -106,6 +106,18 @@ |
5 | child_ids = account_obj._get_children_and_consol(cr, uid, [context['chart_account_id']], context=context) |
6 | query += ' AND '+obj+'.account_id IN (%s)' % ','.join(map(str, child_ids)) |
7 | |
8 | + if not context.get('period0', False): |
9 | + # US-822: by default in reports always not include period 0 (IB journals) |
10 | + domain = [('number', '=', 0)] |
11 | + if fiscalyear_ids: |
12 | + domain += [('fiscalyear_id', 'in', fiscalyear_ids)] |
13 | + periods_ids = fiscalperiod_obj.search(cr, uid, domain, context={'show_period_0': 1}) |
14 | + if periods_ids: |
15 | + query += ' AND %s.period_id not in (%s)' % (obj, ','.join(map(str, periods_ids)), ) |
16 | + |
17 | + if context.get('state_agnostic', False): |
18 | + query = query.replace(obj+".state <> 'draft' AND ", '') |
19 | + |
20 | query += company_clause |
21 | return query |
22 | |
23 | |
24 | === modified file 'account/report/account_general_ledger.py' |
25 | --- account/report/account_general_ledger.py 2016-01-20 14:07:43 +0000 |
26 | +++ account/report/account_general_ledger.py 2016-01-25 08:54:18 +0000 |
27 | @@ -46,7 +46,12 @@ |
28 | used_context = data['form'].get('used_context',{}) |
29 | self.query = obj_move._query_get(self.cr, self.uid, obj='l', context=used_context) |
30 | ctx2 = data['form'].get('used_context',{}).copy() |
31 | - ctx2.update({'initial_bal': True}) |
32 | + #ctx2.update({'initial_bal': True}) |
33 | + ctx2.update({'period0': 1, 'show_period_0': 1, 'state_agnostic': 1, }) |
34 | + if 'chart_account_id' in ctx2: |
35 | + del ctx2['chart_account_id'] # US-822: IB period 0 journals entries |
36 | + if 'journal_ids' in ctx2: |
37 | + del ctx2['journal_ids'] # US-822: IB period 0 journals entries |
38 | self.init_query = obj_move._query_get(self.cr, self.uid, obj='l', context=ctx2) |
39 | self.init_balance = data['form']['initial_balance'] |
40 | self.display_account = data['form']['display_account'] |
41 | @@ -196,6 +201,7 @@ |
42 | 'get_show_move_lines': self.get_show_move_lines, |
43 | 'get_ccy_label': self.get_ccy_label, |
44 | 'get_title': self._get_title, |
45 | + 'get_initial_balance': self._get_initial_balance, |
46 | }) |
47 | |
48 | # company currency |
49 | @@ -224,13 +230,6 @@ |
50 | self.cr.execute(sql % (account.id, self.query, )) |
51 | sum_currency = self.cr.fetchone()[0] or 0.0 |
52 | |
53 | - if self.init_balance: |
54 | - sql = 'SELECT sum(l.amount_currency) AS tot_currency \ |
55 | - FROM account_move_line l \ |
56 | - WHERE l.account_id = %s AND %s ' + reconcile_pattern |
57 | - self.cr.execute(sql % (account.id, self.init_query, )) |
58 | - sum_currency += self.cr.fetchone()[0] or 0.0 |
59 | - |
60 | return sum_currency |
61 | |
62 | def _get_journals_str(self, data): |
63 | @@ -238,7 +237,7 @@ |
64 | return _('All Journals') |
65 | return ', '.join(self._get_journal(data)) |
66 | |
67 | - def get_currencies(self, account=False): |
68 | + def get_currencies(self, account=False, include_with_ib=False): |
69 | res = [] |
70 | |
71 | sql = """ |
72 | @@ -249,7 +248,22 @@ |
73 | if account: |
74 | sql += " and l.account_id=%d" % (account.id, ) |
75 | self.cr.execute(sql) |
76 | - rows = self.cr.fetchall() |
77 | + rows = self.cr.fetchall() or [] |
78 | + |
79 | + if include_with_ib and self.init_balance: |
80 | + sql = """ |
81 | + SELECT DISTINCT(l.currency_id) |
82 | + FROM account_move_line AS l |
83 | + WHERE %s |
84 | + """ % (self.init_query) |
85 | + if account: |
86 | + sql += " and l.account_id=%d" % (account.id, ) |
87 | + self.cr.execute(sql) |
88 | + ib_rows = self.cr.fetchall() or [] |
89 | + if ib_rows: |
90 | + rows += ib_rows |
91 | + rows = list(set(rows)) |
92 | + |
93 | if rows: |
94 | rc_obj = self.pool.get('res.currency') |
95 | ordered_ids = rc_obj.search(self.cr, self.uid, [ |
96 | @@ -260,7 +274,7 @@ |
97 | return res |
98 | |
99 | def get_currencies_account_subtotals(self, account): |
100 | - ccy_brs = self.get_currencies(account=account) |
101 | + ccy_brs = self.get_currencies(account=account, include_with_ib=True) |
102 | res = [] |
103 | |
104 | if ccy_brs: |
105 | @@ -269,16 +283,16 @@ |
106 | 'account_code': account and account.code or '', |
107 | 'ccy_name': ccy.name or ccy.code or '', |
108 | 'debit': self._sum_debit_account(account, ccy=ccy, |
109 | - booking=True), |
110 | + booking=True, is_sub_total=True), |
111 | 'credit': self._sum_credit_account(account, ccy=ccy, |
112 | - booking=True), |
113 | + booking=True, is_sub_total=True), |
114 | 'bal': self._sum_balance_account(account, ccy=ccy, |
115 | - booking=True), |
116 | + booking=True, is_sub_total=True), |
117 | } |
118 | # append the line if amount (and compute functional bal) |
119 | if line['debit'] or line['credit'] or line['bal']: |
120 | line['bal_func'] = self._sum_balance_account(account, |
121 | - ccy=ccy, booking=False), |
122 | + ccy=ccy, booking=False, is_sub_total=True), |
123 | res.append(line) |
124 | return res |
125 | |
126 | @@ -395,35 +409,35 @@ |
127 | " AND reconcile_id is null and ac.reconcile ='t'" or '') |
128 | self.cr.execute(sql, (account.id,)) |
129 | res_lines = self.cr.dictfetchall() |
130 | + |
131 | res_init = [] |
132 | - if res_lines and self.init_balance: |
133 | - #FIXME: replace the label of lname with a string translatable |
134 | + if self.init_balance: |
135 | + # US-822: move lines for period 0 IB journal |
136 | + sql_sort = 'l.move_id' |
137 | sql = """ |
138 | - SELECT 0 AS lid, '' AS ldate, '' AS lcode, |
139 | - COALESCE(SUM(l.amount_currency),0.0) AS amount_currency, |
140 | - '' AS lref, |
141 | - 'Initial Balance' AS lname, COALESCE(SUM(l.debit),0.0) AS debit, |
142 | - COALESCE(SUM(l.credit),0.0) AS credit,COALESCE(SUM(l.debit_currency),0.0) AS debit_currency, |
143 | - COALESCE(SUM(l.credit_currency),0.0) AS credit_currency, '' AS lperiod_id, '' AS lpartner_id, |
144 | - '' AS move_name, '' AS mmove_id, '' AS period_code, |
145 | - '' AS currency_code, |
146 | - NULL AS currency_id, |
147 | - '' AS invoice_id, '' AS invoice_type, '' AS invoice_number, |
148 | + SELECT l.id AS lid, l.date AS ldate, j.code AS lcode, l.currency_id, |
149 | + l.amount_currency,l.ref AS lref, l.name AS lname, |
150 | + COALESCE(l.debit,0) AS debit, COALESCE(l.credit,0) AS credit, |
151 | + COALESCE(l.debit_currency,0) as debit_currency, |
152 | + COALESCE(l.credit_currency,0) as credit_currency, |
153 | + l.period_id AS lperiod_id, '' AS lpartner_id, |
154 | + m.name AS move_name, m.id AS mmove_id, |
155 | + per.code as period_code, c.symbol AS currency_code, |
156 | + '' AS invoice_id, '' invoice_type, |
157 | + '' AS invoice_number, |
158 | '' AS partner_name, c.name as currency_name |
159 | FROM account_move_line l |
160 | - LEFT JOIN account_move m on (l.move_id=m.id) |
161 | + JOIN account_move m on (l.move_id=m.id) |
162 | LEFT JOIN res_currency c on (l.currency_id=c.id) |
163 | LEFT JOIN res_partner p on (l.partner_id=p.id) |
164 | - LEFT JOIN account_invoice i on (m.id =i.move_id) |
165 | + LEFT JOIN account_period per on (per.id=l.period_id) |
166 | LEFT JOIN account_account ac on (ac.id=l.account_id) |
167 | - JOIN account_journal j on (l.journal_id=j.id) |
168 | - WHERE %s AND m.state IN %s AND l.account_id = %%s{{reconcile}} |
169 | - """ %(self.init_query, tuple(move_state)) |
170 | - sql = sql.replace('{{reconcile}}', |
171 | - self.unreconciled_filter and \ |
172 | - " AND reconcile_id is null and ac.reconcile ='t'" or '') |
173 | - self.cr.execute(sql, (account.id,)) |
174 | + JOIN account_journal j on (l.journal_id=j.id) |
175 | + WHERE %s AND l.account_id = %%s and per.number = 0 ORDER by %s |
176 | + """ % (self.init_query, sql_sort, ) |
177 | + self.cr.execute(sql, (account.id, )) |
178 | res_init = self.cr.dictfetchall() |
179 | + |
180 | res = res_init + res_lines |
181 | account_sum = 0.0 |
182 | for l in res: |
183 | @@ -466,8 +480,6 @@ |
184 | else: |
185 | raise osv.except_osv(_('Error'), _('Mode not supported')) |
186 | |
187 | - query = self.init_query if initial_balance else self.query |
188 | - |
189 | if ccy: |
190 | ccy_pattern = " AND l.currency_id = %d" % (ccy.id, ) |
191 | else: |
192 | @@ -480,18 +492,35 @@ |
193 | JOIN account_move am ON (am.id = l.move_id) \ |
194 | WHERE (l.account_id = %s) \ |
195 | AND (am.state IN %s) \ |
196 | - AND ' + query + ' ' + ccy_pattern + reconcile_pattern |
197 | + AND ' + self.query + ' ' + ccy_pattern + reconcile_pattern |
198 | sql = sql.replace('{field}', field).replace( |
199 | '{booking}', '_currency' if booking else '') |
200 | |
201 | self.cr.execute(sql, (account.id, tuple(move_state), )) |
202 | - return self.cr.fetchone()[0] or 0.0 |
203 | - |
204 | - def _sum_debit_account(self, account, ccy=False, booking=False): |
205 | + res = self.cr.fetchone()[0] or 0.0 |
206 | + |
207 | + if initial_balance: |
208 | + # US-822 include inital balance at ccy subtotal line level |
209 | + sql = 'SELECT {field} \ |
210 | + FROM account_move_line l \ |
211 | + JOIN account_move am ON (am.id = l.move_id) \ |
212 | + LEFT JOIN account_period per ON (per.id = l.period_id) \ |
213 | + WHERE (l.account_id = %s) and per.number = 0 \ |
214 | + AND ' + self.init_query + ' ' + ccy_pattern |
215 | + sql = sql.replace('{field}', field).replace( |
216 | + '{booking}', '_currency' if booking else '') |
217 | + self.cr.execute(sql, (account.id, )) |
218 | + res += self.cr.fetchone()[0] or 0.0 |
219 | + |
220 | + return res |
221 | + |
222 | + def _sum_debit_account(self, account, ccy=False, booking=False, |
223 | + is_sub_total=False): |
224 | """ |
225 | - ccy: filter ccy entries |
226 | - booking: not applicable for view accounts (used for account total lines |
227 | + :param ccy: filter ccy entries |
228 | + :param booking: not applicable for view accounts (used for account total lines |
229 | by ccy) |
230 | + :param is_sub_total: is a sub total line ? (per ccy) |
231 | """ |
232 | is_view, amount = self.__sum_amount_account_check_view(account, |
233 | 'debit', ccy=ccy) |
234 | @@ -504,17 +533,15 @@ |
235 | |
236 | amount = self.__sum_amount_account(account, move_state, 'debit', |
237 | ccy=ccy, booking=booking, initial_balance=False) |
238 | - if not ccy and self.init_balance: |
239 | - # add initial balance (except for booking ccy breakdown subtotals) |
240 | - amount += self.__sum_amount_account(account, move_state, 'debit', |
241 | - ccy=ccy, booking=booking, initial_balance=True) |
242 | return self._currency_conv(amount) |
243 | |
244 | - def _sum_credit_account(self, account, ccy=False, booking=False): |
245 | + def _sum_credit_account(self, account, ccy=False, booking=False, |
246 | + is_sub_total=False): |
247 | """ |
248 | - ccy: filter ccy entries |
249 | - booking: not applicable for view accounts (used for account total lines |
250 | + :param ccy: filter ccy entries |
251 | + :param booking: not applicable for view accounts (used for account total lines |
252 | by ccy) |
253 | + :param is_sub_total: is a sub total line ? (per ccy) |
254 | """ |
255 | is_view, amount = self.__sum_amount_account_check_view(account, |
256 | 'credit', ccy=ccy) |
257 | @@ -527,17 +554,15 @@ |
258 | |
259 | amount = self.__sum_amount_account(account, move_state, 'credit', |
260 | ccy=ccy, booking=booking, initial_balance=False) |
261 | - if not ccy and self.init_balance: |
262 | - # add initial balance (except for booking ccy breakdown subtotals) |
263 | - amount += self.__sum_amount_account(account, move_state, 'credit', |
264 | - ccy=ccy, booking=booking, initial_balance=True) |
265 | return self._currency_conv(amount) |
266 | |
267 | - def _sum_balance_account(self, account, ccy=False, booking=False): |
268 | + def _sum_balance_account(self, account, ccy=False, booking=False, |
269 | + is_sub_total=False): |
270 | """ |
271 | - ccy: filter ccy entries |
272 | - booking: not applicable for view accounts (used for account total lines |
273 | + :param ccy: filter ccy entries |
274 | + :param booking: not applicable for view accounts (used for account total lines |
275 | by ccy) |
276 | + :param is_sub_total: is a sub total line ? (per ccy) |
277 | """ |
278 | is_view, amount = self.__sum_amount_account_check_view(account, |
279 | 'balance', ccy=ccy) |
280 | @@ -553,11 +578,9 @@ |
281 | if self.target_move == 'posted': |
282 | move_state = ['posted',''] |
283 | |
284 | + initial_balance = self.init_balance and is_sub_total and ccy or False |
285 | amount = self.__sum_amount_account(account, move_state, 'balance', |
286 | - ccy=ccy, booking=booking, initial_balance=False) |
287 | - if self.init_balance: # add initial balance |
288 | - amount += self.__sum_amount_account(account, move_state, 'balance', |
289 | - ccy=ccy, booking=booking, initial_balance=True) |
290 | + ccy=ccy, booking=booking, initial_balance=initial_balance) |
291 | return self._currency_conv(amount) |
292 | |
293 | def _get_account(self, data): |
294 | @@ -695,6 +718,9 @@ |
295 | if hasattr(self, 'title'): |
296 | return self.title or '' |
297 | return '' |
298 | + |
299 | + def _get_initial_balance(self): |
300 | + return self.init_balance |
301 | |
302 | #report_sxw.report_sxw('report.account.general.ledger', 'account.account', 'addons/account/report/account_general_ledger.rml', parser=general_ledger, header='internal') |
303 | report_sxw.report_sxw('report.account.general.ledger_landscape', 'account.account', 'addons/account/report/account_general_ledger_landscape.rml', parser=general_ledger, header='internal landscape') |
304 | |
305 | === modified file 'account/report/account_general_ledger_xls.mako' |
306 | --- account/report/account_general_ledger_xls.mako 2015-11-16 16:01:21 +0000 |
307 | +++ account/report/account_general_ledger_xls.mako 2016-01-25 08:54:18 +0000 |
308 | @@ -329,11 +329,11 @@ |
309 | </Row> |
310 | % endfor |
311 | |
312 | -% for c in get_currencies(o): |
313 | +% for c in get_currencies(o, include_with_ib=True): |
314 | <% |
315 | -debit = sum_debit_account(o, ccy=c, booking=True) |
316 | -credit = sum_credit_account(o, ccy=c, booking=True) |
317 | -bal = sum_balance_account(o, ccy=c, booking=True) |
318 | +debit = sum_debit_account(o, ccy=c, booking=True, is_sub_total=True) |
319 | +credit = sum_credit_account(o, ccy=c, booking=True, is_sub_total=True) |
320 | +bal = sum_balance_account(o, ccy=c, booking=True, is_sub_total=True) |
321 | show_line = debit or credit or bal |
322 | %> |
323 | % if show_line: |
324 | @@ -354,7 +354,7 @@ |
325 | <Data ss:Type="Number">${bal}</Data> |
326 | </Cell> |
327 | <Cell ss:StyleID="ssNumber${ccy_sub_total_style_suffix}"> |
328 | - <Data ss:Type="Number">${sum_balance_account(o, ccy=c, booking=False)}</Data> |
329 | + <Data ss:Type="Number">${sum_balance_account(o, ccy=c, booking=False, is_sub_total=True)}</Data> |
330 | </Cell> |
331 | </Row> |
332 | % endif |
333 | |
334 | === modified file 'account/wizard/account_report_general_ledger.py' |
335 | --- account/wizard/account_report_general_ledger.py 2015-11-16 16:01:21 +0000 |
336 | +++ account/wizard/account_report_general_ledger.py 2016-01-25 08:54:18 +0000 |
337 | @@ -26,9 +26,20 @@ |
338 | _name = "account.report.general.ledger" |
339 | _description = "General Ledger Report" |
340 | |
341 | + def _get_fake(self, cr, uid, ids, name, args, context=None): |
342 | + res = {} |
343 | + if not ids: |
344 | + return res |
345 | + if isinstance(ids, (int, long)): |
346 | + ids = [ids] |
347 | + for id in ids: |
348 | + res[id] = False |
349 | + return res |
350 | + |
351 | _columns = { |
352 | 'initial_balance': fields.boolean("Include initial balances", |
353 | help='It adds initial balance row on report which display previous sum amount of debit/credit/balance'), |
354 | + 'is_initial_balance_available': fields.function(_get_fake, method=True, type='boolean', string="Is initial balance filter available ?"), |
355 | 'amount_currency': fields.boolean("With Currency", help="It adds the currency column if the currency is different then the company currency"), |
356 | 'sortby': fields.selection([('sort_date', 'Date'), ('sort_journal_partner', 'Journal & Partner')], 'Sort By', required=True), |
357 | 'output_currency': fields.many2one('res.currency', 'Output Currency', required=True), |
358 | @@ -71,6 +82,7 @@ |
359 | 'journal_ids': _get_journals, # exclude extra-accounting journals from this report (IKD, ODX) |
360 | 'account_type': 'all', |
361 | 'unreconciled': False, |
362 | + 'is_initial_balance_available': True, |
363 | } |
364 | |
365 | def default_get(self, cr, uid, fields, context=None): |
366 | @@ -82,9 +94,55 @@ |
367 | return res |
368 | |
369 | def onchange_fiscalyear(self, cr, uid, ids, fiscalyear=False, context=None): |
370 | + res = { |
371 | + 'value': { |
372 | + 'is_initial_balance_available': fiscalyear or False, |
373 | + }, |
374 | + } |
375 | + return res |
376 | + |
377 | + def onchange_filter(self, cr, uid, ids, fiscalyear_id=False, context=None): |
378 | + res = super(account_report_general_ledger, self).onchange_filter(cr, |
379 | + uid, ids, fiscalyear_id=fiscalyear_id, context=context) |
380 | + if res is None: |
381 | + res = {} |
382 | + if not 'value' in res: |
383 | + res['value'] = { |
384 | + 'is_initial_balance_available': fiscalyear_id or False, |
385 | + } |
386 | + else: |
387 | + res['value']['is_initial_balance_available'] = \ |
388 | + fiscalyear_id or False |
389 | + return res |
390 | + |
391 | + def onchange_filter_date(self, cr, uid, ids, filter, fiscalyear_id, |
392 | + date_from, date_to, period_from, period_to, context=None): |
393 | + # US-822: initial balance available if FY/01/01 included in the |
394 | + # date selection (posting date of initial balance) |
395 | + # AND if only one FY included in the selection |
396 | + # as we can't sum both balances and aggregated balances of period 0 |
397 | res = {} |
398 | - if not fiscalyear: |
399 | - res['value'] = {'initial_balance': False} |
400 | + ib_available = fiscalyear_id or False |
401 | + if ib_available and filter and filter != 'filter_no': |
402 | + fy_rec = self.pool.get('account.fiscalyear').browse(cr, uid, |
403 | + fiscalyear_id, context=context) |
404 | + if filter in ('filter_date_doc', 'filter_date', ): |
405 | + ib_available = date_from and date_to \ |
406 | + and date_from == fy_rec.date_start \ |
407 | + and date_to <= fy_rec.date_stop |
408 | + elif filter in 'filter_period': |
409 | + if not period_from or not period_to: |
410 | + ib_available = False |
411 | + else: |
412 | + period_from_rec = self.pool.get('account.period').browse(cr, |
413 | + uid, period_from, context=context) |
414 | + period_to_rec = self.pool.get('account.period').browse(cr, |
415 | + uid, period_to, context=context) |
416 | + ib_available = \ |
417 | + period_from_rec.date_start == fy_rec.date_start \ |
418 | + and period_to_rec.date_stop <= fy_rec.date_stop |
419 | + |
420 | + res['value'] = {'is_initial_balance_available': ib_available, } |
421 | return res |
422 | |
423 | def remove_journals(self, cr, uid, ids, context=None): |
424 | @@ -94,6 +152,10 @@ |
425 | return {} |
426 | |
427 | def _print_report(self, cr, uid, ids, data, context=None): |
428 | + if not ids: |
429 | + return |
430 | + if isinstance(ids, (int, long, )): |
431 | + ids = [ids] |
432 | if context is None: |
433 | context = {} |
434 | data = self.pre_print_report(cr, uid, ids, data, context=context) |
435 | @@ -104,6 +166,18 @@ |
436 | 'account_type', 'unreconciled', 'account_ids', ] |
437 | data['form'].update(self.read(cr, uid, ids, form_fields)[0]) |
438 | |
439 | + # US-822: safe initial balance check box |
440 | + rec = self.browse(cr, uid, ids[0], context=context) |
441 | + ofd_res = self.onchange_filter_date(cr, uid, [ids[0]], |
442 | + rec.filter, rec.fiscalyear_id.id, |
443 | + rec.date_from, rec.date_to, |
444 | + rec.period_from.id, rec.period_to.id, context=context) |
445 | + if ofd_res and 'value' in ofd_res \ |
446 | + and not ofd_res['value'].get('is_initial_balance_available', True): |
447 | + # initial balance not applicable |
448 | + # (check onchange_filter_date comments) |
449 | + data['form']['initial_balance'] = False |
450 | + |
451 | if not data['form']['fiscalyear_id']:# GTK client problem onchange does not consider in save record |
452 | data['form']['initial_balance'] = False |
453 | |
454 | @@ -125,7 +199,6 @@ |
455 | 'report_name': 'account.general.ledger_landscape', |
456 | 'datas': data, |
457 | } |
458 | - |
459 | |
460 | account_report_general_ledger() |
461 | |
462 | |
463 | === modified file 'account/wizard/account_report_general_ledger_view.xml' |
464 | --- account/wizard/account_report_general_ledger_view.xml 2015-10-16 12:35:31 +0000 |
465 | +++ account/wizard/account_report_general_ledger_view.xml 2016-01-25 08:54:18 +0000 |
466 | @@ -14,9 +14,10 @@ |
467 | <label nolabel="1" colspan="4" string="This report allows you to print or generate a pdf of your general ledger with details of all your account journals"/> |
468 | </xpath> |
469 | <xpath expr="//field[@name='target_move']" position="after"> |
470 | + <field name="is_initial_balance_available" invisible="1"/> |
471 | <field name="display_account"/> |
472 | <field name="sortby" invisible="1" /> |
473 | - <field name="initial_balance" attrs="{'readonly':[('fiscalyear_id','=', False)]}"/> |
474 | + <field name="initial_balance" attrs="{'readonly':[('is_initial_balance_available', '=', False)]}" /> |
475 | <field name="export_format"/> |
476 | <newline/> |
477 | <field name="output_currency" invisible="1" /> |
478 | @@ -60,23 +61,31 @@ |
479 | </field> |
480 | </page> |
481 | </xpath> |
482 | - |
483 | + |
484 | + <field name="fiscalyear_id" position="replace"> |
485 | + <field name="fiscalyear_id" on_change="onchange_fiscalyear(fiscalyear_id)"/> |
486 | + </field> |
487 | + |
488 | + <xpath expr="/form//field[@name='filter']" position="attributes"> |
489 | + <attribute name="on_change">onchange_filter(filter, fiscalyear_id)</attribute> |
490 | + </xpath> |
491 | + <xpath expr="/form//field[@name='date_from']" position="attributes"> |
492 | + <attribute name="on_change">onchange_filter_date(filter, fiscalyear_id, date_from, date_to, period_from, period_to)</attribute> |
493 | + </xpath> |
494 | + <xpath expr="/form//field[@name='date_to']" position="attributes"> |
495 | + <attribute name="on_change">onchange_filter_date(filter, fiscalyear_id, date_from, date_to, period_from, period_to)</attribute> |
496 | + </xpath> |
497 | + <xpath expr="/form//field[@name='period_from']" position="attributes"> |
498 | + <attribute name="on_change">onchange_filter_date(filter, fiscalyear_id, date_from, date_to, period_from, period_to)</attribute> |
499 | + </xpath> |
500 | + <xpath expr="/form//field[@name='period_to']" position="attributes"> |
501 | + <attribute name="on_change">onchange_filter_date(filter, fiscalyear_id, date_from, date_to, period_from, period_to)</attribute> |
502 | + </xpath> |
503 | + |
504 | </data> |
505 | </field> |
506 | </record> |
507 | |
508 | - <record id="account_report_general_ledger_view_inherit" model="ir.ui.view"> |
509 | - <field name="name">General Ledger</field> |
510 | - <field name="model">account.report.general.ledger</field> |
511 | - <field name="type">form</field> |
512 | - <field name="inherit_id" ref="account_report_general_ledger_view" /> |
513 | - <field name="arch" type="xml"> |
514 | - <field name="fiscalyear_id" position="replace"> |
515 | - <field name="fiscalyear_id" on_change="onchange_fiscalyear(fiscalyear_id)"/> |
516 | - </field> |
517 | - </field> |
518 | - </record> |
519 | - |
520 | <record id="action_account_general_ledger_menu" model="ir.actions.act_window"> <!-- rename id --> |
521 | <field name="name">General Ledger</field> |
522 | <field name="type">ir.actions.act_window</field> |