[IMP]:Added a boolean field on the user preferences and user form to be able to deactivate the help dialog box in each screen per user

bzr revid: nch@tinyerp.com-20100825084848-obktbc48sred7jnh
This commit is contained in:
nch@tinyerp.com 2010-08-25 14:18:48 +05:30
parent d39a2613d8
commit 653aa1c7da
3 changed files with 17 additions and 8 deletions

View File

@ -81,6 +81,8 @@
<field name="company_id" widget="selection" readonly="0"
context="{'user_id': self, 'user_preference': 1}"/>
<field name="view" readonly="0"/>
<label string="" colspan="2"/>
<field name="menu_tips" colspan="2"/>
<newline/>
<separator colspan="4" string="Preferences"/>
</page>
@ -119,7 +121,9 @@
<field domain="[('usage','=','menu')]" name="menu_id" required="True"/>
<field name="context_lang"/>
<field name="context_tz"/>
<field name="view" readonly="0" />
<field name="view" readonly="0"/>
<field name="menu_tips" colspan="2"/>
<label string="" colspan="2"/>
<group colspan="2" col="2">
<separator string="Signature" colspan="2"/>
<field colspan="2" name="signature" nolabel="1"/>

View File

@ -210,12 +210,14 @@ class act_window(osv.osv):
return res
def _get_help_status(self, cr, uid, ids, name, arg, context={}):
cr.execute(""" SELECT action.id,
CASE WHEN r.uid IS NULL THEN True ELSE False END
AS help_status FROM ir_act_window action
LEFT JOIN ir_act_window_user_rel r ON
(action.id = r.act_id AND (r.uid IS NULL or r.uid= %s)) WHERE action.id = ANY(%s)""",(uid,ids,))
return dict(cr.fetchall())
activate_tips = self.pool.get('res.users').browse(cr, uid, uid).menu_tips
if activate_tips:
cr.execute(""" SELECT action.id,
CASE WHEN r.uid IS NULL THEN True ELSE False END
AS help_status FROM ir_act_window action
LEFT JOIN ir_act_window_user_rel r ON
(action.id = r.act_id AND (r.uid IS NULL or r.uid= %s)) WHERE action.id = ANY(%s)""",(uid,ids,))
return dict(cr.fetchall())
_columns = {
'name': fields.char('Action Name', size=64, translate=True),

View File

@ -260,6 +260,8 @@ class users(osv.osv):
selection=[('simple','Simplified'),('extended','Extended')],
string='Interface', help="Choose between the simplified interface and the extended one"),
'user_email': fields.function(_email_get, method=True, fnct_inv=_email_set, string='Email', type="char", size=240),
'menu_tips': fields.boolean('Menu Tips', help="Check out this box if you want to display tips on each menu action"),
}
def read(self,cr, uid, ids, fields=None, context=None, load='_classic_read'):
@ -349,6 +351,7 @@ class users(osv.osv):
'company_ids': _get_companies,
'groups_id': _get_group,
'address_id': False,
'menu_tips':True
}
@tools.cache()
@ -356,7 +359,7 @@ class users(osv.osv):
return self._get_company(cr, uid, context=context, uid2=uid2)
# User can write to a few of her own fields (but not her groups for example)
SELF_WRITEABLE_FIELDS = ['view', 'password', 'signature', 'action_id', 'company_id', 'user_email']
SELF_WRITEABLE_FIELDS = ['menu_tips','view', 'password', 'signature', 'action_id', 'company_id', 'user_email']
def write(self, cr, uid, ids, values, context=None):
if not hasattr(ids, '__iter__'):