From 2d339457c57d1795f587cc571f252029dee3fcb7 Mon Sep 17 00:00:00 2001 From: Sylvain LE GAL Date: Sat, 22 Feb 2025 12:57:49 +0100 Subject: [PATCH] [IMP] fiscal_company_point_of_sale: prevent creation of pos.payment.method at Group or CAE level --- fiscal_company_point_of_sale/models/__init__.py | 1 + .../models/pos_payment_method.py | 15 +++++++++++++++ .../readme/DESCRIPTION.rst | 3 +++ 3 files changed, 19 insertions(+) create mode 100644 fiscal_company_point_of_sale/models/pos_payment_method.py diff --git a/fiscal_company_point_of_sale/models/__init__.py b/fiscal_company_point_of_sale/models/__init__.py index 3b8ec40..e954de6 100644 --- a/fiscal_company_point_of_sale/models/__init__.py +++ b/fiscal_company_point_of_sale/models/__init__.py @@ -1,2 +1,3 @@ from . import pos_config +from . import pos_payment_method from . import account_payment diff --git a/fiscal_company_point_of_sale/models/pos_payment_method.py b/fiscal_company_point_of_sale/models/pos_payment_method.py new file mode 100644 index 0000000..15a01c4 --- /dev/null +++ b/fiscal_company_point_of_sale/models/pos_payment_method.py @@ -0,0 +1,15 @@ +# Copyright (C) 2025-Today: GRAP (http://www.grap.coop) +# @author: Sylvain LE GAL (https://twitter.com/legalsylvain) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo import models + + +class PosPaymentMethod(models.Model): + _name = "pos.payment.method" + _inherit = [ + "pos.payment.method", + "fiscal.company.check.company.mixin", + ] + + _fiscal_company_forbid_fiscal_type = ["group", "fiscal_mother"] diff --git a/fiscal_company_point_of_sale/readme/DESCRIPTION.rst b/fiscal_company_point_of_sale/readme/DESCRIPTION.rst index 1aa2842..dee1aa9 100644 --- a/fiscal_company_point_of_sale/readme/DESCRIPTION.rst +++ b/fiscal_company_point_of_sale/readme/DESCRIPTION.rst @@ -7,3 +7,6 @@ This module is a glue module for the Odoo Point of Sale module. **Features** - Remove bad checks regarding company journals of ``pos.config`` models. + +- Prevent to create ``pos.config`` and ``pos.payment.method`` at Group + or CAE level.