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 ++++++++++++++++-- indoteknik_custom/views/down_payment.xml | 1 + 2 files changed, 17 insertions(+), 2 deletions(-) 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: diff --git a/indoteknik_custom/views/down_payment.xml b/indoteknik_custom/views/down_payment.xml index 11a0a672..754297b1 100644 --- a/indoteknik_custom/views/down_payment.xml +++ b/indoteknik_custom/views/down_payment.xml @@ -80,6 +80,7 @@ + -- cgit v1.2.3