@@ -44,15 +44,16 @@ def _reapply_sla(self, cr, uid, ids, recalc_closed=False, context=None):
44
44
ctrl_models = set ([sla .control_model for sla in contract .sla_ids ])
45
45
for model_name in ctrl_models :
46
46
model = self .pool [model_name ]
47
- domain = [] if recalc_closed else [('stage_id.fold' , '=' , 1 )]
47
+ base = [] if recalc_closed else [('stage_id.fold' , '=' , 0 )]
48
+ doc_ids = []
48
49
if 'analytic_account_id' in model ._columns :
49
- domain .append (
50
- ('analytic_account_id' , '=' , contract .id ))
50
+ domain = base + [
51
+ ('analytic_account_id' , '=' , contract .id )]
52
+ doc_ids += model .search (cr , uid , domain , context = context )
51
53
if 'project_id' in model ._columns :
52
- domain .append (
53
- ('project_id.analytic_account_id' , '=' , contract .id ))
54
-
55
- doc_ids = model .search (cr , uid , domain , context = context )
54
+ domain = base + [
55
+ ('project_id.analytic_account_id' , '=' , contract .id )]
56
+ doc_ids += model .search (cr , uid , domain , context = context )
56
57
if doc_ids :
57
58
model = self .pool [model_name ]
58
59
docs = model .browse (cr , uid , doc_ids , context = context )
0 commit comments