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

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?