Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIX] fleet: always include current month in costs report
When consulting the costs reports, if the beginning of the dates range has a day greater than the day of today (e.g., start date: 2021/02/25, today: 2021/07/10 => 25 > 10), the costs of the current month won't be include in the report. To reproduce the issue: (DB without any demo data. Let X be the day of the month for today) 1. Create a vehicle V 2. Add a service S1 for V - The category of the service type does not matter - Cost: 500 - Date: today 3. Add a second service S2 for V - Same service type - Cost: 250 - Date: Last month with a day > X (so if today is 2021/07/26, date could be 2021/06/27) 4. Fleet > Reporting > Costs Error: The report does not include S1 When generating the dates range, the current date is used as the end of the interval. Since the interval step is '1 month', it will lead to an issue in the above case: Suppose today is 2021/07/26, the interval starts on 2021/06/27. Then, if we add one month to this date, we have 2021/07/27, which is after the end of the interval (2021/07/26), so the date is ignored. As a result, current month won't be included in the report. Note: A similar issue can happen with the contracts OPW-2477004 closes #74219 Signed-off-by: Kevin Baptiste <kba@odoo.com>
- Loading branch information