summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models
diff options
context:
space:
mode:
authorIndoteknik . <it@fixcomart.co.id>2025-07-19 13:47:28 +0700
committerIndoteknik . <it@fixcomart.co.id>2025-07-19 13:47:28 +0700
commit09c24278d60eb5bc5a92ad9b3f5389d329641228 (patch)
tree858fd6873600e985f1eafd2aca1e9d322d45b0ac /indoteknik_custom/models
parentf9cd84314e7a725fbe5001aa39201f632562bfc6 (diff)
(andri) add attachment & validasi realisasi penggunaan PUM
Diffstat (limited to 'indoteknik_custom/models')
-rw-r--r--indoteknik_custom/models/down_payment.py51
1 files changed, 50 insertions, 1 deletions
diff --git a/indoteknik_custom/models/down_payment.py b/indoteknik_custom/models/down_payment.py
index ad359408..920b1b5b 100644
--- a/indoteknik_custom/models/down_payment.py
+++ b/indoteknik_custom/models/down_payment.py
@@ -205,8 +205,40 @@ class RealizationDownPaymentUseLine(models.Model):
date = fields.Date(string='Tanggal', required=True, default=fields.Date.today)
description = fields.Char(string='Description', required=True)
nominal = fields.Float(string='Nominal', required=True)
- attachment = fields.Boolean(string='Lampiran', default=False)
+ done_attachment = fields.Boolean(string='Checked', default=False)
+ attachment_type = fields.Selection([
+ ('pdf', 'PDF'),
+ ('image', 'Image'),
+ ], string="Attachment Type", default='pdf')
+
+ 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')
+
+ @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
+
+ @api.onchange('done_attachment')
+ def _onchange_done_attachment(self):
+ if self.done_attachment and self.env.user.id != 23:
+ self.done_attachment = False
+ return {
+ 'warning': {
+ 'title': _('Tidak Diizinkan'),
+ 'message': _('Hanya user AP yang bisa mencentang Done Attachment.')
+ }
+ }
+ # def write(self, vals):
+ # if 'done_attachment' in vals and vals['done_attachment']:
+ # if self.env.user.id != 23: # Manzila (Finance) ID 23
+ # raise UserError('Hanya user AP yang dapat mencentang Checked.')
+ # return super().write(vals)
class RealizationDownPayment(models.Model):
_name = 'realization.down.payment'
@@ -244,6 +276,23 @@ class RealizationDownPayment(models.Model):
default=lambda self: self.env.company.currency_id
)
+ 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
+
@api.depends('pemberian_line_ids.value')
def _compute_grand_total(self):
for rec in self: