LaOsaCoop/Odoo16#14 migration pos_customer_required

This commit is contained in:
Luis 2025-05-11 18:40:33 +02:00
parent b062c383d5
commit 08fca37c6d
27 changed files with 1438 additions and 0 deletions

View file

@ -0,0 +1,22 @@
# Copyright 2004 apertoso NV - Jos DE GRAEVE <Jos.DeGraeve@apertoso.be>
# Copyright 2016 La Louve - Sylvain LE GAL <https://twitter.com/legalsylvain>
# Copyright 2019 Druidoo - (https://www.druidoo.io)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)
from odoo import _, api, exceptions, fields, models
class PosOrder(models.Model):
_inherit = "pos.order"
require_customer = fields.Selection(
related="session_id.config_id.require_customer",
)
@api.constrains("partner_id", "session_id")
def _check_partner(self):
for rec in self:
if rec.require_customer != "no" and not rec.partner_id:
raise exceptions.ValidationError(
_("Customer is required for this order and is missing.")
)