콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
1 회신
6263 화면

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
16474
1
12월 22
5641
2
12월 22
15391
2
6월 22
7458
2
6월 22
5545