[IMP] Add a wizard for the maintenance

bzr revid: stephane@tinyerp.com-20081201155224-c30hsgie023cdjvr
This commit is contained in:
Stephane Wirtel 2008-12-01 16:52:24 +01:00
parent ec4e3e2fc6
commit ef9f6c0387
2 changed files with 52 additions and 14 deletions

View File

@ -40,8 +40,8 @@ class maintenance_contract(osv.osv):
_name = "maintenance.contract"
_description = "Maintenance Contract"
_columns = {
'name' : fields.char('Contract ID', size=256, required=True),
'password' : fields.char('Password', size=64, invisible=True, required=True),
'name' : fields.char('Contract ID', size=256, required=True, readonly=True),
'password' : fields.char('Password', size=64, invisible=True, required=True, readonly=True),
'date_start' : fields.date('Starting Date', readonly=True),
'date_stop' : fields.date('Ending Date', readonly=True),
'modules': fields.text('Covered Modules')
@ -85,7 +85,7 @@ The maintenance program offers you:
-----------------------------------------------------------
You have a maintenance contract, But you installed modules those
are not covered by your maintenance contract:
'''+','.join(result['modules'])+'''
%s
It means we can not offer you the garantee of maintenance on
your whole installation.
The maintenance program includes:
@ -100,12 +100,27 @@ extend your contract with the editor. We will review and validate
your installed modules.
* Extend your maintenance to the modules you used.
* Check your maintenance contract'''))
* Check your maintenance contract''') % ','.join(result['modules']))
else:
raise osv.except_osv(_('Valid Maintenance Contract !'),('''Your Maintenance Contract is up to date'''))
return result
maintenance_contract()
class maintenance_contract_wizard(osv.osv_memory):
_name = 'maintenance.contract.wizard'
_columns = {
'name' : fields.char('Contract ID', size=256, required=True ),
'password' : fields.char('Password', size=64, required=True),
}
def validate_cb(self, cr, uid, ids, context):
print "Validate_cb"
return False
maintenance_contract_wizard()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -22,11 +22,9 @@
<field name="arch" type="xml">
<form string="Maintenance Contract">
<separator string="Information" colspan="4"/>
<field name="name" select="1"/>
<field name="password" password="True"/>
<field name="name" select="1" colspan="4"/>
<field name="date_start" select="1"/>
<field name="date_stop" select="1"/>
<button name="_test_maintenance" string="Check Maintenance" type="object" colspan="2"/>
<separator string="Covered Modules" colspan="4"/>
<field name="modules" nolabel="1" colspan="4"/>
</form>
@ -40,13 +38,7 @@
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
</record>
<record id="action_maintenance_contract_form" model="ir.actions.act_window">
<field name="name">Encode a New Maintenance Contract</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">maintenance.contract</field>
<field name="view_type">form</field>
<field name="view_mode">form,tree</field>
</record>
<menuitem
name="Maintenance"
id="maintenance"
@ -57,5 +49,36 @@
id="menu_maintenance_contract"
parent="maintenance"/>
<record id="maintenance_contract_add_wizard" model="ir.ui.view">
<field name="name">maintenance.contract.add.wizard</field>
<field name="model">maintenance.contract.wizard</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Add Maintenance Contract">
<separator string="Add Maintenance Contract" colspan="2"/>
<newline />
<field name="name" />
<newline />
<field name="password" password="True" />
<newline />
<label string="" /><button name="validate_cb" type="object" string="Validate" />
</form>
</field>
</record>
<record id="action_maintenance_contract_add_wizard" model="ir.actions.act_window">
<field name="name">Add Maintenance Contract</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">maintenance.contract.wizard</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
<menuitem
action="action_maintenance_contract_add_wizard"
id="menu_maintenance_contract_add"
parent="maintenance" />
</data>
</openerp>