[MIG] pos_check_deposit to v18

This commit is contained in:
Alexis de Lattre
2024-12-24 12:29:14 +01:00
parent 13744fc404
commit 29a2739c18
8 changed files with 129 additions and 79 deletions

View File

@@ -1,4 +1,4 @@
# Copyright 2022 Akretion France (http://www.akretion.com/)
# Copyright 2022-2024 Akretion France (http://www.akretion.com/)
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
@@ -9,8 +9,14 @@ from odoo.exceptions import ValidationError
class PosPaymentMethod(models.Model):
_inherit = "pos.payment.method"
split_transactions = fields.Boolean(string="Split Transactions")
identify_customer = fields.Boolean(string='Identify Customer')
# native field, just change string (origin string is "Identify Customer")
split_transactions = fields.Boolean(
string="Split Transactions",
help="Splits the journal entries for each transaction. It could slow down the closing process.",
)
# new field
identify_customer = fields.Boolean(
compute='_compute_identify_customer', store=True, readonly=False, precompute=True)
@api.constrains('split_transactions', 'identify_customer')
def _check_split_transactions_identify_customer(self):
@@ -21,7 +27,8 @@ class PosPaymentMethod(models.Model):
"is enabled, so the option 'Split Transactions' must "
"be enabled too.") % method.display_name)
@api.onchange('split_transactions')
def split_transactions_change(self):
if not self.split_transactions and self.identify_customer:
self.identify_customer = False
@api.depends('split_transactions')
def _compute_identify_customer(self):
for method in self:
if not method.split_transactions and method.identify_customer:
method.identify_customer = False