diff options
| -rw-r--r-- | indoteknik_custom/models/account_tax.py | 8 |
1 files changed, 8 insertions, 0 deletions
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 |
