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

Hello,

Does anyone know if it's possible to add constraints to a model from an app created with Odoo Studio ?

Thanks !

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

Thank you Pinakin ! I'll dig into Python then ! I'm sorry I don't have enough karma to answer you directly.

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

Here's a workaround. You can create an automated action that triggers on creation and update. The action should execute Python code. Then in the code, just write what you would write in a constrains method. Something like:

for record in records:
  if record.type == 'service' and record.purchase_method != 'purchase':
    raise Warning("Nice try, but nope!")

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

Not possible.. To add constraint you need some python code and odoo studio help you only to design your xml. So with the use of Studio you can't add constraint..

อวตาร
ละทิ้ง

Then how to add constraints in Odoo enterprise 12.0 online version. Where to access the python code?