[IMP] base: Add an on_change with a warning if the user changes the company

bzr revid: stephane@openerp.com-20100831111314-jea2mxbd1hqarzoc
This commit is contained in:
Stephane Wirtel 2010-08-31 13:13:14 +02:00
parent 1d340e79b1
commit ce93349749
2 changed files with 12 additions and 1 deletions

View File

@ -116,7 +116,11 @@
<page string="User">
<field name="address_id" select="1"/>
<field name="user_email" widget="email"/>
<field name="company_id" required="1" context="{'user_id': self, 'user_preference': 1}" groups="base.group_multi_company"/>
<field name="company_id" required="1"
context="{'user_id': self, 'user_preference': 1}"
on_change="on_change_company_id(company_id)"
groups="base.group_multi_company"
/>
<field name="action_id" required="True"/>
<field domain="[('usage','=','menu')]" name="menu_id" required="True"/>
<field name="context_lang"/>

View File

@ -268,6 +268,13 @@ class users(osv.osv):
}
def on_change_company_id(self, cr, uid, ids, company_id):
return {
'value': {
'warning' : _("Please keep in mind that data currently displayed may not be relevant after switching to another company. If you have unsaved changes, please make sure to save and close the forms before switching to a different company (you can click on Cancel now)"),
}
}
def read(self,cr, uid, ids, fields=None, context=None, load='_classic_read'):
def override_password(o):
if 'password' in o and ( 'id' not in o or o['id'] != uid ):