[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:
Thomas Binsfeld
2019-01-17 15:23:26 +01:00
committed by David Ramia
parent 372fa9fa3d
commit 447fab8fc0
3 changed files with 17 additions and 10 deletions

View File

@@ -9,15 +9,15 @@ msgstr ""
"Project-Id-Version: Odoo Server 11.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-05-01 15:18+0000\n"
"PO-Revision-Date: 2018-10-30 21:07+0000\n"
"Last-Translator: Mathias Neef <mathias.neef@syscoon.com>\n"
"PO-Revision-Date: 2019-01-18 11:41+0000\n"
"Last-Translator: Joel Michaud <joel.michaud@braintec-group.com>\n"
"Language-Team: German (https://www.transifex.com/oca/teams/23907/de/)\n"
"Language: de\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 3.2.2\n"
"X-Generator: Weblate 3.3\n"
#. module: account_payment_order
#: code:addons/account_payment_order/models/account_invoice.py:119
@@ -34,7 +34,7 @@ msgid ""
"%d payment lines added to the new draft payment order %s which has been "
"automatically created."
msgstr ""
"%d Zahlungszeilen, wurden dem bestehenden Zahlungsauftrag %d hinzugefügt."
"%d Zahlungszeilen, wurden dem bestehenden Zahlungsauftrag %s hinzugefügt."
#. module: account_payment_order
#: model_terms:ir.ui.view,arch_db:account_payment_order.print_account_payment_order_document

View File

@@ -9,14 +9,15 @@ msgstr ""
"Project-Id-Version: Odoo Server 11.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-05-01 15:18+0000\n"
"PO-Revision-Date: 2018-05-01 15:18+0000\n"
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2017\n"
"PO-Revision-Date: 2019-01-21 15:41+0000\n"
"Last-Translator: Raf Ven <raf.ven@dynapps.be>\n"
"Language-Team: Dutch (https://www.transifex.com/oca/teams/23907/nl/)\n"
"Language: nl\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 3.3\n"
#. module: account_payment_order
#: code:addons/account_payment_order/models/account_invoice.py:119
@@ -367,7 +368,7 @@ msgstr "Valuta van de betaaltransactie"
#: model:ir.actions.act_window,name:account_payment_order.account_payment_order_inbound_action
#: model:ir.ui.menu,name:account_payment_order.account_payment_order_inbound_menu
msgid "Debit Orders"
msgstr "Betaalopdrachten"
msgstr "Inkomende Betaalopdrachten"
#. module: account_payment_order
#: code:addons/account_payment_order/models/account_payment_order.py:444
@@ -1019,7 +1020,7 @@ msgstr ""
#: model_terms:ir.ui.view,arch_db:account_payment_order.account_payment_order_pivot
#: model_terms:ir.ui.view,arch_db:account_payment_order.account_payment_order_tree
msgid "Payment Orders"
msgstr "Betaalopdrachten"
msgstr "Uitgaande Betaalopdrachten"
#. module: account_payment_order
#: model:ir.model.fields,field_description:account_payment_order.field_account_invoice__reference_type

View File

@@ -280,7 +280,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()
@@ -296,6 +301,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