[IMP]survey:remove a draft state and add a widget statusbar as per specification

bzr revid: mma@tinyerp.com-20110915111740-8x311rpkfw3ke113
This commit is contained in:
Mayur Maheshwari (OpenERP)
2011-09-15 16:47:40 +05:30
parent 8eb4f30d90
commit d47cacfc9f
2 changed files with 6 additions and 12 deletions
+2 -6
View File
@@ -58,7 +58,7 @@ class survey(osv.osv):
help="Set to one if survey is answerable only once"),
'response_user': fields.integer('Maximum Answer per User',
help="Set to one if you require only one Answer per user"),
'state': fields.selection([('draft', 'Draft'), ('open', 'Open'), ('close', 'Closed'), ('cancel', 'Cancelled')], 'Status', readonly=True),
'state': fields.selection([('open', 'Open'), ('close', 'Closed'), ('cancel', 'Cancelled')], 'Status', readonly=True),
'responsible_id': fields.many2one('res.users', 'Responsible', help="User responsible for survey"),
'tot_start_survey': fields.integer("Total Started Survey", readonly=1),
'tot_comp_survey': fields.integer("Total Completed Survey", readonly=1),
@@ -70,17 +70,13 @@ class survey(osv.osv):
'invited_user_ids': fields.many2many('res.users', 'survey_invited_user_rel', 'sid', 'uid', 'Invited User'),
}
_defaults = {
'state': lambda * a: "draft",
'state': lambda * a: "open",
'tot_start_survey': lambda * a: 0,
'tot_comp_survey': lambda * a: 0,
'send_response': lambda * a: 1,
'response_user': lambda * a:1,
}
def survey_draft(self, cr, uid, ids, arg):
self.write(cr, uid, ids, {'state': 'draft'})
return True
def survey_open(self, cr, uid, ids, arg):
self.write(cr, uid, ids, {'state': 'open', 'date_open': strftime("%Y-%m-%d %H:%M:%S")})
return True
+4 -6
View File
@@ -180,14 +180,12 @@
</form>
</field>
<group col="9" colspan="4">
<field name="state"/>
<field name="state" widget="statusbar" statusbar_visible="open,close"/>
<button name="survey_cancel"
string="Cancel" states="open" type="object" icon="gtk-cancel"/>
<button name="survey_draft"
string="Set to draft" states="cancel,close" type="object"
icon="gtk-new"/>
<button name="survey_open" string="Open"
states="draft" type="object" icon="gtk-go-forward"/>
<button name="survey_open"
string="Open" states="cancel,close" type="object"
icon="gtk-go-forward"/>
<button name="survey_close"
string="Close" states="open" type="object" icon="gtk-close"/>
</group>