From e92087e8f1270eadd6a809257226ff22938230dc Mon Sep 17 00:00:00 2001 From: Thomas Beckers Date: Thu, 27 Jan 2022 13:37:05 +0000 Subject: [PATCH] [FIX] Remove the context to disable prediction when importing invoices MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Allow the bill prediction when data like facturx is imported. This revert #68311 stating prediction might cause traceback when no account_id is found. Now, this error seems to not occur anymore. When importing data like facturx and no account_id is predicted, the default account set on the vendor journal will be set. opw-2662158 closes odoo/odoo#84092 X-original-commit: 1acece31eaf1417dea6ed330ac25c3b8de162baf Signed-off-by: William André (wan) --- addons/account_edi_facturx/models/account_edi_format.py | 3 +-- addons/account_edi_ubl/models/account_edi_format.py | 2 +- addons/l10n_it_edi/models/account_edi_format.py | 3 +-- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/addons/account_edi_facturx/models/account_edi_format.py b/addons/account_edi_facturx/models/account_edi_format.py index 02c0b2da64b..cbe8bd38a65 100644 --- a/addons/account_edi_facturx/models/account_edi_format.py +++ b/addons/account_edi_facturx/models/account_edi_format.py @@ -148,8 +148,7 @@ class AccountEdiFormat(models.Model): invoice.move_type = default_move_type # self could be a single record (editing) or be empty (new). - with Form(invoice.with_context(default_move_type=default_move_type, - account_predictive_bills_disable_prediction=True)) as invoice_form: + with Form(invoice.with_context(default_move_type=default_move_type)) as invoice_form: partner_type = invoice_form.journal_id.type == 'purchase' and 'SellerTradeParty' or 'BuyerTradeParty' invoice_form.partner_id = self._retrieve_partner( name=_find_value(f"//ram:{partner_type}/ram:Name"), diff --git a/addons/account_edi_ubl/models/account_edi_format.py b/addons/account_edi_ubl/models/account_edi_format.py index 1c89345307f..9a605c402f4 100644 --- a/addons/account_edi_ubl/models/account_edi_format.py +++ b/addons/account_edi_ubl/models/account_edi_format.py @@ -67,7 +67,7 @@ class AccountEdiFormat(models.Model): def _find_value(xpath, element=tree): return self._find_value(xpath, element, namespaces) - with Form(invoice.with_context(account_predictive_bills_disable_prediction=True)) as invoice_form: + with Form(invoice) as invoice_form: # Reference elements = tree.xpath('//cbc:ID', namespaces=namespaces) if elements: diff --git a/addons/l10n_it_edi/models/account_edi_format.py b/addons/l10n_it_edi/models/account_edi_format.py index 2320ef24158..f51a416188e 100644 --- a/addons/l10n_it_edi/models/account_edi_format.py +++ b/addons/l10n_it_edi/models/account_edi_format.py @@ -283,8 +283,7 @@ class AccountEdiFormat(models.Model): # Setup the context for the Invoice Form invoice_ctx = invoice.with_company(company) \ - .with_context(default_move_type=move_type, - account_predictive_bills_disable_prediction=True) + .with_context(default_move_type=move_type) # move could be a single record (editing) or be empty (new). with Form(invoice_ctx) as invoice_form: