summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIndoteknik . <it@fixcomart.co.id>2025-08-05 17:10:21 +0700
committerIndoteknik . <it@fixcomart.co.id>2025-08-05 17:10:21 +0700
commitd1a529a1cb034086b0581b110c48785e28bf3a8c (patch)
tree8f8191dab611983bc16c6db852592acba5cdf7a8
parent216fe79c11dace298b260be946f14a3af5b5a929 (diff)
(andri) add validasi confirm payment only AP
-rw-r--r--indoteknik_custom/models/down_payment.py18
-rw-r--r--indoteknik_custom/views/down_payment.xml1
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 <b>dikonfirmasi</b> oleh <b>AP</b>.",
+ 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 @@
<field name="days_remaining" readonly="1" widget="badge"/>
<field name="approved_by" readonly="1"/>
<field name="detail_note" attrs="{'readonly': [('status', '=', 'approved')]}"/>
+ <field name="reason_reject" attrs="{'invisible': [('status', '!=', 'reject')], 'readonly': True}"/>
</group>
<group>