Company ignored after editing Preferences

Bug #702568 reported by Nicolas Bustillos (Poiesis)
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Odoo Web Client
Fix Released
Medium
OpenERP R&D Web Team

Bug Description

While testing multi-company functionality on my OpenERP 6.0 RC2 (on Windows 7), I see that nothing happens when I try to switch companies from the EDIT PREFERENCES window.

Upon closer look to the source code, I find that there is indeed a validation that checks whether the selected company is assigned to the logged user in \addons\base\res\res_user.py (line 368):
       if not (values['company_id'] in self.read(cr, uid, uid, ['company_ids'], context=context)['company_ids']):

However, the selected company IS assigned to me, which I can confirm by simply watching the variables used in this code line. I find that by simply converting the id from the 'values' list to integer, the condintion works correctly:
       if not (int(values['company_id']) in self.read(cr, uid, uid, ['company_ids'], context=context)['company_ids']):

After introducing this change to my RC2 installation, the modified company is saved correctly (although the web page's header doesn't reflect the change even after refreshing it, something I should probably report in the WebServer project)

Hope I got this right, as I am new to OpenERP. Thanks.

Revision history for this message
Olivier Dony (Odoo) (odo-openerp) wrote :

Hello Nicolas,

Your analysis is correct, and your patch is not bad, but the problem is larger, and not limited to changing the company. For example if you try to turn off the 'menu tips' in the preferences you will see that it fails too.

This is the trace of a sample RPC call from the web client when changing the preferences:

['test_00_1',
 1,
 '*',
 'res.users',
 'write',
 [1],
 {'company_id': '3',
  'context_lang': 'en_US',
  'context_project_id': '',
  'context_section_id': '',
  'context_tz': '',
  'menu_tips': '1',
  'signature': 'Administrator',
  'user_email': '',
  'view': 'extended'}]

As you can see, the company_id and menu_tips values are passed as strings instead of, respectively, integer and boolean.

This is a problem in the web client, and applying your suggested patch on the server would indeed be a workaround for the company setting, but we need solve the root cause as well.

This issue is under investigation by the web client team.

Thanks for reporting!

affects: openobject-server → openobject-client-web
Changed in openobject-client-web:
assignee: nobody → OpenERP SA's Web Client R&D (openerp-dev-web)
importance: Undecided → Medium
status: New → Confirmed
milestone: none → 6.0
status: Confirmed → In Progress
Revision history for this message
Olivier Dony (Odoo) (odo-openerp) wrote :

Correction: turning off the menu tips would work because the write is done with an empty string and not '0', but there is nevertheless something incorrect going on.

BTW, using the GTK client to change the user preferences is a workaround (but you might need to logout/login) for some of the preferences to be applied in web as well.

Changed in openobject-client-web:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.