[FIX] point_of_sale: No payment methods after validating bank statement.
Before the fix, it was possible to validate a bank statement of a POS without validating the entire POS session. After the fix it's impossible to validate the bank statement of an opened POS session. We now have an error message if we try to do it from accounting app and can't see the validate button anymore from the POS app. TASK-ID: 2001551 closes odoo/odoo#33986 Signed-off-by: pimodoo <pimodoo@users.noreply.github.com>
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
# -*- 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
|
||||
from odoo import fields, models, api, _
|
||||
from odoo.exceptions import UserError
|
||||
|
||||
|
||||
class AccountBankStatement(models.Model):
|
||||
@@ -10,6 +11,13 @@ class AccountBankStatement(models.Model):
|
||||
pos_session_id = fields.Many2one('pos.session', string="Session", copy=False)
|
||||
account_id = fields.Many2one('account.account', related='journal_id.default_debit_account_id', readonly=True)
|
||||
|
||||
@api.multi
|
||||
def check_confirm_bank(self):
|
||||
for bs in self:
|
||||
if bs.pos_session_id.state in ('opened', 'closing_control') and bs.state == 'open':
|
||||
raise UserError(_("You can't validate a bank statement that is used in an opened Session of a Point of Sale."))
|
||||
return super( AccountBankStatement, self).check_confirm_bank()
|
||||
|
||||
|
||||
class AccountBankStatementLine(models.Model):
|
||||
_inherit = 'account.bank.statement.line'
|
||||
|
||||
@@ -19,4 +19,15 @@
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_bank_statement_pos_session" model="ir.ui.view">
|
||||
<field name="name">view.bank.statement.pos.session</field>
|
||||
<field name="model">account.bank.statement</field>
|
||||
<field name="mode">primary</field>
|
||||
<field name="priority">1000</field>
|
||||
<field name="inherit_id" ref="account.view_bank_statement_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//button[@name='check_confirm_bank']" position="replace"/>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
|
||||
@@ -120,7 +120,7 @@
|
||||
</div>
|
||||
</group>
|
||||
<separator string="Summary by Payment Methods" attrs="{'invisible' : [('state', '=', 'opening_control')]}"/>
|
||||
<field name="statement_ids" attrs="{'invisible' : [('state', '=', 'opening_control')]}">
|
||||
<field name="statement_ids" attrs="{'invisible' : [('state', '=', 'opening_control')]}" context="{'form_view_ref': 'point_of_sale.view_bank_statement_pos_session'}">
|
||||
<tree string="Statements">
|
||||
<field name="name" />
|
||||
<field name="journal_id" />
|
||||
|
||||
Reference in New Issue
Block a user