summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMqdd <ahmadmiqdad27@gmail.com>2026-03-11 10:56:48 +0700
committerMqdd <ahmadmiqdad27@gmail.com>2026-03-11 10:56:48 +0700
commitbe4edf2a1ae2b7e628764d499ecbd2b96eb178ea (patch)
treeacc6ccd3733ea1c40bdfc2548e16565922d9173d
parent38313de6949c4f39ebe7cb431d5beb15baa38d06 (diff)
<Miqdad> change field approved by
-rw-r--r--indoteknik_custom/models/upah_harian_office.py19
-rw-r--r--indoteknik_custom/views/upah_harian_office_views.xml4
2 files changed, 15 insertions, 8 deletions
diff --git a/indoteknik_custom/models/upah_harian_office.py b/indoteknik_custom/models/upah_harian_office.py
index a77281f6..12d4a32e 100644
--- a/indoteknik_custom/models/upah_harian_office.py
+++ b/indoteknik_custom/models/upah_harian_office.py
@@ -36,7 +36,9 @@ class UpahHarian(models.Model):
cancel_reason = fields.Text('Alasan Cancel')
- approved_by = fields.Char('Approved By')
+ approved_by_pic = fields.Char('Approved By PIC', readonly=True)
+ approved_by_dept = fields.Char('Approved By Dept', readonly=True)
+ approved_by_finance = fields.Char('Approved By Finance', readonly=True)
departement_type = fields.Selection([
('sales', 'Sales'),
@@ -161,21 +163,22 @@ class UpahHarian(models.Model):
if self.state == 'draft':
self.state = 'pic'
+ self.approved_by_pic = self.env.user.name
elif self.state == 'pic':
self.state = 'approved'
+ self.approved_by_dept = self.env.user.name
elif self.state == 'approved':
self.state = 'waiting_payment'
+ self.approved_by_finance = self.env.user.name
- if self.approved_by:
- self.approved_by = f"{self.approved_by}, {approver}"
- else:
- self.approved_by = approver
def action_reset_to_draft(self):
if self.state != 'cancel':
raise UserError("Cancel Pengajuan Dahulu Sebelum set to Draft")
self.state ='draft'
- self.approved_by = False or ""
+ self.approved_by_pic = False or ""
+ self.approved_by_dept = False or ""
+ self.approved_by_finance = False or ""
def action_cancel(self):
if not self.cancel_reason:
@@ -183,7 +186,9 @@ class UpahHarian(models.Model):
if self.state in ['paid', 'approved']:
raise UserError('Tidak Bisa Cancel Karena pengajuan sudah diapprove')
self.state = 'cancel'
- self.approved_by = False or ""
+ self.approved_by_pic = False or ""
+ self.approved_by_dept = False or ""
+ self.approved_by_finance = False or ""
@api.depends('attachment_file_image', 'attachment_file_pdf')
def auto_paid_attachment(self):
diff --git a/indoteknik_custom/views/upah_harian_office_views.xml b/indoteknik_custom/views/upah_harian_office_views.xml
index bc4c548a..8be9136b 100644
--- a/indoteknik_custom/views/upah_harian_office_views.xml
+++ b/indoteknik_custom/views/upah_harian_office_views.xml
@@ -53,7 +53,9 @@
<field name="tanggal"/>
<field name="upah_harian"/>
<field name="sisa_jam_mingguan" class="text-danger" attrs="{'invisible':[('sisa_jam_mingguan','=',0)]}"/>
- <field name="approved_by" attrs="{'invisible': [('state', 'in', ['draft', 'cancel'])]}"/>
+ <field name="approved_by_pic" attrs="{'invisible': [('state', 'in', ['draft', 'cancel'])]}"/>
+ <field name="approved_by_dept" attrs="{'invisible': [('state', 'in', ['draft', 'cancel'])]}"/>
+ <field name="approved_by_finance" attrs="{'invisible': [('state', 'in', ['draft', 'cancel'])]}"/>
<field name="cancel_reason"/>
</group>