summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indoteknik_custom/models/user_pengajuan_tempo_request.py13
-rw-r--r--indoteknik_custom/views/user_pengajuan_tempo_request.xml12
2 files changed, 24 insertions, 1 deletions
diff --git a/indoteknik_custom/models/user_pengajuan_tempo_request.py b/indoteknik_custom/models/user_pengajuan_tempo_request.py
index 4a1994fb..be4293a0 100644
--- a/indoteknik_custom/models/user_pengajuan_tempo_request.py
+++ b/indoteknik_custom/models/user_pengajuan_tempo_request.py
@@ -63,6 +63,19 @@ class UserPengajuanTempoRequest(models.Model):
('reject', 'Rejected'),
], string='Status',)
reason_reject = fields.Char(string='Reason Reaject', tracking=True, track_visibility='onchange')
+ state_tempo_text = fields.Char(string="Status", compute="_compute_state_tempo_text")
+
+ @api.depends('state_tempo')
+ def _compute_state_tempo_text(self):
+ for record in self:
+ status_mapping = {
+ 'draft': "Menunggu Approve Manager",
+ 'approval_sales': "Menunggu Approve Finance",
+ 'approval_finance': "Menunggu Approve Direktur",
+ 'approval_director': "Approved",
+ 'reject': "Rejected",
+ }
+ record.state_tempo_text = status_mapping.get(record.state_tempo, "Unknown")
# informasi perusahaan
name_tempo = fields.Many2one('res.partner', string='Nama Perusahaan', related='pengajuan_tempo_id.name_tempo', store=True, tracking=True, readonly=False)
diff --git a/indoteknik_custom/views/user_pengajuan_tempo_request.xml b/indoteknik_custom/views/user_pengajuan_tempo_request.xml
index f7ad9afb..7063231b 100644
--- a/indoteknik_custom/views/user_pengajuan_tempo_request.xml
+++ b/indoteknik_custom/views/user_pengajuan_tempo_request.xml
@@ -10,7 +10,17 @@
<field name="create_date"/>
<field name="tempo_duration" attrs="{'readonly': [('state_tempo', '=', 'approval_director')]}"/>
<field name="tempo_limit" attrs="{'readonly': [('state_tempo', '=', 'approval_director')]}" placeholder="Contoh format, misalnya '10000000'" widget="monetary" options="{'currency_field': 'currency_id'}"/>
- <field name="state_tempo" decoration-success="state_tempo == 'approval_director'" decoration-danger="state_tempo == 'reject'" widget="badge" optional="show"/>
+<!-- <field name="state_tempo"-->
+<!-- decoration-danger="state_tempo == 'reject'"-->
+<!-- decoration-warning="state_tempo in ('draft', 'approval_sales', 'approval_finance')"-->
+<!-- decoration-success="state_tempo == 'approval_director'">-->
+<!-- <tree>-->
+<!-- <field name="state_tempo" invisible="1"/>-->
+<!-- <field name="state_tempo_text" string="Status"/>-->
+<!-- </tree>-->
+<!-- </field>-->
+ <field name="state_tempo" invisible="1"/>
+ <field name="state_tempo_text" decoration-success="state_tempo_text == 'Approved'" decoration-danger="state_tempo_text == 'Rejected'" widget="badge" optional="show"/>
</tree>
</field>
</record>