diff --git a/CHANGELOG b/CHANGELOG index dfaf2276b7..5071dcb760 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,4 @@ +* Allow to open accounts from balance sheet * Add start/end balance to Trial balance Version 2.4.0 - 2012-04-23 diff --git a/account.py b/account.py index e0aea288bc..ad813ca771 100644 --- a/account.py +++ b/account.py @@ -335,6 +335,25 @@ class Type(ModelSQL, ModelView): Type() +class OpenType(Wizard): + 'Open Type' + _name = 'account.account.open_type' + start_state = 'open_' + open_ = StateAction('account.act_account_list2') + + def do_open_(self, session, action): + action['pyson_domain'] = PYSONEncoder().encode([ + ('type', '=', Transaction().context['active_id']), + ]) + action['pyson_context'] = PYSONEncoder().encode({ + 'date': Transaction().context.get('date'), + 'posted': Transaction().context.get('posted'), + }) + return action, {} + +OpenType() + + class AccountTemplate(ModelSQL, ModelView): 'Account Template' _name = 'account.account.template' diff --git a/account.xml b/account.xml index 2e95720b91..153e41f4a4 100644 --- a/account.xml +++ b/account.xml @@ -674,6 +674,44 @@ this repository contains the full copyright notices and license terms. --> action="act_account_list" id="menu_account_list" sequence="10"/> + + account.account + tree + + + + + + + + + + + ]]> + + + + Accounts + account.account + + + + + + + + + Open Type + account.account.open_type + account.account.type + + + tree_open + account.account.type,-1 + + + account.account tree @@ -849,7 +887,7 @@ this repository contains the full copyright notices and license terms. --> childs + diff --git a/move.py b/move.py index 6dd02f9a37..c09d716029 100644 --- a/move.py +++ b/move.py @@ -1450,6 +1450,9 @@ class OpenAccount(Wizard): ] if Transaction().context.get('posted'): action['pyson_domain'].append(('move.state', '=', 'posted')) + if Transaction().context.get('date'): + action['pyson_domain'].append(('move.date', '<=', + Transaction().context['date'])) action['pyson_domain'] = PYSONEncoder().encode(action['pyson_domain']) action['pyson_context'] = PYSONEncoder().encode({ 'fiscalyear': Transaction().context.get('fiscalyear'),