From e232dd66384b0c4af20c2e7f2b859c053173cb50 Mon Sep 17 00:00:00 2001 From: "Harry (OpenERP)" Date: Mon, 11 Oct 2010 18:52:52 +0530 Subject: [PATCH] [IMP] base: if company_ids is empty, it will be set with deafult value on user creation bzr revid: hmo@tinyerp.com-20101011132252-wcej9vlsb6582w5x --- bin/addons/base/res/res_user.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bin/addons/base/res/res_user.py b/bin/addons/base/res/res_user.py index 929a7018f7d..2b9a3a05eb1 100644 --- a/bin/addons/base/res/res_user.py +++ b/bin/addons/base/res/res_user.py @@ -350,6 +350,12 @@ class users(osv.osv): # User can write to a few of her own fields (but not her groups for example) SELF_WRITEABLE_FIELDS = ['menu_tips','view', 'password', 'signature', 'action_id', 'company_id', 'user_email'] + def create(self, cr, uid, vals, context=None): + if (not vals.get('company_ids',[])): + company_ids = self._get_companies(cr, uid, context=context) + if company_ids and len(company_ids): vals['company_ids'] = [(6, 0, company_ids)] + return super(users, self).create(cr, uid, vals, context=context) + def write(self, cr, uid, ids, values, context=None): if not hasattr(ids, '__iter__'): ids = [ids]