summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAzka Nathan <darizkyfaz@gmail.com>2025-02-12 09:42:11 +0700
committerAzka Nathan <darizkyfaz@gmail.com>2025-02-12 09:42:11 +0700
commit381a158a18e42fa41fada1ad3390222999041e39 (patch)
treead4df2cc0acfa6a906c74665107c16d88dc77254
parent1c42539aeb53207b07bde3030d2316b58c2cf81e (diff)
parent7992c122fbc1c0c442d54ffdccd73383a8fc394d (diff)
Merge branch 'odoo-production' of bitbucket.org:altafixco/indoteknik-addons into odoo-production
-rw-r--r--indoteknik_custom/models/user_pengajuan_tempo_request.py12
-rw-r--r--indoteknik_custom/views/user_pengajuan_tempo_request.xml5
2 files changed, 16 insertions, 1 deletions
diff --git a/indoteknik_custom/models/user_pengajuan_tempo_request.py b/indoteknik_custom/models/user_pengajuan_tempo_request.py
index e2c08cb2..4a1994fb 100644
--- a/indoteknik_custom/models/user_pengajuan_tempo_request.py
+++ b/indoteknik_custom/models/user_pengajuan_tempo_request.py
@@ -55,7 +55,14 @@ class UserPengajuanTempoRequest(models.Model):
('approval_director', 'Approved by Director'),
('reject', 'Rejected'),
], string='Status', readonly=True, copy=False, index=True, track_visibility='onchange', default='draft')
- reason_reject = fields.Char(string='Limit Tempo')
+ last_state_tempo = fields.Selection([
+ ('draft', 'Pengajuan Tempo'),
+ ('approval_sales', 'Approved by Sales Manager'),
+ ('approval_finance', 'Approved by Finance'),
+ ('approval_director', 'Approved by Director'),
+ ('reject', 'Rejected'),
+ ], string='Status',)
+ reason_reject = fields.Char(string='Reason Reaject', tracking=True, track_visibility='onchange')
# informasi perusahaan
name_tempo = fields.Many2one('res.partner', string='Nama Perusahaan', related='pengajuan_tempo_id.name_tempo', store=True, tracking=True, readonly=False)
@@ -409,6 +416,9 @@ class UserPengajuanTempoRequest(models.Model):
'target': 'new',
'context': {'default_request_id': self.id},
}
+ def button_draft(self):
+ for tempo in self:
+ tempo.state_tempo = tempo.last_state_tempo if tempo.last_state_tempo else 'draft'
def write(self, vals):
is_approve = True if self.state_tempo == 'approval_director' or vals.get('state_tempo') == 'approval_director' else False
diff --git a/indoteknik_custom/views/user_pengajuan_tempo_request.xml b/indoteknik_custom/views/user_pengajuan_tempo_request.xml
index b6a6206e..f7ad9afb 100644
--- a/indoteknik_custom/views/user_pengajuan_tempo_request.xml
+++ b/indoteknik_custom/views/user_pengajuan_tempo_request.xml
@@ -31,6 +31,11 @@
attrs="{'invisible': [('state_tempo', 'in', ['approval_director','reject'])]}"
type="object"
class="oe_highlight"/>
+ <button name="button_draft"
+ string="Reset to Draft"
+ attrs="{'invisible': [('state_tempo', '!=', 'reject')]}"
+ type="object"
+ class="oe_highlight"/>
<field name="state_tempo" widget="statusbar"
statusbar_visible="draft,approval_sales,approval_finance,approval_director"
statusbar_colors='{"reject":"red"}'/>