コンテンツへスキップ
メニュー
この質問にフラグが付けられました
1 返信
5953 ビュー

I want to change a custom boolean field from invoice from FALSE to TRUE. I've been reading the documentation for using Odoo API and tried to adapt the code in given in the example as shown below. (I'm using python3)


invoice_read3 = models.execute_kw(
db, uid, password, 'account.invoice', 'search_read',
[[('id', '=', 1)]])

models.execute_kw(
db, uid, password, 'account.invoice', 'write', [[invoice_read3],
{'x_processed': True}])


But it returns the following error.


xmlrpc.client.Fault: <Fault 1: 'Traceback (most recent call last):(...)prefetch[cls._name].update(ids)\nTypeError: unhashable type: \'list\'\n'>

Also, My boolean field is not 'readonly', how would it affect the code if i change it to 'readonly' ? Thanks in advance.

アバター
破棄
最善の回答

Hello Jean,

If you already have ID of invoice then you should directly use it in write operation as following :

models.execute_kw(db, uid, password, 'account.invoice', 'write', [[1], {'x_processed': True}])

Thanks,

アバター
破棄
著作者

Hello, Emipro

I have already done that and now i have authorization problems. Even tho I am the administrator. I have already done my Odoo conexion as in the Documentation. Is there anything new to add to my python3 code in order to get elevated authorization?

xmlrpc.client.Fault: <Fault 4: "('Sorry, you are not allowed to modify this document. Please contact your system administrator if you think this is an error.\\n\\n(Document model: account.invoice)', None)">

著作者

Nevermind. I figured it out. In order to give authorization for write, delete, create or read you need to give that kind of permission to the group you want to use.

Just go to Odoo 11 then go to Settings and under "Technical" Tab go to Security, then select "Acces Control List"

In there just search for the group you want to modify it's authorization and just check the checkbox for the kind of permission you want. Hope it helps other people.

関連投稿 返信 ビュー 活動
2
2月 24
15418
1
12月 22
4930
2
12月 22
14348
2
6月 22
6184
2
6月 22
4598