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

In a demo instance previous to production release, I created an automated action to avoid VAT duplication and got a message where Warning is not recognized in the execution phase!!! There is no message of a syntaxis error. Next the code:


if record.vat:
   contact = env ['res.partner'].search([['vat','=',record.vat]])
   if contact:
     for c in contact:
         if c.id != record.id:
            raise Warning ('VAT is duplicated, change it pls')


Any idea to solve this problem? This was working properly before the last version update

아바타
취소
작성자

It worked!!! Thank you very very very very much!!!

what would be the code to avoid creating contact with same email?

베스트 답변

Hi,

Instead of Warning, use UserError and  see.


# - UserError: exception class for raising user-facing warning messages


Thanks 

아바타
취소
베스트 답변

UserError blocks the execution. Is there a function to just show a warning, but not stop execution?

아바타
취소

Hi Trond, I have the same issue, got a solution please ?

Same question here.
All xxxError block the execution.
I need a warning only and the execution of the current process to be finished.
Looking forward to see any feedback

Hi Höppner and Mohammed.
Sorry, no, never found an alternative to UserError.

관련 게시물 답글 화면 활동
0
2월 24
1026
1
1월 23
2063
1
11월 23
2272
3
10월 23
3046
2
12월 23
5903