[FIX] account : No cash journal
Current behavior: When changing the type of a payment journal used in a cash payment method you couldn't close a PoS that used this payment method Steps to reproduce: - Point of Sale > Configuration > Payment Methods - Select 'Cash' payment method, go to journal 'Cash', edit the type to 'Bank' - Go to a Pos session, then try to close it. opw-2732933 closes odoo/odoo#83343 X-original-commit: 43b64a78888d5b79d87491caf1401964228809fc Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com> Signed-off-by: Engels Robin (roen) <roen@odoo.com>
This commit is contained in:
@@ -5982,6 +5982,13 @@ msgid ""
|
||||
" specific tax rates."
|
||||
msgstr ""
|
||||
|
||||
#. module: point_of_sale
|
||||
#: code:addons/point_of_sale/models/account_journal.py:0
|
||||
#, python-format
|
||||
msgid ""
|
||||
"This journal is associated with a payment method. You cannot modify its type"
|
||||
msgstr ""
|
||||
|
||||
#. module: point_of_sale
|
||||
#. openerp-web
|
||||
#: code:addons/point_of_sale/static/src/js/ChromeWidgets/DebugWidget.js:0
|
||||
|
||||
@@ -1,10 +1,16 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
# Copyright (C) 2004-2008 PC Solutions (<http://pcsol.be>). All Rights Reserved
|
||||
from odoo import fields, models, api
|
||||
|
||||
from odoo import fields, models, api, _
|
||||
from odoo.exceptions import ValidationError
|
||||
|
||||
class AccountJournal(models.Model):
|
||||
_inherit = 'account.journal'
|
||||
|
||||
pos_payment_method_ids = fields.One2many('pos.payment.method', 'journal_id', string='Point of Sale Payment Methods')
|
||||
|
||||
@api.constrains('type')
|
||||
def _check_type(self):
|
||||
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"))
|
||||
|
||||
Reference in New Issue
Block a user