Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
7 ตอบกลับ
21241 มุมมอง
Since 17.0, the "attrs" and "states" attributes are no longer used.


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

In the place of attrs you can use condition directly in the invisible or readonly like this 
Without 'and' or 'or' condition

invisible = "state == 'new' "
readonly ="state != 'in_progress'"

With 'and' or 'or' condition

invisible = "state == 'new'  and martial_status == 'single'"
readonly ="state != 'in_progress' or martial_status == 'single'"

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

you will find this by serching in odoo base for invisible and readonly option and how to apply based on condition

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

Hi,

In odoo 17 some attributes are no longer used.

ie,

eg:

instead of attribute, attrs="{'invisible':[('state','=',new)]}"you can use invisible = "state = 'new' "


Hope it helps


อวตาร
ละทิ้ง

The above solution contains an error. The correct assignment should be invisible = "state == 'new'". The mistake lies in not using the '==' for comparison.

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

so what can be use instead this

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


 Hello


In odoo 17.0 not use “attrs” and “states”  attributes


field name=”demo” attrs=”{‘invisible’:[(‘state’, ‘!=’,‘draft’)] ‘readonly’:[(‘state’ , ‘==’,’done’)]}/ >


 instead of ,  Use attrs and states like Below code,

 

field name=”demo” invisible=”state != ‘draft’ ”  readonly=”state == ‘done’ ”/ >



 I hope this is helpful to you.


 Thanks & Regards,

 Email: odoo@devintellecs.com

 Skype: devintelle

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

Hello, 


In case of odoo17 there are several syntax have been changed in ORM.


For Eg.


In case of attribute, attrs="{'invisible':[('state','=',new)]}"you can use invisible = "state = 'new' "


For more you can check this: 


https://www.youtube.com/live/Fmr4JBzlDyY?si=Cb9AnxqQtae9Q4ys

อวตาร
ละทิ้ง

hello please is it the same for the codes that are used to calculate PAYSLIP
Here's the formula I use to calculate paid time off,
result = (contract.wage / 22) * worked_days.number_of_days.LEAVE120 but i have error

here is error

Erreur : <class 'AttributeError'>: "'dict' object has no attribute 'number_of_days'" while evaluating
'result = (contract.wage / 22) * worked_days.number_of_days.LEAVE120'

help me pliz

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

Hello!

Attrs is no longer used in v17, now you can directly use, for example, to dynamically set the invisible field the invisible attribute and an expression, like the following:


invisible="marital not in ['married', 'cohabitant']"/>

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
0
มี.ค. 25
413
1
ธ.ค. 24
929
1
ก.ค. 24
1035
2
เม.ย. 24
2291
Reordering rule 0-0-1 not working แก้ไขแล้ว
1
มี.ค. 25
513