From fcae9b43dc261223b242265141353974300a304f Mon Sep 17 00:00:00 2001 From: "Indoteknik ." Date: Wed, 6 Aug 2025 09:37:34 +0700 Subject: (andri) banyaknya attachment --- indoteknik_custom/models/down_payment.py | 23 ++++++++++++++++++++- .../views/down_payment_realization.xml | 24 +++++++++++++++++++--- 2 files changed, 43 insertions(+), 4 deletions(-) diff --git a/indoteknik_custom/models/down_payment.py b/indoteknik_custom/models/down_payment.py index ab30337a..8d70aa69 100644 --- a/indoteknik_custom/models/down_payment.py +++ b/indoteknik_custom/models/down_payment.py @@ -590,6 +590,12 @@ class RealizationDownPaymentUseLine(models.Model): nominal = fields.Float(string='Nominal', required=True) done_attachment = fields.Boolean(string='Checked', default=False) + lot_of_attachment = fields.Selection( + related='realization_id.lot_of_attachment', + string='Lot of Attachment (Related)', + store=False + ) + attachment_type = fields.Selection([ ('pdf', 'PDF'), ('image', 'Image'), @@ -640,7 +646,7 @@ class RealizationDownPayment(models.Model): name = fields.Char(string='Nama', readonly=True, tracking=3) title = fields.Char(string='Judul', tracking=3) goals = fields.Text(string='Tujuan', tracking=3) - related = fields.Char(string='Terkait', tracking=3,) + related = fields.Char(string='Terkait', tracking=3) pemberian_line_ids = fields.One2many( 'realization.down.payment.line', 'realization_id', string='Rincian Pemberian' @@ -700,9 +706,24 @@ class RealizationDownPayment(models.Model): ('image', 'Image'), ], string="Attachment Type", default='pdf') + lot_of_attachment = fields.Selection([ + ('one_for_all_line', '1 Attachment Untuk Semua Line Penggunaan PUM'), + ('one_for_one_line', '1 Attachment per 1 Line Penggunaan PUM'), + ], string = "Banyaknya Attachment", default='one_for_one_line') + move_id = fields.Many2one('account.move', string='Journal Entries', domain=[('move_type', '=', 'entry')]) is_cab_visible = fields.Boolean(string='Is Journal Uang Muka Visible', compute='_compute_is_cab_visible') + @api.onchange('lot_of_attachment') + def _onchange_lot_of_attachment(self): + if self.lot_of_attachment == 'one_for_all_line': + for line in self.penggunaan_line_ids: + line.attachment_file_pdf = False + line.attachment_file_image = False + line.attachment_filename_pdf = False + line.attachment_filename_image = False + + @api.depends('move_id.state') def _compute_is_cab_visible(self): for rec in self: diff --git a/indoteknik_custom/views/down_payment_realization.xml b/indoteknik_custom/views/down_payment_realization.xml index 947c3cd1..9d6a8f02 100644 --- a/indoteknik_custom/views/down_payment_realization.xml +++ b/indoteknik_custom/views/down_payment_realization.xml @@ -49,12 +49,28 @@ + + + + + + +
+
+ + + @@ -80,21 +96,23 @@
+ - + + attrs="{'invisible': [('attachment_type', '!=', 'pdf'), ('lot_of_attachment', '=', 'one_for_all_line')]}"/> + attrs="{'invisible': [('attachment_type', '!=', 'image'), ('lot_of_attachment', '=', 'one_for_all_line')]}"/>
-- cgit v1.2.3