From d1a529a1cb034086b0581b110c48785e28bf3a8c Mon Sep 17 00:00:00 2001 From: "Indoteknik ." Date: Tue, 5 Aug 2025 17:10:21 +0700 Subject: (andri) add validasi confirm payment only AP --- indoteknik_custom/models/down_payment.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/down_payment.py b/indoteknik_custom/models/down_payment.py index 1fbac44a..ab30337a 100644 --- a/indoteknik_custom/models/down_payment.py +++ b/indoteknik_custom/models/down_payment.py @@ -318,12 +318,26 @@ class DownPayment(models.Model): def action_confirm_payment(self): + ap_user_ids = [23, 9468] + if self.env.user.id not in ap_user_ids: + raise UserError('Hanya User AP yang dapat menggunakan fitur ini.') + for rec in self: if not rec.attachment_file_image and not rec.attachment_file_pdf: - raise UserError('Tidak bisa konfirmasi pembayaran karena belum ada bukti attachment (PDF/Image).') - + raise UserError( + f'Tidak bisa konfirmasi pembayaran PUM {rec.name or ""} ' + f'karena belum ada bukti attachment (PDF/Image).' + ) + rec.status_pay_down_payment = 'payment' + rec.message_post( + body="Status pembayaran telah dikonfirmasi oleh AP.", + message_type="comment", + subtype_xmlid="mail.mt_note", + ) + + # def action_approval_check(self): # for record in self: -- cgit v1.2.3