Fix residual_amount searcher. Allow return sales with negative values.

Task: #059561
This commit is contained in:
Bernat Brunet 2022-06-16 14:17:50 +02:00
parent f0bf49f828
commit 6184f0d461
1 changed files with 1 additions and 4 deletions

View File

@ -169,12 +169,9 @@ class Sale(metaclass=PoolMeta):
'processing',
'done']))),
group_by=(sale.id),
having=(
(Sum(Coalesce(payline.amount, 0)) < sale.total_amount_cache)
& Operator(sale.total_amount_cache -
having=(Operator(sale.total_amount_cache -
Sum(Coalesce(payline.amount, 0)), value)
))
return [('id', 'in', query)]
@classmethod