From 6cfbf125b6154a2dc0fe3aec6f433b94584c91fe Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Tue, 24 Sep 2024 16:47:43 +0700 Subject: cr account tax --- indoteknik_custom/models/account_tax.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/indoteknik_custom/models/account_tax.py b/indoteknik_custom/models/account_tax.py index e698d5ec..e39546f2 100644 --- a/indoteknik_custom/models/account_tax.py +++ b/indoteknik_custom/models/account_tax.py @@ -11,4 +11,12 @@ class AccountTax(models.Model): if self.env.user.id not in users_in_group.mapped('id'): raise UserError('Hanya IT yang bisa membuat tax') result = super(AccountTax, self).create(vals) + return result + + def write(self, values): + group_id = self.env.ref('indoteknik_custom.group_role_it').id + users_in_group = self.env['res.users'].search([('groups_id', 'in', [group_id])]) + if self.env.user.id not in users_in_group.mapped('id'): + raise UserError('Hanya IT yang bisa mengedit tax') + result = super(AccountTax, self).write(values) return result \ No newline at end of file -- cgit v1.2.3