1 # -*- encoding: utf-8 -*-
7 info = '''<?xml version="1.0"?>
8 <form string="Distribution Model Saved">
9 <label string="This distribution model has been saved.\nYou will be able to reuse it later."/>
12 def activate(self, cr, uid, data, context):
13 plan_obj = pooler.get_pool(cr.dbname).get('account.analytic.plan.instance')
15 plan = plan_obj.browse(cr, uid, data['id'], context)
16 if (not plan.name) or (not plan.code):
17 raise wizard.except_wizard('Error', 'Please put a name and a code before saving the model !')
18 pids = pooler.get_pool(cr.dbname).get('account.analytic.plan').search(cr, uid, [], context=context)
20 raise wizard.except_wizard('Error', 'No analytic plan defined !')
21 plan_obj.write(cr,uid,[data['id']],{'plan_id':pids[0]})
27 class create_model(wizard.interface):
32 'result': {'type':'choice','next_state':activate}
36 'result': {'type':'form', 'arch':info, 'fields':{}, 'state':[('end','OK')]}
40 'result': {'type':'form', 'arch':'', 'fields':{}, 'state':'end'}
43 create_model('create.model')
46 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: