diff options
| -rw-r--r-- | indoteknik_custom/models/account_move.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/indoteknik_custom/models/account_move.py b/indoteknik_custom/models/account_move.py index 1e0c56cf..54e51dcf 100644 --- a/indoteknik_custom/models/account_move.py +++ b/indoteknik_custom/models/account_move.py @@ -1,4 +1,5 @@ from odoo import models, api, fields +from odoo.exceptions import AccessError, UserError, ValidationError from datetime import timedelta @@ -12,6 +13,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 button_draft(self): + res = super(AccountMove, self).button_draft() + if not self.env.user.is_accounting: + raise UserError('Hanya Accounting yang bisa Reset to Draft') + return res + + def action_post(self): + res = super(AccountMove, self).action_post() + if not self.env.user.is_accounting: + raise UserError('Hanya Accounting yang bisa Posting') + return res + @api.onchange('date_kirim_tukar_faktur') def change_date_kirim_tukar_faktur(self): for invoice in self: |
