[FIX] Remove the context to disable prediction when importing invoices
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) <wan@odoo.com>
This commit is contained in:
committed by
John Laterre (jol)
parent
a2991e458c
commit
e92087e8f1
@@ -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"),
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user