Odoo Help


compare year from date picker with a year in dropdown

on 1/10/15, 3:04 AM 784 views


I am trying to compare year from date picker with a year in dropdown (hardcoded year), so if it doesnt match "show error".

This is my code:

 def _check_year_match(self, cr, uid, ids, context=None):
  holiday_year = self.pool.get('holiday')
  holiday_date_year = self.pool.get('holiday.line')
  hol_year1 = holiday_year.browse(cr, uid,[],context=context)
  hol_year2 = holiday_date_year.search(cr, uid,[],context=context)
  cal_year = hol_year2.date_start('%Y',hol_year2.date_start(datetime, "%Y"))
  for x in cal_year.browse(cr, uid, sr_ids, context=context):
   if x.id != ids[0]:
    for self_obj in self.browse(cr, uid, ids, context=context):
     if x.holiday_id == self_obj.holiday_id and x.year != cal_year:
      return False
  return True


I know this is some junk I have written.  Please help.

Or is there a way where I can have a option to select only date and month.


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.


Odoo Training Center

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

Test it now

Question tools

1 follower(s)


Asked: 1/10/15, 3:04 AM
Seen: 784 times
Last updated: 3/16/15, 8:10 AM