diff options
| author | stephanchrst <stephanchrst@gmail.com> | 2023-03-04 09:05:07 +0700 |
|---|---|---|
| committer | stephanchrst <stephanchrst@gmail.com> | 2023-03-04 09:05:07 +0700 |
| commit | 5b0b7a4de90d5c48a52006b3a12ef8a98f0b68aa (patch) | |
| tree | d94e91282f5d1a54493cc75158b9817f2eb07cd8 | |
| parent | ae1c2a5daeffb13cffb010c2b9db062f3baf10e8 (diff) | |
cant delete or cancel if not accounting
| -rw-r--r-- | indoteknik_custom/models/account_move.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/indoteknik_custom/models/account_move.py b/indoteknik_custom/models/account_move.py index 18dbfba7..5ac691ac 100644 --- a/indoteknik_custom/models/account_move.py +++ b/indoteknik_custom/models/account_move.py @@ -14,6 +14,18 @@ class AccountMove(models.Model): date_terima_tukar_faktur = fields.Date(string='Terima Faktur') shipper_faktur_id = fields.Many2one('delivery.carrier', string='Shipper Faktur') + def unlink(self): + res = super(AccountMove, self).unlink() + if not self.env.user.is_accounting: + raise UserError('Hanya Accounting yang bisa delete') + return res + + def button_cancel(self): + res = super(AccountMove, self).button_cancel() + if not self.env.user.is_accounting: + raise UserError('Hanya Accounting yang bisa Cancel') + return res + def button_draft(self): res = super(AccountMove, self).button_draft() if not self.env.user.is_accounting: |
