Merge pull request #538 from acsone/12.0-ref_account_payment_order_draft2open_tbi

[12.0] [REF] Payment Order: better performance of draft2open method
This commit is contained in:
Pedro M. Baeza
2019-03-15 11:01:13 +01:00
committed by GitHub

View File

@@ -279,7 +279,12 @@ class AccountPaymentOrder(models.Model):
payline.ml_maturity_date,
requested_date))
# 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
if order.payment_mode_id.group_lines:
hashcode = payline.payment_line_hashcode()
@@ -295,6 +300,7 @@ class AccountPaymentOrder(models.Model):
'paylines': payline,
'total': payline.amount_currency,
}
order.recompute()
# Create bank payment lines
for paydict in list(group_paylines.values()):
# Block if a bank payment line is <= 0