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

bzr revid: xmo@tinyerp.com-20091215140841-c93etyiidd6v04pk
This commit is contained in:
Xavier Morel
2009-12-15 15:08:41 +01:00
parent 33b09dd923
commit f51111f283
2 changed files with 32 additions and 47 deletions
@@ -24,6 +24,8 @@ import pooler
class profile_accounting_config_install_modules_wizard(osv.osv_memory):
_name='profile.accounting.config.install_modules_wizard'
_inherit = 'res.config'
_columns = {
'name':fields.char('Name', size=64),
'account_analytic_analysis':fields.boolean('Analytic Accounting'),
@@ -33,38 +35,18 @@ class profile_accounting_config_install_modules_wizard(osv.osv_memory):
'hr_timesheet_invoice':fields.boolean('Invoice on Analytic Entries'),
'account_budget':fields.boolean('Budgets', help="Helps you to manage financial and analytic budgets."),
'board_document':fields.boolean('Document Management',help= "The Document Management System of Open ERP allows you to store, browse, automatically index, search and preview all kind of documents (internal documents, printed reports, calendar system). It opens an FTP access for the users to easily browse association's document."),
}
def action_cancel(self,cr,uid,ids,conect=None):
return {
'view_type': 'form',
"view_mode": 'form',
'res_model': 'ir.actions.configuration.wizard',
'type': 'ir.actions.act_window',
'target':'new',
}
def action_install(self, cr, uid, ids, context=None):
result=self.read(cr,uid,ids)
def execute(self, cr, uid, ids, context=None):
result = self.read(cr, uid, ids)
mod_obj = self.pool.get('ir.module.module')
for res in result:
for r in res:
if r<>'id' and res[r]:
if r != 'id' and res[r]:
ids += mod_obj.search(cr, uid, [('name', '=', r)])
mod_obj.button_install(cr, uid, ids, context=context)
cr.commit()
db, pool = pooler.restart_pool(cr.dbname,update_module=True)
return {
'view_type': 'form',
"view_mode": 'form',
'res_model': 'ir.actions.configuration.wizard',
'type': 'ir.actions.act_window',
'target':'new',
}
db, pool = pooler.restart_pool(cr.dbname, update_module=True)
profile_accounting_config_install_modules_wizard()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
@@ -5,25 +5,29 @@
<field name="name">Accounting Profile : Install extra modules</field>
<field name="model">profile.accounting.config.install_modules_wizard</field>
<field name="type">form</field>
<field name="inherit_id" ref="base.res_config_view_base"/>
<field name="arch" type="xml">
<form string="Install Extra Module">
<separator string="Accounting Management" colspan="4"/>
<field name="account_analytic_analysis"/>
<field name="account_analytic_plans"/>
<field name="account_payment"/>
<separator string="Resources Management" colspan="4"/>
<field name="account_budget"/>
<field name="account_asset"/>
<separator string="Services Management" colspan="4"/>
<field name="hr_timesheet_invoice"/>
<field name="board_document"/>
<separator string="" colspan="4"/>
<label string="" colspan="2"/>
<group col="4" colspan="2">
<button special="cancel" string="Cancel" name="action_cancel" type="object" icon='gtk-cancel'/>
<button name="action_install" string="Install" icon='gtk-ok' type="object"/>
</group>
</form>
<data>
<form position="attributes"><attribute name="string">
Install Extra Modules
</attribute></form>
<group string="res_config_contents" position="replace">
<label colspan="4" align="0.0" string="
Install more modules. A few modules are proposed according
to the Account Profile you selected. You will be able to
install them based on our requirements."/>
<separator string="Accounting Management" colspan="4"/>
<field name="account_analytic_analysis"/>
<field name="account_analytic_plans"/>
<field name="account_payment"/>
<separator string="Resources Management" colspan="4"/>
<field name="account_budget"/>
<field name="account_asset"/>
<separator string="Services Management" colspan="4"/>
<field name="hr_timesheet_invoice"/>
<field name="board_document"/>
</group>
</data>
</field>
</record>
@@ -31,16 +35,15 @@
<field name="name">Accounting Profile : Install Extra Modules</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">profile.accounting.config.install_modules_wizard</field>
<field name="view_id" ref="view_confirm_install_module_form"/>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
<record model="ir.actions.todo"
id="profile_accounting.config_install_wizard">
<field name="name">Accounting Profile : Install Extra modules</field>
<field name="note">Install more modules. A few modules are proposed according to the Account Profile you selected. You will be able to install them based on our requirements.</field>
<field name="action_id" ref="action_config_install_module"/>
<record model="ir.actions.todo"
id="profile_accounting.config_install_wizard">
<field name="action_id" ref="action_config_install_module"/>
</record>
</data>
</openerp>