도움말

0

Update category_id of partner doesn't work

Avatar
Ferran Muñoz

Hi!


I want to update the category_id of the partner via XMLRPC but it doesn't work... I don't know what I'm doing wrong, so, I need help...


The code (in PHP) is this. For example, I want to update the user with id = 33 to put category_id = 6:

$fields = ['category_id' => 6];
XML_RPC::CallMethod($this->data['oobj'], 'execute_kw', [$this->data['db'], $this->wusr, $this->ad['psw'], 'res.partner', 'write', [[33], $fields]]);

Also, I tried to put in the category_id in an array, but the same:

$fields = ['category_id' => [6]];
XML_RPC::CallMethod($this->data['oobj'], 'execute_kw', [$this->data['db'], $this->wusr, $this->ad['psw'], 'res.partner', 'write', [[33], $fields]]);

Finally, I tried to empty all the categories of the partner, but don't do that:

$fields = ['category_id' => ""];
XML_RPC::CallMethod($this->data['oobj'], 'execute_kw', [$this->data['db'], $this->wusr, $this->ad['psw'], 'res.partner', 'write', [[33], $fields]]);

Where is the problem?

아바타
작성취소
1 응답
0
Avatar
Ferran Muñoz
최고의 답변

Ok, I see that category_id is a many2many field and I see that the update any field of this it's different (with array). So, for update, you have to do this:

$fields = ['category_id' => [[6, 0, [1]]]];
XML_RPC::CallMethod($this->data['oobj'], 'execute_kw', [$this->data['db'], $this->wusr, $this->ad['psw'], 'res.partner', 'write', [[33], $fields]]);

It works :)

아바타
작성취소