summaryrefslogtreecommitdiff
path: root/fixco_custom/models/account_move.py
diff options
context:
space:
mode:
authorMqdd <ahmadmiqdad27@gmail.com>2026-01-09 14:53:34 +0700
committerMqdd <ahmadmiqdad27@gmail.com>2026-01-09 14:53:34 +0700
commit57dee69f10404610c9b2cac8268f78ebd92a9b19 (patch)
treea5280fb2f04cee2c4359943cb2282999ba666fe1 /fixco_custom/models/account_move.py
parentf0fdef1687cf29adb42fbb10512820088d8a9953 (diff)
parent82c1232c08894dad3d6e326649785b5669a12077 (diff)
Merge branch 'main' of https://bitbucket.org/altafixco/fixco-addons into bills_add_item_po
Diffstat (limited to 'fixco_custom/models/account_move.py')
-rw-r--r--fixco_custom/models/account_move.py39
1 files changed, 38 insertions, 1 deletions
diff --git a/fixco_custom/models/account_move.py b/fixco_custom/models/account_move.py
index df95f4e..7886b71 100644
--- a/fixco_custom/models/account_move.py
+++ b/fixco_custom/models/account_move.py
@@ -66,6 +66,29 @@ class AccountMove(models.Model):
}
}
+ approval_refund = fields.Selection(
+ [('approved', 'Approved'),
+ ('rejected', 'Rejected'),
+ ('pending', 'Pending')],
+ string='Approval Refund',
+ copy=False,
+ tracking=True
+ )
+
+ def reject_refund(self):
+ if self.move_type == 'entry' and self.sale_id and self.ref.startswith('UANG MUKA PENJUALAN') and self.env.user.id in [9, 10, 15]:
+ self.approval_refund = 'rejected'
+ else:
+ raise UserError(_('Anda tidak memiliki akses untuk melakukan reject Uang Muka Penjualan!'))
+
+ # def approve_refund(self):
+ # if self.move_type == 'entry' and self.sale_id and self.ref.startswith('UANG MUKA PENJUALAN') and self.env.user.id in [9, 10, 15]:
+ # self.approval_refund = 'approved'
+ # else:
+ # raise UserError(_('Anda tidak memiliki akses untuk melakukan approve Uang Muka Penjualan!'))
+
+ def pending_refund(self):
+ self.approval_refund = 'pending'
def queue_job_cancel_bill(self):
QueueJob = self.env['queue.job']
@@ -92,7 +115,19 @@ class AccountMove(models.Model):
'res_id': move.id,
}
])
-
+
+ def button_draft(self):
+ if self.env.user.id not in [24, 13, 10, 2, 9, 15, 8]:
+ raise UserError("Hanya Finance yang bisa ubah Draft")
+ res = super(AccountMove, self).button_draft()
+ return res
+
+ def button_cancel(self):
+ if self.env.user.id not in [24, 13, 10, 2, 9, 15, 8]:
+ raise UserError('Hanya Accounting yang bisa Cancel')
+ res = super(AccountMove, self).button_cancel()
+
+ return res
def _compute_need_refund(self):
for move in self:
@@ -242,6 +277,8 @@ class AccountMove(models.Model):
}
def action_post(self):
+ if self.env.user.id not in [24, 13, 10, 2, 9, 15, 8]:
+ raise UserError('Hanya Accounting yang bisa Post')
res = super(AccountMove, self).action_post()
for entry in self:
if entry.move_type == 'out_invoice':