Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
3901 Widoki

I'm wondering if it's possible to write data into the relation table trough xmlrpc calls? I've got a web form that creates a user for a odoo demo instance. I'm trying to add groups to a that user. I get the group ids from the res.groups table. Now I need to add the records to the relation table res.groups.users.rel and I know I just can't directly write into it.

If it would be a local instance I could just do user.groups_id = (the id for the group that manages employees)

Is it possible to insert m2m relations trough xmlrpc calls? If it is, how?

Awatar
Odrzuć
Najlepsza odpowiedź

You can write as following to set groups in user.

$info = ripcord::client('https://demo.odoo.com/start')->start();

$common = ripcord::client($url . '/xmlrpc/2/common');

$models = ripcord::client("$url/xmlrpc/2/object");

$uid = $common->authenticate($db, $username, $password, array());

$user_id = 1;

$group_id = 5;

$models->execute_kw($db, $uid, $password, 'res.users', 'write',

    array(array($user_id),array(

         'groups_id'=>array(array(4,$group_id))

)));


Awatar
Odrzuć
Autor

I found this post on stackoverflow allready. tried with the touple with the 4 command, but it won't work and I just cant figure out why. so this copy paste code that is for php doesn't help me.

Can you please paste your code here, so I can help you for that, because above code is working properly.

Powiązane posty Odpowiedzi Widoki Czynność
0
sty 22
2216
2
maj 17
11184
2
lis 22
3456
0
lip 22
1570
1
sty 22
11270