@@ -31,7 +31,10 @@ def action_open_report(self):
31
31
_get_work_days = ContractedLine ._get_work_days_dates
32
32
mtd_fraction = _get_work_days (
33
33
self .reference_date .replace (day = 1 ), self .reference_date
34
- ) / _get_work_days (month .date_start , month .date_end )
34
+ ) / _get_work_days (
35
+ month .date_start or self .reference_date .replace (day = 1 ),
36
+ month .date_end or self .reference_date ,
37
+ )
35
38
for project in self .env ["project.project" ].search (
36
39
[("ps_contracted_line_ids" , "!=" , False )]
37
40
):
@@ -75,8 +78,14 @@ def action_open_report(self):
75
78
TimeLine .search (
76
79
[
77
80
("task_id.project_id" , "=" , project .id ),
78
- ("date" , ">=" , month .date_start .replace (month = 1 , day = 1 )),
79
- ("date" , "<" , month .date_start ),
81
+ (
82
+ "date" ,
83
+ ">=" ,
84
+ (month .date_start or self .reference_date ).replace (
85
+ month = 1 , day = 1
86
+ ),
87
+ ),
88
+ ("date" , "<" , month .date_start or self .reference_date ),
80
89
("product_uom_id" , "=" , uom_hours .id ),
81
90
]
82
91
).mapped (lambda x : x .unit_amount / 8 )
@@ -87,9 +96,15 @@ def action_open_report(self):
87
96
(
88
97
"range_id.date_start" ,
89
98
">=" ,
90
- month .date_start .replace (month = 1 , day = 1 ),
99
+ (month .date_start or self .reference_date ).replace (
100
+ month = 1 , day = 1
101
+ ),
102
+ ),
103
+ (
104
+ "range_id.date_end" ,
105
+ "<" ,
106
+ month .date_start or self .reference_date ,
91
107
),
92
- ("range_id.date_end" , "<" , month .date_start ),
93
108
("task_id.project_id" , "=" , project .id ),
94
109
("line_type" , "=" , "contracted" ),
95
110
]
0 commit comments