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

Hello. I cant solve one task:
I have menu called "limited dates" in module called "characteristics" where I can add certain dates and there is field in another module called first_payment_date. I need to set validation error when someone will set date simillar to "limited date" but its in another module. how can i solve this?

아바타
취소
베스트 답변

you can make a function like given below in model where first_payment_date defined:

@api.constrains('first_payment_date')
def _check_first_payment_date(self):
    dates = self.env['limited.dates'].search([])
    for rec in self:
        if rec.date:
            limited_date_id = self.env['limited.dates'].search([('limited_date','=',rec.date)])
            if limited_date_id:
                raise ValidationError(_("You cannot set date set in limited dates!"))


Thanks & Regards,



CandidRoot Solutions Pvt. Ltd.

Mobile: (+91) 8849036209
Email: info@candidroot.com
Skype: live:candidroot
Web: https://www.candidroot.com
Address: 1229-1230, Iconic Shyamal, Near Shyamal Cross Road, Ahmedabad, Gujarat


아바타
취소
관련 게시물 답글 화면 활동
2
8월 23
3306
3
4월 23
2415
3
12월 22
34025
1
3월 15
7121
1
3월 15
5160