summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavier Morel <xmo@tinyerp.com>2009-12-15 10:31:04 +0100
committerXavier Morel <xmo@tinyerp.com>2009-12-15 10:31:04 +0100
commitdb490c154b0f0ccc043ff18656d2a5a3b075f5b3 (patch)
tree9fe6bfd0990c60fa6dd37e0773c950e693a3990b
parent6eb9f6a5bd57c899327d04fd6df10c9f4519ca51 (diff)
[fix] l10n_ch: migrate to res.config-based initial configuration
bzr revid: xmo@tinyerp.com-20091215093104-7telxcs49642u6v0
-rwxr-xr-xaddons/l10n_ch/account_journal_view.xml44
-rwxr-xr-xaddons/l10n_ch/wizard/journal_config.py33
2 files changed, 35 insertions, 42 deletions
diff --git a/addons/l10n_ch/account_journal_view.xml b/addons/l10n_ch/account_journal_view.xml
index 224020660f5..120bb1565ea 100755
--- a/addons/l10n_ch/account_journal_view.xml
+++ b/addons/l10n_ch/account_journal_view.xml
@@ -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>
diff --git a/addons/l10n_ch/wizard/journal_config.py b/addons/l10n_ch/wizard/journal_config.py
index 68c60fb9ca8..096ddb8d79f 100755
--- a/addons/l10n_ch/wizard/journal_config.py
+++ b/addons/l10n_ch/wizard/journal_config.py
@@ -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: