Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
3 ตอบกลับ
5087 มุมมอง

Hello Guys

I am having problem in some fields on ODOO15 that was not having on ODOO13.

I have some fields that are declared in a class without the "fields" like this:

qmgr = None

In the code I have a line that attribute a value for this qmgr in the self:

self.qmgr = pymqi.QueueManager('*')

When I run the code on ODOO15 I get the error

object attribute 'qmgr' is read-only


In the ODOO13 this operation was allowed. Could someone please help me in how to save it? or how create it now on ODOO15 or how setup it to be readonly False?

Thank you so much







อวตาร
ละทิ้ง
ผู้เขียน

UP

Did you get the solution? I too am facing the same issue...

คำตอบที่ดีที่สุด

Hi Guilherme,

This\ will\ do\ the\ job\ I\ guess\.

https://stackoverflow.com/questions/68645/class-static-variables-and-methods

use MYClass.foo instead of self.foo

Thanks,


Alexander
 

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

You can use Odoo fields in your model, example:

from odoo import fields

Then your class properties:

qmgr = fields.Char(store=False)

Then in your method assign the value:

self.qmgr = 'my value'.


 








อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hi, you could try to use __slots__ = ['qmgr']

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
readonly option in fields? แก้ไขแล้ว
3
ธ.ค. 23
89665
2
ก.ค. 22
3925
3
ธ.ค. 21
3666
3
ก.ย. 21
4405
1
ก.ย. 15
8487