Skip to content
Snippets Groups Projects
Commit 279b3a8a authored by Nicolas Martinelli's avatar Nicolas Martinelli
Browse files

[FIX] account_tax_cash_basis: raise if no account

Since the account is a mandatory field, we raise an clear error is no
account is defined.

This is necessary when running an automatic reconciliation on the POS.
The POS uses a try/except to avoid any error, but in the case of an SQL
error, the cursor is invalidated, so the transaction fails.

opw-741677
parent be1ca7b1
Branches
Tags
No related merge requests found
......@@ -40,6 +40,12 @@ msgstr ""
msgid "Partial Reconcile"
msgstr ""
#. module: account_tax_cash_basis
#: code:addons/account_tax_cash_basis/models/account_partial_reconcile.py:39
#, python-format
msgid "Please configure a Tax Received Account for tax %s"
msgstr ""
#. module: account_tax_cash_basis
#: model:ir.model.fields,help:account_tax_cash_basis.field_account_tax_use_cash_basis
msgid "Select this if the tax should use cash basis,which will create an entry for this tax on a given account during reconciliation"
......
......@@ -35,6 +35,8 @@ class AccountPartialReconcileCashBasis(models.Model):
tax_group[acc] = amount
# Group by cash basis account and tax
acc = line.tax_line_id.cash_basis_account.id
if not acc:
raise UserError(_('Please configure a Tax Received Account for tax %s') % line.tax_line_id.name)
key = (acc, line.tax_line_id.id)
if key in total_by_cash_basis_account:
total_by_cash_basis_account[key] += amount
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment