Odoo Help

0
2 Answers
1
Avatar

ayman mohammed adam

--ayman mohammed adam--
--ayman mohammed adam--


ayman mohammed adam
6/2/18, 5:01 AM

Dear Shaheryar,

Try This:

from odoo.exceptions import  ValidationError

    @api.multi
    @api.constrains('end_date', 'start_date')
    def date_constrains(self):

              for rec in self:

                      if rec.end_date < rec.start_date:

                           raise ValidationError(_('Sorry, End Date Must be greater Than Start Date...'))


I hope I help you...

1
Islamic Relief Canada
6/4/18, 11:28 AM

Hello Ayman,

Thanks for replying. How can I do this on Odoo Studio, the online Saas version?

I tried to use the following in Automated actions but that did not work.

def date_constrains(self):

              for rec in self:

                      if rec.end_date < rec.start_date:

                           raise ValidationError(_('Sorry, End Date Must be greater Than Start Date...'))

Ask a Question
Keep Informed
1 follower(s)
About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register
Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now