summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIndoteknik . <it@fixcomart.co.id>2025-08-06 11:22:37 +0700
committerIndoteknik . <it@fixcomart.co.id>2025-08-06 11:22:37 +0700
commit33621956bdb9d807b480eda44ce7f2152f508695 (patch)
tree89f18f905f71dc0c39a9b891b3c671de0b5fdaea
parent4a995bd555f1c9c766941cc4ad1286e60beb524b (diff)
(andri) add button check/uncheck all line use PUM
-rw-r--r--indoteknik_custom/models/down_payment.py16
-rw-r--r--indoteknik_custom/views/down_payment_realization.xml31
2 files changed, 33 insertions, 14 deletions
diff --git a/indoteknik_custom/models/down_payment.py b/indoteknik_custom/models/down_payment.py
index 8d70aa69..5c7c3f49 100644
--- a/indoteknik_custom/models/down_payment.py
+++ b/indoteknik_custom/models/down_payment.py
@@ -714,6 +714,22 @@ class RealizationDownPayment(models.Model):
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')
+ def action_toggle_check_attachment(self):
+ # ap_user_ids = [23, 9468]
+ # if self.env.user.id not in ap_user_ids:
+ # raise UserError('Hanya User AP yang dapat menggunakan tombol ini.')
+
+ for rec in self:
+ if not rec.penggunaan_line_ids:
+ continue
+
+ if all(line.done_attachment for line in rec.penggunaan_line_ids):
+ for line in rec.penggunaan_line_ids:
+ line.done_attachment = False
+ else:
+ for line in rec.penggunaan_line_ids:
+ line.done_attachment = True
+
@api.onchange('lot_of_attachment')
def _onchange_lot_of_attachment(self):
if self.lot_of_attachment == 'one_for_all_line':
diff --git a/indoteknik_custom/views/down_payment_realization.xml b/indoteknik_custom/views/down_payment_realization.xml
index 3f52c2a4..b24727e6 100644
--- a/indoteknik_custom/views/down_payment_realization.xml
+++ b/indoteknik_custom/views/down_payment_realization.xml
@@ -48,6 +48,12 @@
<field name="goals" required="1"/>
<field name="related" required="1"/>
<field name="approved_by" readonly="1"/>
+ <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 attrs="{'invisible': [('lot_of_attachment', '!=', 'one_for_all_line')]}">
<field name="attachment_type" attrs="{'readonly': [('status', '=', 'approved')]}"/>
@@ -63,24 +69,14 @@
<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>
<notebook>
<page string="Rincian Pemberian">
<field name="pemberian_line_ids" nolabel="1">
<tree editable="false" create="false" delete="false">
- <field name="date"/>
- <field name="description"/>
- <field name="value" sum="Total Pemberian"/>
+ <field name="date" readonly="1"/>
+ <field name="description" readonly="1"/>
+ <field name="value" sum="Total Pemberian" readonly="1"/>
</tree>
</field>
</page>
@@ -134,6 +130,13 @@
</page>
</notebook>
+ <div style="text-align:right;">
+ <button name="action_toggle_check_attachment"
+ type="object"
+ string="Check/Uncheck All Line Use PUM"
+ class="btn-secondary"/>
+ </div>
+
<group col="2">
<group class="oe_subtotal_footer oe_right">
<field name="currency_id" invisible="1"/>
@@ -142,7 +145,7 @@
<field name="value_down_payment" readonly="1" widget="monetary" options="{'currency_field': 'currency_id'}" style="font-weight: bold;"/>
<field name="remaining_value" readonly="1" widget="monetary" options="{'currency_field': 'currency_id'}"/>
</group>
- </group>
+ </group>
</sheet>
<div class="oe_chatter">