Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

the meaning of company_ids?

By
Zouhair
on 9/11/14, 9:38 AM 876 views

hi,

any can help to understand the field values['company_ids'] in res_users, it is used to create a new user.

im trying to create a new company with her user, i give an error:

You can not change the company as the partner/user has multiple user linked with different companies.
Traceback (most recent call last):
  File "C:\OpenERP-7.0\Server\server\.\openerp\netsvc.py", line 296, in dispatch_rpc
  File "C:\OpenERP-7.0\Server\server\.\openerp\service\web_services.py", line 626, in dispatch
  File "C:\OpenERP-7.0\Server\server\.\openerp\osv\osv.py", line 190, in execute_kw
  File "C:\OpenERP-7.0\Server\server\.\openerp\osv\osv.py", line 132, in wrapper
  File "C:\OpenERP-7.0\Server\server\.\openerp\osv\osv.py", line 199, in execute
  File "C:\OpenERP-7.0\Server\server\.\openerp\osv\osv.py", line 187, in execute_cr
  File "C:\OpenERP-7.0\Server\server\openerp\addons\game\res_player.py", line 44, in create_player
  File "C:\OpenERP-7.0\Server\server\openerp\addons\auth_signup\res_users.py", line 281, in create
  File "C:\OpenERP-7.0\Server\server\openerp\addons\mail\res_users.py", line 77, in create
  File "C:\OpenERP-7.0\Server\server\openerp\addons\base\res\res_users.py", line 804, in create
  File "C:\OpenERP-7.0\Server\server\openerp\addons\base\res\res_users.py", line 634, in create
  File "C:\OpenERP-7.0\Server\server\openerp\addons\base\res\res_users.py", line 311, in create
  File "C:\OpenERP-7.0\Server\server\.\openerp\osv\orm.py", line 377, in function_proxy
  File "C:\OpenERP-7.0\Server\server\openerp\addons\base\res\res_partner.py", line 506, in write
except_osv: (u'Aviso', u'You can not change the company as the partner/user has multiple user linked with different companies.')

my function on python:

def create_player(self, cr, uid, vals, context = None):
  """
    the vals data:
        login
        password
        active
        company_ids
        partner_id
        share
        warehouse_id
  """
  vals['company_ids'] = [[6, False, [vals['company_id']]]]<--------- Problem
  vals['name'] = vals['login']
  id = self.pool.get('res.users').create(cr, uid, vals, context=context)
  self._set_stock_responsable(cr, uid, id, context = None)
  return id

the value of values['company_ids'] is some thing like that [[6,False,[45]]].

thx.

0

deep

--deep--
1617
| 5 4 7
Bengaluru, India
--deep--

Techno-Functional Associate with 6+ years of experience in Odoo (formerly known as OpenERP).

deep
On 9/11/14, 10:56 AM

Company_ids is nothing but Allowed Companies.... A users' company which you are trying to map must be present in those allowed companies...
 

but now i cant create new users allowed only for my new company, any idea to solve that

Zouhair
on 9/11/14, 11:06 AM

Am not getting.... are u trying to create user in admin login ? ....
If so first U have to set company in allowed companies... later u can set same for company field....



From: Zouhair <relawda@hotmail.com>;
To: deep <deepa4lok@yahoo.com>;
Subject: Re: False
Sent: Thu, Sep 11, 2014 3:06:02 PM

but now i cant create new users allowed only for my new company, any idea to solve that

--
Zouhair
Sent by OpenERP S.A. using Odoo about Forum Post False
deep
on 9/11/14, 11:13 AM

yes, how i can set company in allowed companies?

Zouhair
on 9/11/14, 11:44 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 9/11/14, 9:38 AM
Seen: 876 times
Last updated: 3/16/15, 8:10 AM