mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[ADD] inheritence of ir.config_parameter
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
|
||||
from . import ir_http
|
||||
from . import ir_sequence
|
||||
from . import ir_config_parameter
|
||||
|
||||
# from . import payment_return
|
||||
from . import pms_board_service_room_type
|
||||
|
||||
22
pms/models/ir_config_parameter.py
Normal file
22
pms/models/ir_config_parameter.py
Normal file
@@ -0,0 +1,22 @@
|
||||
from odoo import _, api, models
|
||||
from odoo.exceptions import ValidationError
|
||||
|
||||
|
||||
class IrConfigParameter(models.Model):
|
||||
_inherit = "ir.config_parameter"
|
||||
|
||||
def unlink(self):
|
||||
for record in self:
|
||||
if (
|
||||
record.key == "product.product_pricelist_setting"
|
||||
and record.value == "advanced"
|
||||
):
|
||||
raise ValidationError(_("Cannot delete this parameter"))
|
||||
return super().unlink()
|
||||
|
||||
@api.constrains("key", "value")
|
||||
def check_value(self):
|
||||
if self.key == "product.product_pricelist_setting" and self.value != "advanced":
|
||||
raise ValidationError(
|
||||
_("The parameter Advanced price rules cannot be modified")
|
||||
)
|
||||
Reference in New Issue
Block a user