Odoo Help

Welcome!

This community 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.

0

compare year from date picker with a year in dropdown

By
supreeth
on 1/10/15, 3:04 AM 520 views

Hi,

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.

 

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

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