diff options
| author | Azka Nathan <darizkyfaz@gmail.com> | 2024-09-24 16:47:43 +0700 |
|---|---|---|
| committer | Azka Nathan <darizkyfaz@gmail.com> | 2024-09-24 16:47:43 +0700 |
| commit | 6cfbf125b6154a2dc0fe3aec6f433b94584c91fe (patch) | |
| tree | 89bd93f978f36823e66b69e7223337264f609e5b | |
| parent | 733b749bb4979e0488b02da48b4116774945d6b5 (diff) | |
cr account tax
| -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 |
