Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
3850 Lượt xem

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?

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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

)));


Ảnh đại diện
Huỷ bỏ
Tác giả

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.

Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 1 22
2159
2
thg 5 17
11096
2
thg 11 22
3403
0
thg 7 22
1508
1
thg 1 22
11224