Can I calculate the different in two giving date fields in different field using Compute in Odoo
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Accounting
- Inventory
- PoS
- Project management
- MRP
This question has been flagged
Hi,
See the sample:
from datetime import datetime
def days_between(d1, d2):
d1 = datetime.strptime(d1, "%Y-%m-%d")
d2 = datetime.strptime(d2, "%Y-%m-%d")
return abs((d2 - d1).days)
Thanks
Niyas
Thanks for replying to me
But I want to use computed field to get automated calculation. And I need to define date start field and date end field - so how can I do that
You just have to create your functional field and use the above code to get the difference between the 2 dates.
Enjoying the discussion? Don't just read, join in!
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign up