Skip to content
Snippets Groups Projects
Commit 3f66030c authored by arsi's avatar arsi
Browse files

[FIX] point_of_sale: add outstanding accounts set in payment methods


For a `pos.payment.method`, it is possible to define an outstanding
account, but if this account is not defined as an outstanding account in
the company settings nor in the journal, the payment will not be
considered in the bank reconciliation, nor in the bank reconciliation
report.

Steps to reproduce (demo-data with POS and Accounting installed):
-go to 'Point of Sale/Configuration/Payment Methods'.
-click on the "Bank" payment method.
-add an 'Outstanding Account' which is not the default outstanding
 account of the company, nor an outstanding account of an
 `account.payment.method.line`.  So for example "Liquidity Transfer".
-then open a POS session, sell smth, pay with the Bank method, validate,
 then close the session.
-If you go to 'Accounting/Customers/Payments', you can see that an
 `account.payment` has been created, with the outstanding account being
 "Liquidity Transfer".
->It is not possible to reconcile that payment with a
 `account.bank.statement.line`. If you go to the accounting dashboard,
 then click the reconcile button of the journal "Bank", then on a
 statement line with no partner, you will not see the outstanding line
 of that payment.
->If you open the 'Reconciliation Report' of the journal "Bank"
 (accessible from the journal dashboard, by clicking the options of the
 journal), the line will not show in the 'Outstanding Receipts'
 category.

FIX:
Override the `_get_journal_inbound_outstanding_payment_accounts`
method of `account.journal`, to add the accounts from each
`pos.payment.method` linked to the journal.  Using the field
`pos_payment_method_ids` from `account.journal`.

opw-3271090

closes odoo/odoo#125178

X-original-commit: c002e6bf
Signed-off-by: default avatarJoseph Caburnay (jcb) <jcb@odoo.com>
Signed-off-by: default avatarArnaud-Sibille (arsi) <arsi@odoo.com>
parent 5ac58ebf
Branches
Tags
No related merge requests found
......@@ -14,3 +14,10 @@ class AccountJournal(models.Model):
methods = self.env['pos.payment.method'].sudo().search([("journal_id", "in", self.ids)])
if methods:
raise ValidationError(_("This journal is associated with a payment method. You cannot modify its type"))
def _get_journal_inbound_outstanding_payment_accounts(self):
res = super()._get_journal_inbound_outstanding_payment_accounts()
account_ids = set(res.ids)
for payment_method in self.sudo().pos_payment_method_ids:
account_ids.add(payment_method.outstanding_account_id.id or self.company_id.account_journal_payment_debit_account_id.id)
return self.env['account.account'].browse(account_ids)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment