[fix] l10n_ch: migrate to res.config-based initial configuration

bzr revid: xmo@tinyerp.com-20091215093104-7telxcs49642u6v0
This commit is contained in:
Xavier Morel 2009-12-15 10:31:04 +01:00
parent 6eb9f6a5bd
commit db490c154b
2 changed files with 35 additions and 42 deletions

View File

@ -4,28 +4,35 @@
<field name="name">account.journal.todo.form</field>
<field name="model">account.journal.todo</field>
<field name="type">form</field>
<field name="inherit_id" ref="base.res_config_view_base"/>
<field name="arch" type="xml">
<form string="Account Journal">
<group colspan="4" col="6">
<field name="name" select="1"/>
<data>
<form position="attributes"><attribute name="string">
Account Journal
</attribute></form>
<group string="res_config_contents" position="replace">
<label colspan="4" align="0.0" string="
Set accounts on financial journals defined by CamptoCamp
l10n_ch module"/>
<separator colspan="4"/>
<group colspan="4" col="6">
<field name="name" select="1"/>
</group>
<separator colspan="4" string="
The accounts linked to the account journals"/>
<field name="default_credit_account_id" select="1"
on_change="on_change_credit(name, default_credit_account_id)"/>
<field name="default_debit_account_id" select="1"
on_change="on_change_debit(name, default_debit_account_id)"/>
</group>
<separator colspan="4" string="
The accounts linked to the account journals"/>
<field name="default_credit_account_id" select="1"
on_change="on_change_credit(name, default_credit_account_id)"/>
<field name="default_debit_account_id" select="1"
on_change="on_change_debit(name, default_debit_account_id)"/>
<group col="4" colspan="4">
<button icon="gtk-cancel" name="action_cancel"
string="Cancel" type="object"/>
<button icon="gtk-ok" name="action_new"
string="Next" type="object"/>
</group>
</form>
<xpath expr="//button[@name='action_next']" position="attributes">
<attribute name="string">Next</attribute>
</xpath>
</data>
</field>
</record>
<record id="action_config_journal" model="ir.actions.act_window">
<field name="name">Configure Journal</field>
<field name="name">Finalize your Journal</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">account.journal.todo</field>
<field name="view_type">form</field>
@ -34,9 +41,6 @@
<field name="target">new</field>
</record>
<record id="action_config_journal_todo" model="ir.actions.todo">
<field name="name">Finalize your journal</field>
<field name="note">Set accounts on financial journals defined by
Camptocamp l10n_ch module</field>
<field name="action_id" ref="action_config_journal"/>
<field name="sequence">5</field>
</record>

View File

@ -31,10 +31,10 @@
##############################################################################
from osv import fields, osv
class Journal(osv.osv):
class Journal(osv.osv_memory):
"""Create account.journal.todo in order to add configuration wizzard"""
_name ="account.journal.todo"
_inherit = 'res.config'
def _get_journal(self, cr, uid, ctx):
if not self.__dict__.has_key('_inner_steps') :
@ -111,15 +111,7 @@ class Journal(osv.osv):
)
return {}
def action_cancel(self,cr,uid,ids,context=None):
return {
'view_type': 'form',
"view_mode": 'form',
'res_model': 'ir.actions.configuration.wizard',
'type': 'ir.actions.act_window',
'target':'new',
}
def action_new(self,cr,uid,ids,context={}):
def execute(self,cr,uid,ids,context={}):
jids = self.pool.get('account.journal').search(cr, uid, [])
if self._inner_steps < len(jids)-1 :
self._inner_steps += 1
@ -127,17 +119,14 @@ class Journal(osv.osv):
print 'DONE'
self._inner_steps = 'done'
return {
'view_type': 'form',
"view_mode": 'form',
'res_model': 'account.journal.todo',
'view_id':self.pool.get('ir.ui.view').search(
cr,
uid,
[('name','=','view_account_journal_form_todo')]
),
'type': 'ir.actions.act_window',
'target':'new',
}
'view_type': 'form',
"view_mode": 'form',
'res_model': 'account.journal.todo',
'view_id': self.pool.get('ir.ui.view')\
.search(cr, uid, [('name','=','account.journal.todo.form')]),
'type': 'ir.actions.act_window',
'target': 'new',
}
Journal()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: