Fix: Operador And y total_amount_cache != None

This commit is contained in:
sinergia 2024-11-10 18:18:14 -05:00
parent 8211278e78
commit a4e9001bd6

View File

@ -2,6 +2,7 @@
# The COPYRIGHT file at the top level of this repository contains the full
# copyright notices and license terms.
from decimal import Decimal
from sql.operators import And
from sql.aggregate import Sum
from sql.conditionals import Coalesce
@ -162,13 +163,14 @@ class Sale(metaclass=PoolMeta):
condition=(sale.id == payline.sale)
).select(
sale.id,
where=((sale.total_amount_cache) & (
where=(And([
sale.total_amount_cache != None,
sale.state.in_([
'draft',
'quotation',
'confirmed',
'processing',
'done']))),
'done'])])),
group_by=(sale.id),
having=(Operator(
sale.total_amount_cache - Sum(