Odoo Ayuda

0

0
1 Answer
1
Avatar
--Hilar AK--
  Blog:-
        https://hilarlive.wordpress.com/
  StackOverflow:
        http://stackoverflow.com/users/7561347/burmese-pythis

Quora:
    

            https://www.quora.com/profile/Hilar-Ak-1

Experienced Odoo developer, Functional Consultant.



Hilar AK
5/5/19 0:56

The comparison with date field you have done is absolutely wrong. The odoo DB stores the date or datetime field as a string. So you have to parse the date fields before comparison. If you are not parsing the string to date object then the system compares str() == str() and always returns True. I can give you examples fo parsing a string to date or datetime object.

EG:

str_to_date = fields.Date.from_string(field_name) # '12/02/2019'  --> Date(12, 02, 2019)
str_to_datetime = fields.Datetime.from_string(field_name) # '12/02/2019 08:50:00' --> Datetime(12, 02, 2019, 08, 50, 00)
Realizar una pregunta
Writer
Keep Informed
1 seguidor(es)
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