summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models/account_move.py
diff options
context:
space:
mode:
authorRafi Zadanly <zadanlyr@gmail.com>2023-02-13 10:41:41 +0700
committerRafi Zadanly <zadanlyr@gmail.com>2023-02-13 10:41:41 +0700
commitcfa0aa5c242b14332f7bc970bb65f1fbde0a9f3b (patch)
tree91f855964cadb0c76094cd2cc6b51f7994ce0c6d /indoteknik_custom/models/account_move.py
parentfb04f8f3c533740c79c130ab4bc097b8529cae8e (diff)
parent7478616937cff56ccb994138831f90eae904e724 (diff)
fix conflict
Diffstat (limited to 'indoteknik_custom/models/account_move.py')
-rw-r--r--indoteknik_custom/models/account_move.py13
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: