Allow to open accounts from balance sheet

review448001
This commit is contained in:
Cédric Krier
2012-08-16 15:55:45 +02:00
parent 3f3531b4c3
commit c9917637af
4 changed files with 62 additions and 1 deletions
+1
View File
@@ -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
+19
View File
@@ -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'
+39 -1
View File
@@ -674,6 +674,44 @@ this repository contains the full copyright notices and license terms. -->
action="act_account_list" id="menu_account_list"
sequence="10"/>
<record model="ir.ui.view" id="account_view_list2">
<field name="model">account.account</field>
<field name="type">tree</field>
<field name="priority" eval="20"/>
<field name="arch" type="xml">
<![CDATA[
<tree string="Accounts" keyword_open="1">
<field name="name"/>
<field name="code"/>
<field name="debit"/>
<field name="credit"/>
<field name="balance"/>
<field name="currency"/>
</tree>
]]>
</field>
</record>
<record model="ir.action.act_window" id="act_account_list2">
<field name="name">Accounts</field>
<field name="res_model">account.account</field>
</record>
<record model="ir.action.act_window.view" id="act_account_list2_view1">
<field name="sequence" eval="10"/>
<field name="view" ref="account_view_list2"/>
<field name="act_window" ref="act_account_list2"/>
</record>
<record model="ir.action.wizard" id="act_open_type">
<field name="name">Open Type</field>
<field name="wiz_name">account.account.open_type</field>
<field name="model">account.account.type</field>
</record>
<record model="ir.action.keyword" id="act_open_type_keyword">
<field name="keyword">tree_open</field>
<field name="model">account.account.type,-1</field>
<field name="action" ref="act_open_type"/>
</record>
<record model="ir.ui.view" id="account_view_tree2">
<field name="model">account.account</field>
<field name="type">tree</field>
@@ -849,7 +887,7 @@ this repository contains the full copyright notices and license terms. -->
<field name="field_childs">childs</field>
<field name="arch" type="xml">
<![CDATA[
<tree string="Balance Sheet">
<tree string="Balance Sheet" keyword_open="1">
<field name="name"/>
<field name="amount"/>
</tree>
+3
View File
@@ -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'),