mirror of
https://github.com/OCA/bank-payment.git
synced 2025-02-02 10:37:31 +02:00
[REF] Payment Order: better performance of draft2open method
Add a norecompute in draft2open to avoid the recomputation of total_company_currency n times (where n is the number of payment lines)
This commit is contained in:
committed by
Carlos Roca
parent
c32321e7b5
commit
71d60d6d1d
@@ -280,7 +280,12 @@ class AccountPaymentOrder(models.Model):
|
|||||||
payline.ml_maturity_date,
|
payline.ml_maturity_date,
|
||||||
requested_date))
|
requested_date))
|
||||||
# Write requested_date on 'date' field of payment line
|
# Write requested_date on 'date' field of payment line
|
||||||
payline.date = requested_date
|
# norecompute is for avoiding a chained recomputation
|
||||||
|
# payment_line_ids.date
|
||||||
|
# > payment_line_ids.amount_company_currency
|
||||||
|
# > total_company_currency
|
||||||
|
with self.env.norecompute():
|
||||||
|
payline.date = requested_date
|
||||||
# Group options
|
# Group options
|
||||||
if order.payment_mode_id.group_lines:
|
if order.payment_mode_id.group_lines:
|
||||||
hashcode = payline.payment_line_hashcode()
|
hashcode = payline.payment_line_hashcode()
|
||||||
@@ -296,6 +301,7 @@ class AccountPaymentOrder(models.Model):
|
|||||||
'paylines': payline,
|
'paylines': payline,
|
||||||
'total': payline.amount_currency,
|
'total': payline.amount_currency,
|
||||||
}
|
}
|
||||||
|
order.recompute()
|
||||||
# Create bank payment lines
|
# Create bank payment lines
|
||||||
for paydict in list(group_paylines.values()):
|
for paydict in list(group_paylines.values()):
|
||||||
# Block if a bank payment line is <= 0
|
# Block if a bank payment line is <= 0
|
||||||
|
|||||||
Reference in New Issue
Block a user