[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#125238 X-original-commit: c002e6bfbb194b0d609956b36f23a5dbf7acffd4 Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com> Signed-off-by: Arnaud-Sibille (arsi) <arsi@odoo.com>
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user