-Made wizard_use_model called from view(account.model) and menu(Use model) both.

bzr revid: jvo-20080717072716-fvtia6482l0qbkkv
This commit is contained in:
jvo 2008-07-17 12:57:16 +05:30
parent 72f215072b
commit 73e59635f0
2 changed files with 17 additions and 4 deletions

View File

@ -1130,7 +1130,7 @@
<separator string="Legend" colspan="4"/>
<field name="legend" colspan="4" nolabel="1"/>
<group col="1" colspan="4">
<button name="generate" string="Create entries" type="object"/>
<button name="%(wizard_account_use_model)d" string="Create entries" type="action" />
</group>
</form>
</field>
@ -1495,7 +1495,8 @@
<form string="Account Template">
<notebook>
<page string="General Information">
<field colspan="4" name="name" select="1"/>
<field colspan="2" name="name" select="1"/>
<!-- <field name="company_id" colspan="2" />-->
<newline/>
<field name="type" select="1"/>
<field name="code" select="1"/>

View File

@ -21,8 +21,11 @@ fields = {
}
def _create_entries(self, cr, uid, data, context):
pool_obj = pooler.get_pool(cr.dbname)
model_ids = data['form']['model'][0][2]
data_model = pool_obj.get('account.model').browse(cr,uid,model_ids)
if data['model']=='ir.ui.menu':
model_ids = data['form']['model'][0][2]
data_model = pool_obj.get('account.model').browse(cr,uid,model_ids)
else:
data_model = pool_obj.get('account.model').browse(cr,uid,data['ids'])
move_ids = []
for model in data_model:
@ -90,8 +93,17 @@ class use_model(wizard.interface):
'type': 'ir.actions.act_window'
}
def _check(self, cr, uid, data, context):
if data['model']=='ir.ui.menu':
return 'init_form'
return 'create'
states = {
'init': {
'actions': [],
'result': {'type':'choice','next_state':_check}
},
'init_form': {
'actions': [],
'result': {'type':'form', 'arch':model_form, 'fields':model_fields, 'state':[('end','Cancel'),('create','Create Entries')]},
},