From a5e3151dc5afa25d9dc36d7448165eaa6654d4f9 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Fri, 9 Jun 2023 12:59:26 +0700 Subject: Disable button delete on table product and contact --- indoteknik_custom/models/res_partner.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'indoteknik_custom/models/res_partner.py') diff --git a/indoteknik_custom/models/res_partner.py b/indoteknik_custom/models/res_partner.py index eaf93717..77abaaf9 100644 --- a/indoteknik_custom/models/res_partner.py +++ b/indoteknik_custom/models/res_partner.py @@ -1,4 +1,5 @@ from odoo import models, fields +from odoo.exceptions import UserError, ValidationError class GroupPartner(models.Model): _name = 'group.partner' @@ -13,3 +14,9 @@ class ResPartner(models.Model): custom_pricelist_id = fields.Many2one('product.pricelist', string='Price Matrix') group_partner_id = fields.Many2one('group.partner', string='Group Partner') + def unlink(self): + if self._name == 'res.partner': + raise UserError('Maaf anda tidak bisa delete contact') + + + -- cgit v1.2.3