Reputation: 3640
My Odoo user has access to two companies but when I run code like the following (using ripcord as described here) it only shows me data for the default company:
$domain = [];
$domain[] = ['year', '=', '2019'];
$fields = ['account_id', 'date', 'balance2'];
$groupby = ['account_id', 'date'];
$result = $models->execute_kw($a, $b, $c, 'account.budget.report', 'read_group', [$domain, $fields, $groupby], []);
Adding ['company_id', '=', '31']
to the array $domain
doesn't work.
How can I change the company I currently want to work with?
Upvotes: 1
Views: 1084
Reputation: 3640
Figured it out myself. Looking at how the browser changes the company I need to do this write
operation first:
$result = $models->execute_kw($a, $b, $c, 'res.users', 'write', [[75], ['company_id' => 31]]);
75 is my user ID.
Upvotes: 2