Hi There,
I'm trying to get all the invoices that are in the accounting of two companies (CompanyXYZ Inc. and CompanyXYZ SA). In the UI, I do have first to select the company and then navigate to the Accounting module and select the Sales book (landing in the model account.invoice).
In my python code, when I submit the following code:
models.execute_kw(db, uid, password, 'account.invoice, 'search_read', {}
I either get the list of invoices belonging to the INC or to the SA but not both. Also, I noticed that I get the list from company I last logged in in the web interface. (Say I log in and select "Company Inc", and then I run my python code, I'll get the invoices from the INC. If I then switch the SA, and run the same Python code again, then I'll get the invoices from the SA.
What am I missing? Is there a way to provide a parameter in the XMLRPC request to indicate which company I'm connecting to?
Thanks,
François
Which Odoo version ?
Thanks for your response Alessandro. It makes total sense. I tried the following ro update the company: models.execute_kw(db, uid, password, 'res.partner', 'write', [[1786],{'company_id','=',[1,'Company XYZ SA']}]) but got the following error message: TypeError: unhashable type: 'list' Not sure what I'm doing wrong but it looks like companyId is a list
Please ignore my previous comment. Thank you SO much Alessandro! The correct syntax to switch companies is: models.execute_kw(db, uid, password, 'res.users', 'write', [[uid],{'company_id':1}])
Version 12