Skip to content

Commit

Permalink
[FIX]Accounting: filter on fiscal year in CoA tree
Browse files Browse the repository at this point in the history
  • Loading branch information
pna-odoo authored and rim-odoo committed Jun 19, 2014
1 parent 088eead commit 788404c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 2 additions & 0 deletions addons/account/account_move_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -741,6 +741,8 @@ def onchange_account_id(self, cr, uid, ids, account_id=False, partner_id=False,
def search(self, cr, uid, args, offset=0, limit=None, order=None, context=None, count=False):
if context is None:
context = {}
if context.get('fiscalyear'):
args.append(('period_id.fiscalyear_id', '=', context.get('fiscalyear', False)))
if context and context.get('next_partner_only', False):
if not context.get('partner_id', False):
partner = self.list_partners_to_reconcile(cr, uid, context=context)
Expand Down
2 changes: 1 addition & 1 deletion addons/account/account_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@
<act_window
id="action_account_items"
name="Journal Items"
context="{'search_default_account_id': [active_id]}"
context="{'search_default_account_id': [active_id], 'fiscalyear': context.get('fiscalyear')}"
res_model="account.move.line"
src_model="account.account"
key2="tree_but_open"/>
Expand Down
5 changes: 3 additions & 2 deletions addons/account/wizard/account_chart.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,10 @@ def onchange_fiscalyear(self, cr, uid, ids, fiscalyear_id=False, context=None):
ORDER BY p.date_stop DESC
LIMIT 1) AS period_stop''', (fiscalyear_id, fiscalyear_id))
periods = [i[0] for i in cr.fetchall()]
if periods and len(periods) > 1:
if periods:
start_period = periods[0]
end_period = periods[1]
if len(periods) > 1:
end_period = periods[1]
res['value'] = {'period_from': start_period, 'period_to': end_period}
else:
res['value'] = {'period_from': False, 'period_to': False}
Expand Down

0 comments on commit 788404c

Please sign in to comment.