Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
1 Відповісти
3804 Переглядів

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?

Аватар
Відмінити
Найкраща відповідь

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))

)));


Аватар
Відмінити
Автор

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.

Related Posts Відповіді Переглядів Дія
0
січ. 22
2127
2
трав. 17
11055
2
лист. 22
3336
0
лип. 22
1478
1
січ. 22
11157