Adding a new record automatically
First off, make it more maintainable: break out that long list comprehension into a for loop so it's clearer where line is coming from. 

As for optimization, since size_list_situation_ids doesn't change through the loop, you can refactor those trinary ops into functions and then set them just once at the beginning:

if size_list_situation_ids:
    prev_amount_ht = lambda l: l.cumulative_amount_ht
    amount_net_ht = lambda l, l1: l.cumulative_amount_ht - l1.cumulative_amount_ht
else:
    prev_amount_ht = lambda l: 0
    amount_net_ht = lambda l, l1: l.cumulative_amount_ht


and then do:

...
'previous_amount_ht': prev_amount_ht(line1),
'amount_net_ht': amount_net_ht(line, line1),
...


which saves a couple of comparisons every time through the loop. 

Much more than that is difficult to suss out, since the code looks non-functional overall: where does situation_orders come from? Why is the initial task_lines even being loaded, as it doesn't seem to be used?