Moved wizrad of charts of account from base_setup tp account
bzr revid: ruchakpatel@gmail.com-20080917133442-ay4njpeacc1pv5vx
This commit is contained in:
@@ -33,7 +33,7 @@ from osv import fields, osv
|
||||
|
||||
from tools.misc import currency
|
||||
from tools.translate import _
|
||||
|
||||
import pooler
|
||||
import mx.DateTime
|
||||
from mx.DateTime import RelativeDateTime, now, DateTime, localtime
|
||||
|
||||
@@ -1522,6 +1522,61 @@ class account_config_fiscalyear(osv.osv_memory):
|
||||
|
||||
account_config_fiscalyear()
|
||||
|
||||
class account_config_charts(osv.osv_memory):
|
||||
_name = 'account.config.charts'
|
||||
|
||||
def _get_charts(self, cr, uid, context):
|
||||
module_obj=self.pool.get('ir.module.module')
|
||||
ids=module_obj.search(cr, uid, [('category_id', '=', 'Account charts'), ('state', '<>', 'installed')])
|
||||
res=[(m.id, m.shortdesc) for m in module_obj.browse(cr, uid, ids)]
|
||||
res.append((-1, 'None'))
|
||||
res.sort(lambda x,y: cmp(x[1],y[1]))
|
||||
return res
|
||||
|
||||
_columns = {
|
||||
'charts' : fields.selection(_get_charts, 'Select Charts of Account',required=True)
|
||||
}
|
||||
|
||||
def action_cancel(self,cr,uid,ids,conect=None):
|
||||
return {
|
||||
'view_type': 'form',
|
||||
"view_mode": 'form',
|
||||
'res_model': 'ir.module.module.configuration.wizard',
|
||||
'type': 'ir.actions.act_window',
|
||||
'target':'new',
|
||||
}
|
||||
|
||||
def action_create(self, cr, uid,ids, context=None):
|
||||
res=self.read(cr,uid,ids)[0]
|
||||
id = res['charts']
|
||||
def install(id):
|
||||
mod_obj = self.pool.get('ir.module.module')
|
||||
mod_obj.write(cr , uid, [id] ,{'state' : 'to install'})
|
||||
mod_obj.download(cr, uid, [id], context=context)
|
||||
cr.commit()
|
||||
cr.execute("select m.id as id from ir_module_module_dependency d inner join ir_module_module m on (m.name=d.name) where d.module_id=%d and m.state='uninstalled'",(id,))
|
||||
ret = cr.fetchall()
|
||||
if len(ret):
|
||||
for r in ret:
|
||||
install(r[0])
|
||||
else:
|
||||
mod_obj.write(cr , uid, [id] ,{'state' : 'to install'})
|
||||
mod_obj.download(cr, uid, [id], context=context)
|
||||
cr.commit()
|
||||
install(id)
|
||||
cr.commit()
|
||||
db, pool = pooler.restart_pool(cr.dbname, update_module=True)
|
||||
|
||||
return {
|
||||
'view_type': 'form',
|
||||
"view_mode": 'form',
|
||||
'res_model': 'ir.module.module.configuration.wizard',
|
||||
'type': 'ir.actions.act_window',
|
||||
'target':'new',
|
||||
}
|
||||
|
||||
account_config_charts()
|
||||
|
||||
# ---------------------------------------------------------------
|
||||
# Account Templates : Account, Tax, Tax Code and chart. + Wizard
|
||||
# ---------------------------------------------------------------
|
||||
|
||||
@@ -1352,6 +1352,35 @@
|
||||
<field name="view_mode">form</field>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<record id="view_config_charts_form" model="ir.ui.view">
|
||||
<field name="name">Select Charts of Account</field>
|
||||
<field name="model">account.config.charts</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Select Charts of Account">
|
||||
<separator colspan="2" string=""/>
|
||||
<newline/>
|
||||
<field name="charts"/>
|
||||
<newline/>
|
||||
<separator string="" colspan="2"/>
|
||||
<newline/>
|
||||
<group col="2" colspan="2">
|
||||
<button icon="gtk-cancel" special="cancel" string="Don't Select" name="action_cancel" type="object"/>
|
||||
<button icon="gtk-ok" name="action_create" string="Select" type="object"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_config_charts_form" model="ir.actions.act_window">
|
||||
<field name="name">Select Charts of Account</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">account.config.charts</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
|
||||
<!-- register configuration wizard -->
|
||||
@@ -1362,6 +1391,13 @@
|
||||
<field name="action_id" ref="action_config_fiscalyear_form"/>
|
||||
<field name="state">open</field>
|
||||
</record>
|
||||
|
||||
<record id="config_charts" model="ir.module.module.configuration.step">
|
||||
<field name="name">Select Charts of Account</field>
|
||||
<field name="note">There are much more charts of accounts available on the OpenERP website.If you don't select one now, you'll be able to install another one through the Administration menu.</field>
|
||||
<field name="action_id" ref="action_config_charts_form"/>
|
||||
<field name="state">open</field>
|
||||
</record>
|
||||
|
||||
|
||||
<!-- Account Templates -->
|
||||
|
||||
@@ -48,19 +48,19 @@ view_form_profit = """<?xml version="1.0"?>
|
||||
</group>
|
||||
</form>"""
|
||||
|
||||
view_form_charts = """<?xml version="1.0"?>
|
||||
<form string="Setup">
|
||||
<image name="gtk-dialog-info" colspan="2"/>
|
||||
<group>
|
||||
<separator string="Select a Chart of Accounts" colspan="2"/>
|
||||
<newline/>
|
||||
<field name="charts" align="0.0"/>
|
||||
<newline/>
|
||||
<label string="There are much more charts of accounts available on the OpenERP website." colspan="2" align="0.0"/>
|
||||
<newline/>
|
||||
<label string="If you don't select one now, you'll be able to install another one through the Administration menu." colspan="2" align="0.0"/>
|
||||
</group>
|
||||
</form>"""
|
||||
#view_form_charts = """<?xml version="1.0"?>
|
||||
#<form string="Setup">
|
||||
# <image name="gtk-dialog-info" colspan="2"/>
|
||||
# <group>
|
||||
# <separator string="Select a Chart of Accounts" colspan="2"/>
|
||||
# <newline/>
|
||||
# <field name="charts" align="0.0"/>
|
||||
# <newline/>
|
||||
# <label string="There are much more charts of accounts available on the OpenERP website." colspan="2" align="0.0"/>
|
||||
# <newline/>
|
||||
# <label string="If you don't select one now, you'll be able to install another one through the Administration menu." colspan="2" align="0.0"/>
|
||||
# </group>
|
||||
#</form>"""
|
||||
|
||||
view_form_company = """<?xml version="1.0"?>
|
||||
<form string="Setup">
|
||||
@@ -389,36 +389,36 @@ IBAN: BE74 1262 0121 6907 - SWIFT: CPDF BE71 - VAT: BE0477.472.701""",
|
||||
'result': {'type': 'form', 'arch': view_form_profit, 'fields': fields,
|
||||
'state': [
|
||||
('menu', 'Cancel', 'gtk-cancel'),
|
||||
('next', 'Next', 'gtk-go-forward', True)
|
||||
]
|
||||
}
|
||||
},
|
||||
'next': {
|
||||
'actions': [],
|
||||
'result': {'type': 'choice', 'next_state': _next}
|
||||
},
|
||||
'charts':{
|
||||
'actions': [],
|
||||
'result': {'type': 'form', 'arch': view_form_charts, 'fields': fields,
|
||||
'state':[
|
||||
('init', 'Previous', 'gtk-go-back'),
|
||||
('company', 'Next', 'gtk-go-forward', True)
|
||||
]
|
||||
}
|
||||
},
|
||||
# 'next': {
|
||||
# 'actions': [],
|
||||
# 'result': {'type': 'choice', 'next_state': _next}
|
||||
# },
|
||||
# 'charts':{
|
||||
# 'actions': [],
|
||||
# 'result': {'type': 'form', 'arch': view_form_charts, 'fields': fields,
|
||||
# 'state':[
|
||||
# ('init', 'Previous', 'gtk-go-back'),
|
||||
# ('company', 'Next', 'gtk-go-forward', True)
|
||||
# ]
|
||||
# }
|
||||
# },
|
||||
'company':{
|
||||
'actions': [],
|
||||
'result': {'type': 'form', 'arch': view_form_company, 'fields': fields,
|
||||
'state': [
|
||||
('previous', 'Previous', 'gtk-go-back'),
|
||||
('init', 'Previous', 'gtk-go-back'),
|
||||
('update', 'Next', 'gtk-go-forward', True)
|
||||
]
|
||||
}
|
||||
},
|
||||
'previous':{
|
||||
'actions': [],
|
||||
'result': {'type': 'choice', 'next_state': _previous}
|
||||
},
|
||||
# 'previous':{
|
||||
# 'actions': [],
|
||||
# 'result': {'type': 'choice', 'next_state': _previous}
|
||||
# },
|
||||
'update':{
|
||||
'actions': [],
|
||||
'result': {'type': 'form', 'arch': view_form_update, 'fields': fields,
|
||||
|
||||
Reference in New Issue
Block a user