summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorit-fixcomart <it@fixcomart.co.id>2024-12-03 13:22:55 +0700
committerit-fixcomart <it@fixcomart.co.id>2024-12-03 13:22:55 +0700
commitcf6581d8a9ddfd5a7e3c1c2d7aa5aab8b96f4813 (patch)
tree69bada29da6d7929c5342e27ea6413d459266026
parent6fbfe31167e6eb66d4995374dadb14774026e8c7 (diff)
<iman> pengajuan tempo
-rw-r--r--indoteknik_api/controllers/api_v1/user.py2
-rw-r--r--indoteknik_api/models/res_users.py4
-rw-r--r--indoteknik_custom/models/user_pengajuan_tempo.py2
-rw-r--r--indoteknik_custom/models/user_pengajuan_tempo_request.py156
-rwxr-xr-xindoteknik_custom/security/ir.model.access.csv4
-rw-r--r--indoteknik_custom/views/user_pengajuan_tempo.xml71
-rw-r--r--indoteknik_custom/views/user_pengajuan_tempo_request.xml261
7 files changed, 419 insertions, 81 deletions
diff --git a/indoteknik_api/controllers/api_v1/user.py b/indoteknik_api/controllers/api_v1/user.py
index f83937ea..51dae0a2 100644
--- a/indoteknik_api/controllers/api_v1/user.py
+++ b/indoteknik_api/controllers/api_v1/user.py
@@ -179,7 +179,7 @@ class User(controller.Controller):
if result:
match_company_name = result[0]
- match_company_id = result[1]
+ match_company_id = result[2]
# Create a user company request
request.env['user.company.request'].create({
diff --git a/indoteknik_api/models/res_users.py b/indoteknik_api/models/res_users.py
index 40933957..15aaa5a7 100644
--- a/indoteknik_api/models/res_users.py
+++ b/indoteknik_api/models/res_users.py
@@ -15,8 +15,8 @@ class ResUsers(models.Model):
'director': 3
}
partner_tempo = ''
- is_tempo_request = request.env['user.pengajuan.tempo.request'].search([('name_tempo', '=', partner.id)], limit=1)
- tempo_progres = 'review' if is_tempo_request else ''
+ is_tempo_request = request.env['user.pengajuan.tempo.request'].search([('user_company_id', '=', main_partner.id)], limit=1)
+ tempo_progres = 'review' if is_tempo_request.state_tempo in ('draft','approval_sales','approval_finance') else ''
if main_partner:
partner_tempo = main_partner.get_check_payment_term()
if payment_tempo:
diff --git a/indoteknik_custom/models/user_pengajuan_tempo.py b/indoteknik_custom/models/user_pengajuan_tempo.py
index 006bbb55..b527fa4c 100644
--- a/indoteknik_custom/models/user_pengajuan_tempo.py
+++ b/indoteknik_custom/models/user_pengajuan_tempo.py
@@ -112,6 +112,8 @@ class UserPengajuanTempo(models.Model):
display_name = "DETAIL FORM TEMPO"
result.append((record.id, display_name))
return result
+
+
#
# def _compute_attachment_url(self):
# if self.id:
diff --git a/indoteknik_custom/models/user_pengajuan_tempo_request.py b/indoteknik_custom/models/user_pengajuan_tempo_request.py
index b7526238..2d4875fb 100644
--- a/indoteknik_custom/models/user_pengajuan_tempo_request.py
+++ b/indoteknik_custom/models/user_pengajuan_tempo_request.py
@@ -1,7 +1,43 @@
-from odoo import models, fields, api
+from odoo import models, fields, api, _
from odoo.exceptions import UserError
from odoo.http import request
+class RejectReasonWizard(models.TransientModel):
+ _name = 'reject.reason.wizard'
+ _description = 'Wizard for Reject Reason'
+
+ request_id = fields.Many2one('user.pengajuan.tempo.request', string='Request')
+ reason_reject = fields.Text(string='Reason for Rejection', required=True)
+
+ def confirm_reject(self):
+ tempo = self.request_id
+ if tempo:
+ tempo.write({'reason_reject': self.reason_reject})
+ tempo.state_tempo = 'reject'
+ template = self.env.ref('indoteknik_custom.mail_template_res_user_company_tempo_reject')
+ template.send_mail(tempo.id, force_send=True)
+ return {'type': 'ir.actions.act_window_close'}
+class ConfirmApprovalWizard(models.TransientModel):
+ _name = 'confirm.approval.wizard'
+ _description = 'Wizard Konfirmasi Approval'
+
+ tempo_id = fields.Many2one('user.pengajuan.tempo.request', string='Tempo', required=True)
+
+ def confirm_approval(self):
+ tempo = self.tempo_id
+ if tempo.state_tempo == 'draft':
+ tempo.state_tempo = 'approval_sales'
+ template = self.env.ref('indoteknik_custom.mail_template_res_user_company_tempo_approved_by_sales')
+ template.send_mail(tempo.id, force_send=True)
+ elif tempo.state_tempo == 'approval_sales':
+ tempo.state_tempo = 'approval_finance'
+ template = self.env.ref('indoteknik_custom.mail_template_res_user_company_tempo_to_aprove_director')
+ template.send_mail(tempo.id, force_send=True)
+ elif tempo.state_tempo == 'approval_finance':
+ tempo.state_tempo = 'approval_director'
+
+
+
class UserPengajuanTempoRequest(models.Model):
_name = 'user.pengajuan.tempo.request'
_inherit = ['mail.thread', 'mail.activity.mixin']
@@ -10,26 +46,28 @@ class UserPengajuanTempoRequest(models.Model):
user_id = fields.Many2one('res.partner', string='User')
user_company_id = fields.Many2one('res.partner', string='Company')
pengajuan_tempo_id = fields.Many2one('user.pengajuan.tempo', string='Form Tempo')
- tempo_duration = fields.Many2one('account.payment.term', string='Durasi Tempo')
- tempo_limit = fields.Char(string='Limit Tempo')
+ tempo_duration = fields.Many2one('account.payment.term', string='Durasi Tempo', tracking=3, )
+ tempo_limit = fields.Char(string='Limit Tempo', tracking=3)
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', readonly=True, copy=False, index=True, track_visibility='onchange', default='draft')
+ reason_reject = fields.Char(string='Limit Tempo')
@api.onchange('tempo_duration')
- def _tempo_duration_change(self):
+ def _tempo_duration_change(self, vals):
for tempo in self:
if tempo.env.user.id not in (7, 377):
raise UserError("Durasi tempo hanya bisa di ubah oleh Sales Manager atau Direktur")
@api.onchange('tempo_limit')
- def _tempo_limit_change(self):
+ def _onchange_tempo_limit(self):
for tempo in self:
- if tempo.env.user.id not in (7, 377):
- raise UserError("Limit tempo hanya bisa di ubah oleh Sales Manager atau Direktur")
+ if tempo.env.user.id not in (7, 377, 12182):
+ raise UserError("Limit tempo hanya bisa diubah oleh Sales Manager atau Direktur")
def button_approve(self):
for tempo in self:
@@ -38,39 +76,84 @@ class UserPengajuanTempoRequest(models.Model):
raise UserError("Pengajuan tempo harus di approve oleh sales manager terlebih dahulu")
else:
# if tempo.env.user.id != 377:
- if tempo.env.user.id != 25:
+ if tempo.env.user.id != 12182:
raise UserError("Pengajuan tempo hanya bisa di approve oleh sales manager")
else:
- tempo.state_tempo = 'approval_sales'
+ return {
+ 'type': 'ir.actions.act_window',
+ 'name': 'Konfirmasi Approve',
+ 'res_model': 'confirm.approval.wizard',
+ 'view_mode': 'form',
+ 'target': 'new',
+ 'context': {
+ 'default_tempo_id': tempo.id,
+ },
+ }
elif tempo.state_tempo == 'approval_sales':
if tempo.env.user.id == 7:
raise UserError("Pengajuan tempo harus di approve oleh Finence terlebih dahulu")
else:
# if tempo.env.user.id not in (688, 28):
- if tempo.env.user.id not in (101):
+ if tempo.env.user.id not in (101,288,28,12182):
raise UserError("Pengajuan tempo hanya bisa di approve oleh Finence")
else:
- tempo.state_tempo = 'approval_finance'
+ return {
+ 'type': 'ir.actions.act_window',
+ 'name': 'Konfirmasi Approve',
+ 'res_model': 'confirm.approval.wizard',
+ 'view_mode': 'form',
+ 'target': 'new',
+ 'context': {
+ 'default_tempo_id': tempo.id,
+ },
+ }
elif tempo.state_tempo == 'approval_finance':
# if tempo.env.user.id != 7:
if tempo.env.user.id != 12182:
raise UserError("Pengajuan tempo hanya bisa di approve oleh Direktur")
else:
- tempo.state_tempo = 'approval_director'
-
+ return {
+ 'type': 'ir.actions.act_window',
+ 'name': 'Konfirmasi Approve',
+ 'res_model': 'confirm.approval.wizard',
+ 'view_mode': 'form',
+ 'target': 'new',
+ 'context': {
+ 'default_tempo_id': tempo.id,
+ },
+ }
-
- res = super(UserPengajuanTempoRequest, self).button_approve()
- return res
+ def button_reject(self):
+ return {
+ 'type': 'ir.actions.act_window',
+ 'name': _('Reject Reason'),
+ 'res_model': 'reject.reason.wizard',
+ 'view_mode': 'form',
+ 'target': 'new',
+ 'context': {'default_request_id': self.id},
+ }
def write(self, vals):
- user = self.get_user_by_email(self.user_id.email)
- is_approve = True if self.state_tempo == 'approval_director' else False
+ is_approve = True if self.state_tempo == 'approval_director' or vals.get('state_tempo') == 'approval_director' else False
# if self.is_approve and is_approve:
# raise UserError('Tidak dapat mengubah approval yang sudah diisi')
+ limit_tempo = ''
+ if vals.get('tempo_limit'):
+ limit_tempo = vals.get('tempo_limit')
+ elif self.tempo_limit:
+ limit_tempo = self.tempo_limit
+ else:
+ limit_tempo = self.pengajuan_tempo_id.tempo_limit
+ tempo_duration = ''
+ if vals.get('tempo_duration'):
+ tempo_duration = vals.get('tempo_duration')
+ elif self.tempo_duration:
+ tempo_duration = self.tempo_duration
+ else:
+ tempo_duration = self.pengajuan_tempo_id.tempo_duration
if is_approve:
self.pengajuan_tempo_id.partner_id = self.user_id.id
# informasi perusahaan
@@ -86,8 +169,8 @@ class UserPengajuanTempoRequest(models.Model):
self.user_company_id.account_number_tempo = self.pengajuan_tempo_id.account_number_tempo
self.user_company_id.website_tempo = self.pengajuan_tempo_id.website_tempo
self.user_company_id.estimasi_tempo = self.pengajuan_tempo_id.estimasi_tempo
- self.user_company_id.tempo_duration = vals.get('tempo_duration') if vals.get('tempo_duration') else self.pengajuan_tempo_id.tempo_duration
- self.user_company_id.tempo_limit = vals.get('tempo_limit') if vals.get('tempo_limit') else self.pengajuan_tempo_id.tempo_limit
+ self.user_company_id.tempo_duration = tempo_duration
+ self.user_company_id.tempo_limit = limit_tempo
self.user_company_id.category_produk_ids = self.pengajuan_tempo_id.category_produk_ids
# Kontak Perusahaan
@@ -120,44 +203,44 @@ class UserPengajuanTempoRequest(models.Model):
self.user_company_id.supplier_ids = self.pengajuan_tempo_id.supplier_ids
# Dokumen
- self.user_company_id.dokumen_nib = self.pengajuan_tempo_id.dokumen_nib
+ self.user_company_id.dokumen_nib = self.pengajuan_tempo_id.dokumen_nib[0]
if self.user_company_id.dokumen_nib:
self.user_company_id.message_post(body='Dokumen NIB', attachment_ids=[self.user_company_id.dokumen_nib.id])
- self.user_company_id.dokumen_npwp = self.pengajuan_tempo_id.dokumen_npwp
+ self.user_company_id.dokumen_npwp = self.pengajuan_tempo_id.dokumen_npwp[0]
if self.user_company_id.dokumen_npwp:
self.user_company_id.message_post(body='Dokumen NPWP', attachment_ids=[self.user_company_id.dokumen_npwp.id])
- self.user_company_id.dokumen_sppkp = self.pengajuan_tempo_id.dokumen_sppkp
+ self.user_company_id.dokumen_sppkp = self.pengajuan_tempo_id.dokumen_sppkp[0]
if self.user_company_id.dokumen_sppkp:
self.user_company_id.message_post(body='Dokumen SPPKP', attachment_ids=[self.user_company_id.dokumen_sppkp.id])
- self.user_company_id.dokumen_akta_perubahan = self.pengajuan_tempo_id.dokumen_akta_perubahan
+ self.user_company_id.dokumen_akta_perubahan = self.pengajuan_tempo_id.dokumen_akta_perubahan[0] if self.pengajuan_tempo_id.dokumen_akta_perubahan else []
if self.user_company_id.dokumen_akta_perubahan:
self.user_company_id.message_post(body='Dokumen Akta Perubahan',
attachment_ids=[self.user_company_id.dokumen_akta_perubahan.id])
- self.user_company_id.dokumen_ktp_dirut = self.pengajuan_tempo_id.dokumen_ktp_dirut
+ self.user_company_id.dokumen_ktp_dirut = self.pengajuan_tempo_id.dokumen_ktp_dirut[0] if self.pengajuan_tempo_id.dokumen_ktp_dirut else []
if self.user_company_id.dokumen_ktp_dirut:
self.user_company_id.message_post(body='Dokumen Ktp Dirut',
attachment_ids=[self.user_company_id.dokumen_ktp_dirut.id])
- self.user_company_id.dokumen_akta_pendirian = self.pengajuan_tempo_id.dokumen_akta_pendirian
+ self.user_company_id.dokumen_akta_pendirian = self.pengajuan_tempo_id.dokumen_akta_pendirian[0] if self.pengajuan_tempo_id.dokumen_akta_pendirian else []
if self.user_company_id.dokumen_akta_pendirian:
self.user_company_id.message_post(body='Dokumen Akta Pendirian',
attachment_ids=[self.user_company_id.dokumen_akta_pendirian.id])
- self.user_company_id.dokumen_laporan_keuangan = self.pengajuan_tempo_id.dokumen_laporan_keuangan
+ self.user_company_id.dokumen_laporan_keuangan = self.pengajuan_tempo_id.dokumen_laporan_keuangan[0] if self.pengajuan_tempo_id.dokumen_laporan_keuangan else []
if self.user_company_id.dokumen_laporan_keuangan:
self.user_company_id.message_post(body='Dokumen Laporan Keuangan',
attachment_ids=[self.user_company_id.dokumen_laporan_keuangan.id])
- self.user_company_id.dokumen_foto_kantor = self.pengajuan_tempo_id.dokumen_foto_kantor
+ self.user_company_id.dokumen_foto_kantor = self.pengajuan_tempo_id.dokumen_foto_kantor[0] if self.pengajuan_tempo_id.dokumen_foto_kantor else []
if self.user_company_id.dokumen_foto_kantor:
self.user_company_id.message_post(body='Dokumen Foto Kantor',
attachment_ids=[self.user_company_id.dokumen_foto_kantor.id])
- self.user_company_id.dokumen_tempat_bekerja = self.pengajuan_tempo_id.dokumen_tempat_bekerja
+ self.user_company_id.dokumen_tempat_bekerja = self.pengajuan_tempo_id.dokumen_tempat_bekerja[0] if self.pengajuan_tempo_id.dokumen_tempat_bekerja else []
if self.user_company_id.dokumen_tempat_bekerja:
self.user_company_id.message_post(body='Dokumen Tempat Bekerja',
attachment_ids=[self.user_company_id.dokumen_tempat_bekerja.id])
@@ -165,10 +248,13 @@ class UserPengajuanTempoRequest(models.Model):
# user.send_company_request_approve_mail()
self.user_company_id.property_payment_term_id = self.pengajuan_tempo_id.tempo_duration.id
self.user_company_id.active_limit = True
- self.user_company_id.warning_stage = self.pengajuan_tempo_id.tempo_limit - (int(self.pengajuan_tempo_id.tempo_limit)/2)
+ self.user_company_id.warning_stage = float(self.pengajuan_tempo_id.tempo_limit) - (float(self.pengajuan_tempo_id.tempo_limit)/2)
self.user_company_id.blocking_stage = self.pengajuan_tempo_id.tempo_limit
- template = self.env.ref('indoteknik_custom.mail_template_user_cart_reminder_to_checkout')
- template.send_mail(latest_cart.id, force_send=True)
+ # template = self.env.ref('indoteknik_custom.mail_template_res_user_company_tempo_approved')
+ # tempo = self.pengajuan_tempo_id
+ # template.send_mail(tempo.id, force_send=True)
+ template = self.env.ref('indoteknik_custom.mail_template_res_user_company_tempo_approved')
+ template.send_mail(self.id, force_send=True)
# self.user_id.parent_id = new_company.id
# user.send_company_request_reject_mail()
return super(UserPengajuanTempoRequest, self).write(vals)
@@ -177,4 +263,8 @@ class UserPengajuanTempoRequest(models.Model):
return request.env['res.users'].search([
('login', '=', email),
('active', 'in', [True, False])
- ]) \ No newline at end of file
+ ])
+
+ def format_currency(self, number):
+ number = int(number)
+ return "{:,}".format(number).replace(',', '.') \ No newline at end of file
diff --git a/indoteknik_custom/security/ir.model.access.csv b/indoteknik_custom/security/ir.model.access.csv
index baf50c5c..e55bd2d9 100755
--- a/indoteknik_custom/security/ir.model.access.csv
+++ b/indoteknik_custom/security/ir.model.access.csv
@@ -150,4 +150,6 @@ access_va_multi_approve,access.va.multi.approve,model_va_multi_approve,,1,1,1,1
access_va_multi_reject,access.va.multi.reject,model_va_multi_reject,,1,1,1,1
access_User_pengajuan_tempo_line,access.user.pengajuan.tempo.line,model_user_pengajuan_tempo_line,,1,1,1,1
-access_user_pengajuan_tempo,access.user.pengajuan.tempo,model_user_pengajuan_tempo,,1,1,1,1 \ No newline at end of file
+access_user_pengajuan_tempo,access.user.pengajuan.tempo,model_user_pengajuan_tempo,,1,1,1,1
+access_reject_reason_wizard,reject.reason.wizard,model_reject_reason_wizard,,1,1,1,0
+access_confirm_approval_wizard,confirm.approval.wizard,model_confirm_approval_wizard,,1,1,1,0
diff --git a/indoteknik_custom/views/user_pengajuan_tempo.xml b/indoteknik_custom/views/user_pengajuan_tempo.xml
index 5b8ed293..30d75fe8 100644
--- a/indoteknik_custom/views/user_pengajuan_tempo.xml
+++ b/indoteknik_custom/views/user_pengajuan_tempo.xml
@@ -96,8 +96,8 @@
</group>
</sheet>
<div class="oe_chatter">
- <field name="message_ids" widget="mail_thread"/>
- </div>
+ <field name="message_ids" widget="mail_thread"/>
+ </div>
</form>
</field>
</record>
@@ -121,7 +121,7 @@
<field name="model_id" ref="indoteknik_custom.model_user_pengajuan_tempo"/>
<field name="subject">Permohonan Tempo Anda Sedang Ditinjau</field>
<field name="email_from">"Indoteknik.com" &lt;noreply@indoteknik.com&gt;</field>
- <field name="reply_to">noreply@indoteknik.com</field>
+ <field name="reply_to">sales@indoteknik.com</field>
<field name="email_to">${object.user_id.login | safe}</field>
<field name="body_html" type="html">
<table border="0" cellpadding="0" cellspacing="0" style="padding-top: 16px; background-color: #F1F1F1; font-family:Inter, Helvetica, Verdana, Arial,sans-serif; line-height: 24px; color: #454748; width: 100%; border-collapse:separate;">
@@ -152,7 +152,7 @@
<table border="0" cellpadding="0" cellspacing="0" width="590" style="min-width: 590px; background-color: white; padding: 0px 8px 0px 8px; border-collapse:separate;">
<tr><td style="padding-bottom: 24px;"><b>Hai. ${object.name_tempo.name},</b></td></tr>
- <tr><td style="padding-bottom: 16px;">Terima kasih atas kepercayaan Anda memilih indoteknik.com. Kami telah menerima permohonan pemayaran tempo Anda.</td></tr>
+ <tr><td style="padding-bottom: 16px;">Terima kasih atas kepercayaan Anda memilih indoteknik.com. Kami telah menerima permohonan pembayaran tempo Anda.</td></tr>
<tr><td style="padding-bottom: 16px;">Saat ini, tim kami sedang melakukan peninjauan terhadap permohonan Anda. Proses peninjauan ini membutuhkan waktu.</td></tr>
<tr>
<td style="padding-bottom: 16px; ">Kami akan informasikan kembali mengenai hasil peninjauan pembayaran tempo anda melalui email ini.</td>
@@ -162,8 +162,8 @@
<tr><td style="padding-bottom: 2px;"><b>Hormat kami,</b></td></tr>
<tr><td style="padding-bottom: 2px;">PT. INDOTEKNIK DOTCOM GEMILANG</td></tr>
<tr>
- <td valign="middle" align="center">
- <img src="https://erp.indoteknik.com/api/image/ir.attachment/datas/2135765" alt="Indoteknik" style="max-width: 100%; height: auto;"></img>
+ <td valign="middle" align="left">
+ <img src="https://erp.indoteknik.com/api/image/ir.attachment/datas/2135765" alt="Indoteknik" style="max-width: 50%; height: auto;"></img>
</td>
</tr>
<tr>
@@ -183,13 +183,14 @@
</field>
</record>
- <record id="mail_template_res_user_company_tempo_reject" model="mail.template">
- <field name="name">Users: Company Tempo Reject</field>
+ <record id="mail_template_res_user_company_new_tempo_to_sales" model="mail.template">
+ <field name="name">Users: Company New Tempo To Sales</field>
<field name="model_id" ref="indoteknik_custom.model_user_pengajuan_tempo"/>
- <field name="subject">Mohon Maaf Pengajuan Tempo anda kami Tolak</field>
+ <field name="subject">Pengajuan Tempo Harus di Periksa!</field>
<field name="email_from">"Indoteknik.com" &lt;noreply@indoteknik.com&gt;</field>
- <field name="reply_to">noreply@indoteknik.com</field>
- <field name="email_to">${object.user_id.login | safe}</field>
+ <field name="reply_to">sales@indoteknik.com</field>
+<!-- <field name="email_to">vita@indoteknik.co.id</field>-->
+ <field name="email_to">sapiabon768@gmail.com</field>
<field name="body_html" type="html">
<table border="0" cellpadding="0" cellspacing="0" style="padding-top: 16px; background-color: #F1F1F1; font-family:Inter, Helvetica, Verdana, Arial,sans-serif; line-height: 24px; color: #454748; width: 100%; border-collapse:separate;">
<tr><td align="center">
@@ -217,21 +218,20 @@
<tr>
<td align="center" style="min-width: 590px;">
<table border="0" cellpadding="0" cellspacing="0" width="590" style="min-width: 590px; background-color: white; padding: 0px 8px 0px 8px; border-collapse:separate;">
- <tr><td style="padding-bottom: 24px;"><b>Hai. ${object.name_tempo.name},</b></td></tr>
+ <tr><td style="padding-bottom: 24px;"><b>Halo Manager Tim Sales, Novita Mayasari.</b></td></tr>
- <tr><td style="padding-bottom: 16px;">Kami sampaikan dengan sangat menyesal bahwa pengajuan permohonan tempo pembayaran Anda yang diajukan pada tanggal ${format_date(object.create_date, 'dd MMMM yyyy')} tidak dapat kami setujui.</td></tr>
- <tr><td style="padding-bottom: 16px;">Keputusan ini telah kami pertimbangkan secara matang berdasarkan beberapa faktor, termasuk [alasan penolakan, misal: riwayat pembayaran, profil kredit, atau kebijakan perusahaan].</td></tr>
- <tr>
- <td style="padding-bottom: 16px; ">Kami memahami bahwa hal ini mungkin mengecewakan. Namun, kami berharap Anda dapat memahami kebijakan perusahaan kami.</td>
- </tr>
+ <tr><td style="padding-bottom: 16px;">Kami sampaikan informasi bahwa saat ini terdapat pengajuan Pembayaran Tempo dari ${object.name_tempo.name} melalui website Indoteknik.com.</td></tr>
- <tr><td style="padding-bottom: 16px;">Terima kasih atas pengertiannya.</td></tr>
+ <tr><td style="padding-bottom: 16px;">Mohon dapat segera melakukan pengecekan dan evaluasi terhadap data perusahaan yang telah dilampirkan tersebut agar proses pengajuan dapat diproses lebih lanjut.</td></tr>
+
+
+ <tr><td style="padding-bottom: 16px;">Terima kasih atas perhatian dan kerjasamanya.</td></tr>
<tr><td style="padding-bottom: 2px;"><b>Hormat kami,</b></td></tr>
<tr><td style="padding-bottom: 2px;">PT. INDOTEKNIK DOTCOM GEMILANG</td></tr>
<tr>
- <td valign="middle" align="center">
- <img src="https://erp.indoteknik.com/api/image/ir.attachment/datas/2135765" alt="Indoteknik" style="max-width: 100%; height: auto;"></img>
+ <td valign="middle" align="left">
+ <img src="https://erp.indoteknik.com/api/image/ir.attachment/datas/2135765" alt="Indoteknik" style="max-width: 50%; height: auto;"></img>
</td>
</tr>
<tr>
@@ -250,14 +250,14 @@
</table>
</field>
</record>
-
- <record id="mail_template_res_user_company_tempo_approved" model="mail.template">
- <field name="name">Users: Company Tempo Approved</field>
- <field name="model_id" ref="indoteknik_custom.model_user_pengajuan_tempo"/>
- <field name="subject">Pengajuan Tempo kamu di Indoteknik.com Telah Disetujui!</field>
+ <record id="mail_template_res_user_company_tempo_approved_by_sales" model="mail.template">
+ <field name="name">Users: Company Tempo Approved By Sales</field>
+ <field name="model_id" ref="indoteknik_custom.model_user_pengajuan_tempo_request"/>
+ <field name="subject">Pengajuan Tempo Harus di Periksa!</field>
<field name="email_from">"Indoteknik.com" &lt;noreply@indoteknik.com&gt;</field>
- <field name="reply_to">noreply@indoteknik.com</field>
- <field name="email_to">${object.user_id.login | safe}</field>
+ <field name="reply_to">sales@indoteknik.com</field>
+<!-- <field name="email_to">widyariyanti97@gmail.com, stephan@indoteknik.co.id</field>-->
+ <field name="email_to">sapiabon768@gmail.com</field>
<field name="body_html" type="html">
<table border="0" cellpadding="0" cellspacing="0" style="padding-top: 16px; background-color: #F1F1F1; font-family:Inter, Helvetica, Verdana, Arial,sans-serif; line-height: 24px; color: #454748; width: 100%; border-collapse:separate;">
<tr><td align="center">
@@ -285,23 +285,20 @@
<tr>
<td align="center" style="min-width: 590px;">
<table border="0" cellpadding="0" cellspacing="0" width="590" style="min-width: 590px; background-color: white; padding: 0px 8px 0px 8px; border-collapse:separate;">
- <tr><td style="padding-bottom: 24px;"><b>Hai. ${object.name_tempo.name},</b></td></tr>
+ <tr><td style="padding-bottom: 24px;"><b>Halo Tim Finance Indoteknik,</b></td></tr>
- <tr><td style="padding-bottom: 16px;">Kabar baik! Kami dengan senang hati menginformasikan bahwa pengajuan tempo pembayaran kamui di Indoteknik.com telah disetujui dengan detail sebagai berikut.</td></tr>
- <tr><td style="padding-bottom: 4px;">Limit Pembayaran Tempo : Rp ${object.format_currency(object.tempo_limit)}</td></tr>
+ <tr><td style="padding-bottom: 16px;">Kami informasikan bahwa pengajuan tempo dari ${object.pengajuan_tempo_id.name_tempo.name} telah disetujui oleh Manager Divisi Sales.</td></tr>
+
+ <tr><td style="padding-bottom: 16px;">Untuk kelancaran proses selanjutnya, kami mohon kesediaannya untuk melakukan pengecekan ulang terhadap pengajuan tempo tersebut.</td></tr>
- <tr><td style="padding-bottom: 16px;">Durasi Pembayaran Tempo : ${object.tempo_duration.name}</td></tr>
- <tr>
- <td style="padding-bottom: 16px; ">Kamu dapat melakukan pembayaran sesuai dengan jangka waktu yang telah disepakati. Detail lengkap mengenai transaksi kamu, termasuk tanggal jatuh tempo &amp; Pengajuan Kenaikan Limit Tempo, dapat kamu lihat di akun Profile Indoteknik.com.</td>
- </tr>
- <tr><td style="padding-bottom: 16px;">Terima kasih atas kepercayaan kamu kepada Indoteknik.com.</td></tr>
+ <tr><td style="padding-bottom: 16px;">Terima kasih atas perhatian dan kerjasamanya.</td></tr>
<tr><td style="padding-bottom: 2px;"><b>Hormat kami,</b></td></tr>
<tr><td style="padding-bottom: 2px;">PT. INDOTEKNIK DOTCOM GEMILANG</td></tr>
<tr>
- <td valign="middle" align="center">
- <img src="https://erp.indoteknik.com/api/image/ir.attachment/datas/2135765" alt="Indoteknik" style="max-width: 100%; height: auto;"></img>
+ <td valign="middle" align="left">
+ <img src="https://erp.indoteknik.com/api/image/ir.attachment/datas/2135765" alt="Indoteknik" style="max-width: 50%; height: auto;"></img>
</td>
</tr>
<tr>
diff --git a/indoteknik_custom/views/user_pengajuan_tempo_request.xml b/indoteknik_custom/views/user_pengajuan_tempo_request.xml
index 4a8243da..17ae526c 100644
--- a/indoteknik_custom/views/user_pengajuan_tempo_request.xml
+++ b/indoteknik_custom/views/user_pengajuan_tempo_request.xml
@@ -25,13 +25,13 @@
class="oe_highlight"
/>
-<!-- <button name="action_reject"-->
-<!-- string="Reject"-->
-<!-- attrs="{'invisible': [('state_tempo', 'not in', ['approval_director'])]}"-->
-<!-- type="object"-->
-<!-- groups="purchase.group_purchase_manager"-->
-<!-- class="oe_highlight" />-->
- <field name="state_tempo" widget="statusbar" statusbar_visible="draft,approval_sales,approval_finance,approval_director"/>
+ <button name="button_reject"
+ string="Reject"
+ attrs="{'visible': [ ('state_tempo', 'in', ['draft', 'approval_sales', 'approval_finance'])]}"
+ type="object"
+ groups="purchase.group_purchase_manager"
+ class="oe_highlight" />
+ <field name="state_tempo" widget="statusbar" statusbar_visible="draft,approval_sales,approval_finance,approval_director" statusbar_colors='{"reject":"red"}'/>
</header>
<sheet>
<group>
@@ -43,10 +43,257 @@
</group>
</group>
</sheet>
+ <div class="oe_chatter">
+ <field name="message_ids" widget="mail_thread"/>
+ </div>
</form>
</field>
</record>
+ <!-- Wizard for Reject Reason -->
+<record id="view_reject_reason_wizard_form" model="ir.ui.view">
+ <field name="name">reject.reason.wizard.form</field>
+ <field name="model">reject.reason.wizard</field>
+ <field name="arch" type="xml">
+ <form string="Reject Reason">
+ <group>
+ <field name="reason_reject" widget="text"/>
+ </group>
+ <footer>
+ <button string="Confirm" type="object" name="confirm_reject" class="btn-primary"/>
+ <button string="Cancel" class="btn-secondary" special="cancel"/>
+ </footer>
+ </form>
+ </field>
+</record>
+
+<record id="action_reject_reason_wizard" model="ir.actions.act_window">
+ <field name="name">Reject Reason</field>
+ <field name="res_model">reject.reason.wizard</field>
+ <field name="view_mode">form</field>
+ <field name="target">new</field>
+</record>
+
+
+<record id="view_confirm_approval_wizard_form" model="ir.ui.view">
+ <field name="name">confirm.approval.wizard.form</field>
+ <field name="model">confirm.approval.wizard</field>
+ <field name="arch" type="xml">
+ <form string="Konfirmasi Approval">
+ <group>
+ <p>Apakah Anda yakin ingin mengapprove tempo ini?</p>
+ </group>
+ <footer>
+ <button string="Batal" class="btn-secondary" special="cancel"/>
+ <button string="Konfirmasi" type="object" name="confirm_approval" class="btn-primary"/>
+ </footer>
+ </form>
+ </field>
+</record>
+
+ <record id="mail_template_res_user_company_tempo_to_aprove_director" model="mail.template">
+ <field name="name">Users: Company Tempo To Approve Director</field>
+ <field name="model_id" ref="indoteknik_custom.model_user_pengajuan_tempo_request"/>
+ <field name="subject">Pengajuan Tempo Harus di Periksa!</field>
+ <field name="email_from">"Indoteknik.com" &lt;noreply@indoteknik.com&gt;</field>
+ <field name="reply_to">sales@indoteknik.com</field>
+<!-- <field name="email_to">akbar@fixcomart.co.id</field>-->
+ <field name="email_to">sapiabon768@gmail.com</field>
+ <field name="body_html" type="html">
+ <table border="0" cellpadding="0" cellspacing="0" style="padding-top: 16px; background-color: #F1F1F1; font-family:Inter, Helvetica, Verdana, Arial,sans-serif; line-height: 24px; color: #454748; width: 100%; border-collapse:separate;">
+ <tr><td align="center">
+ <table border="0" cellpadding="0" cellspacing="0" width="590" style="font-size: 13px; padding: 16px; background-color: white; color: #454748; border-collapse:separate;">
+ <!-- HEADER -->
+ <tbody>
+ <tr>
+ <td align="center" style="min-width: 590px;">
+ <table border="0" cellpadding="0" cellspacing="0" width="590" style="min-width: 590px; background-color: white; padding: 0px 8px 0px 8px; border-collapse:separate;">
+ <tr>
+ <td valign="middle">
+ <span></span>
+ </td>
+ </tr>
+
+ <tr>
+ <td colspan="2" style="text-align:center;">
+ <hr width="100%" style="background-color:rgb(204,204,204);border:medium none;clear:both;display:block;font-size:0px;min-height:1px;line-height:0; margin: 16px 0px 16px 0px;" />
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <!-- CONTENT -->
+ <tr>
+ <td align="center" style="min-width: 590px;">
+ <table border="0" cellpadding="0" cellspacing="0" width="590" style="min-width: 590px; background-color: white; padding: 0px 8px 0px 8px; border-collapse:separate;">
+ <tr><td style="padding-bottom: 24px;"><b>Halo Pak Akbar,</b></td></tr>
+
+ <tr><td style="padding-bottom: 16px;">Kami sampaikan informasi bahwa saat ini terdapat pengajuan Pembayaran Tempo dari ${object.pengajuan_tempo_id.name_tempo.name} telah melalui tahap persetujuan awal dari Manager Sales &amp; diverifikasi oleh ${object.write_uid.name} dari tim Finance.</td></tr>
+
+ <tr><td style="padding-bottom: 16px;">Untuk proses persetujuan akhir, mohon Bapak dapat segera meninjau dan mengevaluasi atas pengajuan terhadap data yang telah diberikan oleh ${object.pengajuan_tempo_id.name_tempo.name}.</td></tr>
+
+ <tr><td style="padding-bottom: 2px;"><b>Hormat kami,</b></td></tr>
+ <tr><td style="padding-bottom: 2px;">PT. INDOTEKNIK DOTCOM GEMILANG</td></tr>
+ <tr>
+ <td valign="middle" align="left">
+ <img src="https://erp.indoteknik.com/api/image/ir.attachment/datas/2135765" alt="Indoteknik" style="max-width: 50%; height: auto;"></img>
+ </td>
+ </tr>
+ <tr>
+ <td style="text-align:center;">
+ <hr width="100%"
+ style="background-color:rgb(204,204,204);border:medium none;clear:both;display:block;font-size:0px;min-height:1px;line-height:0; margin: 16px 0px 16px 0px;" />
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <!-- CONTENT -->
+ </tbody>
+ </table>
+ </td></tr>
+ </table>
+ </field>
+ </record>
+ <record id="mail_template_res_user_company_tempo_approved" model="mail.template">
+ <field name="name">Users: Company Tempo Approved</field>
+ <field name="model_id" ref="indoteknik_custom.model_user_pengajuan_tempo_request"/>
+ <field name="subject">Pengajuan Tempo kamu di Indoteknik.com Telah Disetujui!</field>
+ <field name="email_from">"Indoteknik.com" &lt;noreply@indoteknik.com&gt;</field>
+ <field name="reply_to">sales@indoteknik.com</field>
+ <field name="email_to">${object.pengajuan_tempo_id.user_id.login | safe}</field>
+ <field name="body_html" type="html">
+ <table border="0" cellpadding="0" cellspacing="0" style="padding-top: 16px; background-color: #F1F1F1; font-family:Inter, Helvetica, Verdana, Arial,sans-serif; line-height: 24px; color: #454748; width: 100%; border-collapse:separate;">
+ <tr><td align="center">
+ <table border="0" cellpadding="0" cellspacing="0" width="590" style="font-size: 13px; padding: 16px; background-color: white; color: #454748; border-collapse:separate;">
+ <!-- HEADER -->
+ <tbody>
+ <tr>
+ <td align="center" style="min-width: 590px;">
+ <table border="0" cellpadding="0" cellspacing="0" width="590" style="min-width: 590px; background-color: white; padding: 0px 8px 0px 8px; border-collapse:separate;">
+ <tr>
+ <td valign="middle">
+ <span></span>
+ </td>
+ </tr>
+
+ <tr>
+ <td colspan="2" style="text-align:center;">
+ <hr width="100%" style="background-color:rgb(204,204,204);border:medium none;clear:both;display:block;font-size:0px;min-height:1px;line-height:0; margin: 16px 0px 16px 0px;" />
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <!-- CONTENT -->
+ <tr>
+ <td align="center" style="min-width: 590px;">
+ <table border="0" cellpadding="0" cellspacing="0" width="590" style="min-width: 590px; background-color: white; padding: 0px 8px 0px 8px; border-collapse:separate;">
+ <tr><td style="padding-bottom: 24px;"><b>Hai. ${object.pengajuan_tempo_id.name_tempo.name},</b></td></tr>
+
+ <tr><td style="padding-bottom: 16px;">Kabar baik! Kami dengan senang hati menginformasikan bahwa pengajuan tempo pembayaran kamu di Indoteknik.com telah disetujui dengan detail sebagai berikut.</td></tr>
+ <tr><td style="padding-bottom: 4px;"><b>Limit Pembayaran Tempo : Rp ${object.format_currency(object.pengajuan_tempo_id.tempo_limit)}</b></td></tr>
+
+ <tr><td style="padding-bottom: 16px;"><b>Durasi Pembayaran Tempo : ${object.pengajuan_tempo_id.tempo_duration.name}</b></td></tr>
+ <tr>
+ <td style="padding-bottom: 16px; ">Kamu dapat melakukan pembayaran sesuai dengan jangka waktu yang telah disepakati. Detail lengkap mengenai transaksi kamu, termasuk tanggal jatuh tempo &amp; Pengajuan Kenaikan Limit Tempo, dapat kamu lihat di akun <a href="https://indoteknik.com/my/profile">Profile Indoteknik.com</a> .</td>
+ </tr>
+
+ <tr><td style="padding-bottom: 16px;">Terima kasih atas kepercayaan kamu kepada Indoteknik.com.</td></tr>
+
+ <tr><td style="padding-bottom: 2px;"><b>Hormat kami,</b></td></tr>
+ <tr><td style="padding-bottom: 2px;">PT. INDOTEKNIK DOTCOM GEMILANG</td></tr>
+ <tr>
+ <td valign="middle" align="left">
+ <img src="https://erp.indoteknik.com/api/image/ir.attachment/datas/2135765" alt="Indoteknik" style="max-width: 50%; height: auto;"></img>
+ </td>
+ </tr>
+ <tr>
+ <td style="text-align:center;">
+ <hr width="100%"
+ style="background-color:rgb(204,204,204);border:medium none;clear:both;display:block;font-size:0px;min-height:1px;line-height:0; margin: 16px 0px 16px 0px;" />
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <!-- CONTENT -->
+ </tbody>
+ </table>
+ </td></tr>
+ </table>
+ </field>
+ </record>
+ <record id="mail_template_res_user_company_tempo_reject" model="mail.template">
+ <field name="name">Users: Company Tempo Reject</field>
+ <field name="model_id" ref="indoteknik_custom.model_user_pengajuan_tempo_request"/>
+ <field name="subject">Mohon Maaf Pengajuan Tempo anda kami Tolak</field>
+ <field name="email_from">"Indoteknik.com" &lt;noreply@indoteknik.com&gt;</field>
+ <field name="reply_to">sales@indoteknik.com</field>
+ <field name="email_to">${object.pengajuan_tempo_id.user_id.login | safe}</field>
+<!-- <field name="email_to">sapiabon768@gmail.com</field>-->
+ <field name="body_html" type="html">
+ <table border="0" cellpadding="0" cellspacing="0" style="padding-top: 16px; background-color: #F1F1F1; font-family:Inter, Helvetica, Verdana, Arial,sans-serif; line-height: 24px; color: #454748; width: 100%; border-collapse:separate;">
+ <tr><td align="center">
+ <table border="0" cellpadding="0" cellspacing="0" width="590" style="font-size: 13px; padding: 16px; background-color: white; color: #454748; border-collapse:separate;">
+ <!-- HEADER -->
+ <tbody>
+ <tr>
+ <td align="center" style="min-width: 590px;">
+ <table border="0" cellpadding="0" cellspacing="0" width="590" style="min-width: 590px; background-color: white; padding: 0px 8px 0px 8px; border-collapse:separate;">
+ <tr>
+ <td valign="middle">
+ <span></span>
+ </td>
+ </tr>
+
+ <tr>
+ <td colspan="2" style="text-align:center;">
+ <hr width="100%" style="background-color:rgb(204,204,204);border:medium none;clear:both;display:block;font-size:0px;min-height:1px;line-height:0; margin: 16px 0px 16px 0px;" />
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <!-- CONTENT -->
+ <tr>
+ <td align="center" style="min-width: 590px;">
+ <table border="0" cellpadding="0" cellspacing="0" width="590" style="min-width: 590px; background-color: white; padding: 0px 8px 0px 8px; border-collapse:separate;">
+ <tr><td style="padding-bottom: 24px;"><b>Hai. ${object.pengajuan_tempo_id.name_tempo.name},</b></td></tr>
+
+ <tr><td style="padding-bottom: 16px;">Kami sampaikan dengan sangat menyesal bahwa pengajuan permohonan tempo pembayaran Anda yang diajukan pada tanggal ${format_date(object.pengajuan_tempo_id.create_date, 'dd MMMM yyyy')} tidak dapat kami setujui.</td></tr>
+ <tr><td style="padding-bottom: 16px;">Keputusan ini telah kami pertimbangkan secara matang berdasarkan beberapa faktor, diantaranya alasan tidak disetujuinya adalah ${object.reason_reject}</td></tr>
+ <tr>
+ <td style="padding-bottom: 16px; ">Kami memahami bahwa hal ini mungkin mengecewakan. Namun, kami berharap Anda dapat memahami kebijakan perusahaan kami.</td>
+ </tr>
+
+ <tr><td style="padding-bottom: 16px;">Terima kasih atas pengertiannya.</td></tr>
+
+ <tr><td style="padding-bottom: 2px;"><b>Hormat kami,</b></td></tr>
+ <tr><td style="padding-bottom: 2px;">PT. INDOTEKNIK DOTCOM GEMILANG</td></tr>
+ <tr>
+ <td valign="middle" align="left">
+ <img src="https://erp.indoteknik.com/api/image/ir.attachment/datas/2135765" alt="Indoteknik" style="max-width: 50%; height: auto;"></img>
+ </td>
+ </tr>
+ <tr>
+ <td style="text-align:center;">
+ <hr width="100%"
+ style="background-color:rgb(204,204,204);border:medium none;clear:both;display:block;font-size:0px;min-height:1px;line-height:0; margin: 16px 0px 16px 0px;" />
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <!-- CONTENT -->
+ </tbody>
+ </table>
+ </td></tr>
+ </table>
+ </field>
+ </record>
+
+
<record id="action_user_pengajuan_tempo_request" model="ir.actions.act_window">
<field name="name">User Pengajuan Tempo Request</field>
<field name="type">ir.actions.act_window</field>