summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models
diff options
context:
space:
mode:
authorIndoteknik . <it@fixcomart.co.id>2025-07-19 11:15:15 +0700
committerIndoteknik . <it@fixcomart.co.id>2025-07-19 11:15:15 +0700
commitf9cd84314e7a725fbe5001aa39201f632562bfc6 (patch)
treee1f8b96bcc42d0c2823e7775454a425904fa2775 /indoteknik_custom/models
parent17c147f8c988c36c46e035e954c0d90f3ea18f20 (diff)
(andri) add attachment & add status done validation at realization
Diffstat (limited to 'indoteknik_custom/models')
-rw-r--r--indoteknik_custom/models/down_payment.py41
1 files changed, 37 insertions, 4 deletions
diff --git a/indoteknik_custom/models/down_payment.py b/indoteknik_custom/models/down_payment.py
index 68f6954d..ad359408 100644
--- a/indoteknik_custom/models/down_payment.py
+++ b/indoteknik_custom/models/down_payment.py
@@ -69,8 +69,22 @@ class DownPayment(models.Model):
('hr_ga', 'HR & GA'),
], string='Departement Type', tracking=3, required=True)
- attachment_file = fields.Binary(string="Attachment")
-
+ attachment_file_image = fields.Binary(string='Attachment Image', attachment_filename='attachment_filename_image')
+ attachment_file_pdf = fields.Binary(string='Attachment PDF', attachment_filename='attachment_filename_pdf')
+ attachment_filename_image = fields.Char(string='Filename Image')
+ attachment_filename_pdf = fields.Char(string='Filename PDF')
+
+ attachment_type = fields.Selection([
+ ('pdf', 'PDF'),
+ ('image', 'Image'),
+ ], string="Attachment Type", default='pdf')
+
+ @api.onchange('attachment_type')
+ def _onchange_attachment_type(self):
+ self.attachment_file_image = False
+ self.attachment_filename_image = False
+ self.attachment_file_pdf = False
+ self.attachment_filename_pdf = False
# Sales & MD : Darren ID 19
# Marketing : Iwan ID 216
@@ -219,6 +233,12 @@ class RealizationDownPayment(models.Model):
note_approval = fields.Text(string='Note Persetujuan', tracking=3)
+ done_status = fields.Selection([
+ ('remaining', 'Remaining'),
+ ('done_not_realized', 'Done Not Realized'),
+ ('done_realized', 'Done Realized')
+ ], string='Status Realisasi', tracking=3, default='remaining')
+
currency_id = fields.Many2one(
'res.currency', string='Currency',
default=lambda self: self.env.company.currency_id
@@ -240,8 +260,21 @@ class RealizationDownPayment(models.Model):
rec.remaining_value = rec.value_down_payment - rec.grand_total_use
def action_validation(self):
- # Logic untuk konfirmasi pembayaran
- return
+ self.ensure_one()
+
+ # Validasi hanya AP yang bisa validasi
+ if self.env.user.id != 23:
+ raise UserError('Hanya AP yang dapat melakukan validasi realisasi.')
+
+ if self.done_status == 'remaining':
+ self.done_status = 'done_not_realized'
+ elif self.done_status == 'done_not_realized':
+ self.done_status = 'done_realized'
+ else:
+ raise UserError('Realisasi sudah berstatus Done Realized.')
+
+ # Opsional: Tambah log di chatter
+ self.message_post(body=f"Status realisasi diperbarui menjadi <b>{dict(self._fields['done_status'].selection).get(self.done_status)}</b> oleh {self.env.user.name}.")