start date= '14/8/2019'
end date= '16/3/2022'
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Contabilidad
- Inventario
- PoS
- Project
- MRP
Se marcó esta pregunta
You can use the python datetime module to find the number of days between each month in Odoo. Here is an example of how you could use python code to find the number of days between two specific months in Odoo:
Copy code
from datetime import datetime, timedelta
# Define the start and end date for the period
start_date = datetime.strptime("2022-01-01", "%Y-%m-%d")
end_date = datetime.strptime("2022-12-31", "%Y-%m-%d")
# Calculate the number of days between the start and end date
delta = end_date - start_date
# Print the number of days between the start and end date
print(delta.days)
This code will output the number of days between January 1st, 2022 and December 31st, 2022.
You can also use the built-in functions of the Odoo ORM to find the number of days between each month, for example
Copy code
from odoo import api
# Define the start and end date for the period
start_date = datetime.strptime("2022-01-01", "%Y-%m-%d")
end_date = datetime.strptime("2022-12-31", "%Y-%m-%d")
# use built-in function of the ORM
with api.Environment.manage():
env = api.Environment(cr, uid, {})
days = env['account.move.line'].search_count([('date', '>=', start_date), ('date', '<=', end_date)])
print(days)
It will give you the count of days between the two dates by searching for them in the 'account.move.line' model.
Please note that the above code is just an example and would need to be adapted to the specific use case and implemented in the correct context of your Odoo application
¿Le interesa esta conversación? ¡Participe en ella!
Cree una cuenta para poder utilizar funciones exclusivas e interactuar con la comunidad.
InscribirsePublicaciones relacionadas | Respuestas | Vistas | Actividad | |
---|---|---|---|---|
|
1
jun 23
|
2256 | ||
|
0
sept 22
|
1983 | ||
|
1
ago 22
|
2851 | ||
|
0
ago 22
|
2137 | ||
|
1
mar 22
|
1728 |