تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
2 الردود
4149 أدوات العرض

Im using openerp 7 and in the holiday module i have a requirement of comparing two dates literally but technically they are two diferent data types. Simply i want to collect all the employee who had applied leave for a back date. In the table there are two different columns as 'date from' (which is the applying leave date, may be a backdate) and request_confirm_date (which will record the current time stamp). So when a back date is applied as leave its request confirm date is the current time. So by comparing the logic 'date_from' <'request_confirm_date' i can fetch the employee. 
Here the problem is date_from is a datetime and request_confirm_date is a character.

In the xml i tried the following code and its say 'Cannot read property 'length' of undefined'

Here the code,


<filter name = "Leave Filters" string = "Leave Filters" domain = "[('date_from', '&lt; =', ((request_confirmed_date.strftime ('%% Y - %% m - %% d')) )] "/>


Uncaught TypeError: Cannot read property 'length' of undefined
الصورة الرمزية
إهمال
أفضل إجابة

Had the same issue in odoo10. The date methods can be only used in the search view in odoo10. For doing filtering by date I had to create another boolean field that is computed. The method for the computed field checks the date comparison and then sets the field to true or false. You can then filter based on the boolean field. 

الصورة الرمزية
إهمال
أفضل إجابة

why not make 1 field with data type DateTime, then compute by that Char field, you can use the compute field to compare

الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
4
مارس 15
5833
2
فبراير 18
3810
1
يناير 18
2937
1
أبريل 16
5036
0
أغسطس 15
5735