diff options
| author | Indoteknik . <it@fixcomart.co.id> | 2025-08-06 09:37:34 +0700 |
|---|---|---|
| committer | Indoteknik . <it@fixcomart.co.id> | 2025-08-06 09:37:34 +0700 |
| commit | fcae9b43dc261223b242265141353974300a304f (patch) | |
| tree | 7f810f83f5acb339fed5549737efa0466c19b977 | |
| parent | d1a529a1cb034086b0581b110c48785e28bf3a8c (diff) | |
(andri) banyaknya attachment
| -rw-r--r-- | indoteknik_custom/models/down_payment.py | 23 | ||||
| -rw-r--r-- | indoteknik_custom/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 @@ <field name="related" required="1"/> <field name="approved_by" readonly="1"/> </group> + <group attrs="{'invisible': [('lot_of_attachment', '!=', 'one_for_all_line')]}"> + <field name="attachment_type" attrs="{'readonly': [('status', '=', 'approved')]}"/> + + <field name="attachment_file_pdf" filename="attachment_filename" + widget="pdf_viewer" + attrs="{'invisible': [('attachment_type', '!=', 'pdf')], 'readonly': [('status', '=', 'approved')]}"/> + + <field name="attachment_file_image" filename="attachment_filename" + widget="image" + attrs="{'invisible': [('attachment_type', '!=', 'image')], 'readonly': [('status', '=', 'approved')]}" + style="max-width:250px; max-height:250px; object-fit:contain;"/> + <br/> + </group> + </group> + <group col="2"> <group> <field name="done_status" decoration-success="done_status == 'done_realized'" decoration-danger="done_status == 'remaining'" widget="badge" readonly="1"/> <field name="note_approval" required="1"/> + <field name="lot_of_attachment"/> </group> </group> @@ -80,21 +96,23 @@ <form> <group> + <field name="lot_of_attachment" invisible="1"/> <field name="date"/> <field name="account_id"/> <field name="description"/> <field name="nominal"/> - <field name="attachment_type"/> + <field name="attachment_type" + attrs="{'invisible': [('lot_of_attachment', '=', 'one_for_all_line')]}"/> <field name="attachment_file_pdf" filename="attachment_filename_pdf" widget="pdf_viewer" - attrs="{'invisible': [('attachment_type', '!=', 'pdf')]}"/> + attrs="{'invisible': [('attachment_type', '!=', 'pdf'), ('lot_of_attachment', '=', 'one_for_all_line')]}"/> <field name="attachment_file_image" filename="attachment_filename_image" widget="image" - attrs="{'invisible': [('attachment_type', '!=', 'image')]}"/> + attrs="{'invisible': [('attachment_type', '!=', 'image'), ('lot_of_attachment', '=', 'one_for_all_line')]}"/> <field name="done_attachment"/> </group> </form> |
