Add account_payment_search_payment_amount.diff [account_payment] Optimize searcher search_payment_amount

This commit is contained in:
Juanjo Garcia 2020-10-14 14:08:09 +02:00
parent 66242c8372
commit d9318551b7
2 changed files with 23 additions and 0 deletions

View File

@ -0,0 +1,21 @@
diff --git a/account.py b/account.py
--- a/trytond/trytond/modules/account_payment/account.py
+++ b/trytond/trytond/modules/account_payment/account.py
@@ -116,7 +116,7 @@ class MoveLine(metaclass=PoolMeta):
account = Account.__table__()
account_type = AccountType.__table__()
- payment_amount = Sum(Coalesce(payment.amount, 0))
+ payment_amount = Coalesce(Sum(payment.amount), 0)
main_amount = Abs(table.credit - table.debit) - payment_amount
second_amount = Abs(table.amount_second_currency) - payment_amount
amount = Case((table.second_currency == Null, main_amount),
@@ -130,7 +130,7 @@ class MoveLine(metaclass=PoolMeta):
.join(account_type, condition=account.type == account_type.id)
.select(table.id,
where=(account_type.payable | account_type.receivable),
- group_by=(table.id, table.second_currency),
+ group_by=(table.id,),
having=Operator(amount, value)
))
return [('id', 'in', query)]

2
series
View File

@ -48,3 +48,5 @@ lazy_loading.diff # [trytond] https://discuss.tryton.org/t/should-create-uid-wri
issue9616.diff # [analytic_invoice] Analytic move is not created when closing an asset
fifo_quantity_round.diff # [product_cost_fifo] Round fifo_quantity before save, to avoid problems when compare with quantity
account_payment_search_payment_amount.diff # [account_payment] Optimize searcher search_payment_amount