diff options
| author | Miqdad <ahmadmiqdad27@gmail.com> | 2025-09-30 08:09:37 +0700 |
|---|---|---|
| committer | Miqdad <ahmadmiqdad27@gmail.com> | 2025-09-30 08:09:37 +0700 |
| commit | fa8322bc30edf708252d8d932abfc0735b51951c (patch) | |
| tree | 723c5e60b36dcdff7fe427b86f079157774f0591 | |
| parent | 1f58d7d4973edf04d6a3f3092115492585c1545b (diff) | |
| parent | e87e62308f3f38f03b82e22765fa1a203a869a82 (diff) | |
Merge branch 'odoo-backup' of https://bitbucket.org/altafixco/indoteknik-addons into odoo-backup
merge
| -rwxr-xr-x | indoteknik_custom/__manifest__.py | 4 | ||||
| -rw-r--r-- | indoteknik_custom/models/approval_payment_term.py | 1 | ||||
| -rw-r--r-- | indoteknik_custom/models/letter_receivable.py | 167 | ||||
| -rw-r--r-- | indoteknik_custom/models/stock_picking.py | 3 | ||||
| -rw-r--r-- | indoteknik_custom/report/report_surat_piutang copy.xml | 149 | ||||
| -rw-r--r-- | indoteknik_custom/report/report_surat_piutang.xml | 6 | ||||
| -rw-r--r-- | indoteknik_custom/report/report_tutup_tempo.xml | 158 | ||||
| -rw-r--r-- | indoteknik_custom/views/approval_payment_term.xml | 4 | ||||
| -rw-r--r-- | indoteknik_custom/views/close_tempo_mail_template.xml | 56 | ||||
| -rw-r--r-- | indoteknik_custom/views/letter_receivable.xml | 10 | ||||
| -rw-r--r-- | indoteknik_custom/views/mail_template_closing_apt.xml | 32 |
11 files changed, 369 insertions, 221 deletions
diff --git a/indoteknik_custom/__manifest__.py b/indoteknik_custom/__manifest__.py index cf7cf1e4..b083be70 100755 --- a/indoteknik_custom/__manifest__.py +++ b/indoteknik_custom/__manifest__.py @@ -167,6 +167,7 @@ 'report/report_picking.xml', 'report/report_sale_order.xml', 'report/report_surat_piutang.xml', + 'report/report_tutup_tempo.xml', 'report/purchase_report.xml', 'views/vendor_sla.xml', 'views/coretax_faktur.xml', @@ -183,7 +184,8 @@ 'views/letter_receivable.xml', 'views/letter_receivable_mail_template.xml', # 'views/reimburse.xml', - 'views/sj_tele.xml' + 'views/sj_tele.xml', + 'views/close_tempo_mail_template.xml', ], 'demo': [], 'css': [], diff --git a/indoteknik_custom/models/approval_payment_term.py b/indoteknik_custom/models/approval_payment_term.py index 449bd90b..e45305db 100644 --- a/indoteknik_custom/models/approval_payment_term.py +++ b/indoteknik_custom/models/approval_payment_term.py @@ -56,6 +56,7 @@ class ApprovalPaymentTerm(models.Model): change_log_688 = fields.Text(string="Change Log", readonly=True, copy=False) + def write(self, vals): # Ambil nilai lama sebelum perubahan old_values_dict = { diff --git a/indoteknik_custom/models/letter_receivable.py b/indoteknik_custom/models/letter_receivable.py index 16034938..ffe14491 100644 --- a/indoteknik_custom/models/letter_receivable.py +++ b/indoteknik_custom/models/letter_receivable.py @@ -23,6 +23,7 @@ class SuratPiutang(models.Model): tujuan_nama = fields.Char(string="Nama Tujuan", tracking=True) tujuan_email = fields.Char(string="Email Tujuan", tracking=True) perihal = fields.Selection([ + ('tutup_tempo', 'Surat Penutupan Pembayaran Tempo'), ('penagihan', 'Surat Resmi Penagihan'), ('sp1', 'Surat Peringatan Piutang ke-1'), ('sp2', 'Surat Peringatan Piutang ke-2'), @@ -36,6 +37,7 @@ class SuratPiutang(models.Model): ("sent", "Approved & Sent") ], default="draft", tracking=True) send_date = fields.Datetime(string="Tanggal Kirim", tracking=True) + due_date = fields.Date(string="Tanggal Jatuh Tempo", tracking=True, default= fields.Date.today) seven_days_after_sent_date = fields.Char(string="7 Hari Setelah Tanggal Kirim") periode_invoices_terpilih = fields.Char( string="Periode Invoices Terpilih", @@ -228,20 +230,27 @@ class SuratPiutang(models.Model): continue # === Surat penagihan biasa (langsung Pimpinan approve) === - if rec.perihal == "penagihan": + if rec.perihal in ("tutup_tempo", "penagihan"): # if self.env.user.id not in pimpinan_user_ids: # raise UserError("Hanya Pimpinan yang boleh menyetujui surat penagihan.") rec.state = "sent" now_utc = now_wib.astimezone(pytz.UTC).replace(tzinfo=None) rec.send_date = now_utc rec.action_send_letter() - rec.message_post(body="Surat Penagihan disetujui dan berhasil dikirim.") + rec.message_post(body=f"{rec.perihal_label} disetujui dan berhasil dikirim.") self.env.user.notify_info( message=f"Surat piutang {rec.name} berhasil dikirim ke {rec.partner_id.name} ({rec.tujuan_email})", title="Informasi", sticky=False ) + + def action_print(self): + self.ensure_one() + if self.perihal == 'tutup_tempo': + return self.env.ref('indoteknik_custom.action_report_surat_tutup_tempo').report_action(self) + else: + return self.env.ref('indoteknik_custom.action_report_surat_piutang').report_action(self) def action_send_letter(self): self.ensure_one() @@ -253,64 +262,79 @@ class SuratPiutang(models.Model): if not self.tujuan_email: raise UserError(_("Email tujuan harus diisi.")) - template = self.env.ref('indoteknik_custom.letter_receivable_mail_template') - # today = fields.Date.today() - - month_map = { - 1: "Januari", 2: "Februari", 3: "Maret", 4: "April", - 5: "Mei", 6: "Juni", 7: "Juli", 8: "Agustus", - 9: "September", 10: "Oktober", 11: "November", 12: "Desember", - } - target_date = (self.send_date or fields.Datetime.now()).date() + timedelta(days=7) - self.seven_days_after_sent_date = f"{target_date.day} {month_map[target_date.month]}" - - perihal_map = { - 'penagihan': 'Surat Resmi Penagihan', - 'sp1': 'Surat Peringatan Pertama (I)', - 'sp2': 'Surat Peringatan Kedua (II)', - 'sp3': 'Surat Peringatan Ketiga (III)', - } - perihal_text = perihal_map.get(self.perihal, self.perihal or '') - - invoice_table_rows = "" - grand_total = 0 - for line in selected_lines: - # days_to_due = (line.invoice_date_due - today).days if line.invoice_date_due else 0 - grand_total += line.amount_residual - invoice_table_rows += f""" - <tr> - <td>{line.invoice_number or '-'}</td> - <td>{self.partner_id.name or '-'}</td> - <td>{fields.Date.to_string(line.invoice_date) or '-'}</td> - <td>{fields.Date.to_string(line.invoice_date_due) or '-'}</td> - <td>{line.new_invoice_day_to_due}</td> - <td>{line.ref or '-'}</td> - <td>{formatLang(self.env, line.amount_residual, currency_obj=line.currency_id)}</td> - <td>{line.payment_term_id.name or '-'}</td> - </tr> - """ - - invoice_table_footer = f""" - <tfoot> - <tr style="font-weight:bold; background-color:#f9f9f9;"> - <td colspan="6" align="right">Grand Total</td> - <td>{formatLang(self.env, grand_total, currency_obj=self.currency_id, monetary=True)}</td> - <td colspan="2"></td> + template = None + report = None + body_html = None + subject = None + + # Logika untuk memilih template dan report berdasarkan 'perihal' + if self.perihal == 'tutup_tempo': + template = self.env.ref('indoteknik_custom.close_tempo_mail_template') + report = self.env.ref('indoteknik_custom.action_report_surat_tutup_tempo') + due_date_str = self.due_date.strftime('%d %B %Y') if self.due_date else 'yang telah ditentukan' + body_html = template.body_html \ + .replace('${object.partner_id.name}', self.partner_id.name or '') \ + .replace('${object.due_date}', due_date_str or '') + subject = f"Pemberitahuan Penutupan Pembayaran Tempo – {self.partner_id.name}" + else: + template = self.env.ref('indoteknik_custom.letter_receivable_mail_template') + + month_map = { + 1: "Januari", 2: "Februari", 3: "Maret", 4: "April", + 5: "Mei", 6: "Juni", 7: "Juli", 8: "Agustus", + 9: "September", 10: "Oktober", 11: "November", 12: "Desember", + } + target_date = (self.send_date or fields.Datetime.now()).date() + timedelta(days=7) + self.seven_days_after_sent_date = f"{target_date.day} {month_map[target_date.month]}" + + perihal_map = { + 'penagihan': 'Surat Resmi Penagihan', + 'sp1': 'Surat Peringatan Pertama (I)', + 'sp2': 'Surat Peringatan Kedua (II)', + 'sp3': 'Surat Peringatan Ketiga (III)', + } + perihal_text = perihal_map.get(self.perihal, self.perihal or '') + + invoice_table_rows = "" + grand_total = 0 + for line in selected_lines: + grand_total += line.amount_residual + invoice_table_rows += f""" + <tr> + <td>{line.invoice_number or '-'}</td> + <td>{self.partner_id.name or '-'}</td> + <td>{fields.Date.to_string(line.invoice_date) or '-'}</td> + <td>{fields.Date.to_string(line.invoice_date_due) or '-'}</td> + <td>{line.new_invoice_day_to_due}</td> + <td>{line.ref or '-'}</td> + <td>{formatLang(self.env, line.amount_residual, currency_obj=line.currency_id)}</td> + <td>{line.payment_term_id.name or '-'}</td> </tr> - </tfoot> - """ - # inject table rows ke template - body_html = re.sub( - r"<tbody[^>]*>.*?</tbody>", - f"<tbody>{invoice_table_rows}</tbody>{invoice_table_footer}", - template.body_html, - flags=re.DOTALL - ).replace('${object.name}', self.name or '') \ - .replace('${object.partner_id.name}', self.partner_id.name or '') \ - .replace('${object.seven_days_after_sent_date}', self.seven_days_after_sent_date or '') \ - .replace('${object.perihal}', perihal_text or '') - - report = self.env.ref('indoteknik_custom.action_report_surat_piutang') + """ + + invoice_table_footer = f""" + <tfoot> + <tr style="font-weight:bold; background-color:#f9f9f9;"> + <td colspan="6" align="right">Grand Total</td> + <td>{formatLang(self.env, grand_total, currency_obj=self.currency_id, monetary=True)}</td> + <td colspan="2"></td> + </tr> + </tfoot> + """ + + body_html = re.sub( + r"<tbody[^>]*>.*?</tbody>", + f"<tbody>{invoice_table_rows}</tbody>{invoice_table_footer}", + template.body_html, + flags=re.DOTALL + ).replace('${object.name}', self.name or '') \ + .replace('${object.partner_id.name}', self.partner_id.name or '') \ + .replace('${object.seven_days_after_sent_date}', self.seven_days_after_sent_date or '') \ + .replace('${object.perihal}', perihal_text or '') + + report = self.env.ref('indoteknik_custom.action_report_surat_piutang') + subject = perihal_map.get(self.perihal, self.perihal or '') + " - " + (self.partner_id.name or '') + pdf_content, _ = report._render_qweb_pdf([self.id]) attachment_base64 = base64.b64encode(pdf_content) @@ -335,14 +359,13 @@ class SuratPiutang(models.Model): cc_list.append(sales_email) values = { - # 'subject': template.subject.replace('${object.name}', self.name or ''), - 'subject': perihal_map.get(self.perihal, self.perihal or '') + " - " + (self.partner_id.name or ''), + 'subject': subject, # Menggunakan subject yang sudah ditentukan di atas 'email_to': self.tujuan_email, 'email_from': 'finance@indoteknik.co.id', - 'email_cc': ",".join(sorted(set(cc_list))), - 'body_html': body_html, + # 'email_cc': ",".join(sorted(set(cc_list))), + 'body_html': body_html, # Menggunakan body_html yang sudah ditentukan di atas 'attachments': [(attachment.name, attachment.datas)], - 'reply_to': 'finance@indoteknik.co.id', + # 'reply_to': 'finance@indoteknik.co.id', } template.with_context(mail_post_autofollow=False).send_mail( @@ -352,7 +375,7 @@ class SuratPiutang(models.Model): ) _logger.info( - f"Surat Piutang {self.name} terkirim ke {self.tujuan_email} " + f"{self.name} terkirim ke {self.tujuan_email} " f"({self.partner_id.name}), total {len(selected_lines)} invoice." ) @@ -453,6 +476,18 @@ class SuratPiutang(models.Model): body=f"Line Invoices diperbarui. Total line saat ini: {len(rec.line_ids)}" ) + @api.onchange('perihal', 'partner_id') + def _onchange_perihal_tutup_tempo(self): + if self.perihal == 'tutup_tempo': + for line in self.line_ids: + if line.new_invoice_day_to_due < -30: + line.selected = True + else: + line.selected = False + else: + for line in self.line_ids: + line.selected = False + @api.model def create(self, vals): # Generate nomor surat otomatis @@ -462,7 +497,7 @@ class SuratPiutang(models.Model): bulan_romawi = ["I","II","III","IV","V","VI","VII","VIII","IX","X","XI","XII"][today.month-1] tahun = today.strftime("%y") vals["name"] = f"{seq}/LO/FAT/IDG/{bulan_romawi}/{tahun}" - if vals.get("perihal") == "penagihan": + if vals.get("perihal") in ("tutup_tempo", "penagihan"): vals["state"] = "waiting_approval_pimpinan" else: vals["state"] = "waiting_approval_sales" diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py index 51f4cccd..16e235da 100644 --- a/indoteknik_custom/models/stock_picking.py +++ b/indoteknik_custom/models/stock_picking.py @@ -153,6 +153,7 @@ class StockPicking(models.Model): state_reserve = fields.Selection([ ('waiting', 'Waiting For Fullfilment'), ('ready', 'Ready to Ship'), + ('partial', 'Ready to Ship Partial'), ('done', 'Done'), ('cancel', 'Cancelled'), ], string='Status Reserve', tracking=True, copy=False, help="The current state of the stock picking.") @@ -394,7 +395,7 @@ class StockPicking(models.Model): deadline = kirim_date + timedelta(days=1) deadline = deadline.replace(hour=10, minute=0, second=0) - if now > deadline: + if now > deadline and not self.so_lama: raise ValidationError( _("Anda tidak dapat mengubah Tanggal Kirim setelah jam 10:00 pada hari berikutnya!") ) diff --git a/indoteknik_custom/report/report_surat_piutang copy.xml b/indoteknik_custom/report/report_surat_piutang copy.xml deleted file mode 100644 index cb5762f3..00000000 --- a/indoteknik_custom/report/report_surat_piutang copy.xml +++ /dev/null @@ -1,149 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<odoo> - <data> - - <!-- External Layout tanpa company --> - <template id="external_layout_no_company"> - <!-- HEADER --> - <div class="header"> - <img t-att-src="'https://erp.indoteknik.com/api/image/ir.attachment/datas/2498521'" - class="img img-fluid w-100"/> - </div> - - <!-- CONTENT --> - <div class="content mt-5 mb-5 ml-3 mr-3"> - <t t-raw="0"/> - </div> - - <!-- FOOTER --> - <div class="footer"> - <img t-att-src="'https://erp.indoteknik.com/api/image/ir.attachment/datas/2498529'" - style="height:60px;"/> - </div> - </template> - - <!-- Report Action --> - <record id="action_report_surat_piutang" model="ir.actions.report"> - <field name="name">Surat Peringatan Piutang</field> - <field name="model">surat.piutang</field> - <field name="report_type">qweb-pdf</field> - <field name="report_name">indoteknik_custom.report_surat_piutang_formal_custom</field> - <field name="report_file">indoteknik_custom.report_surat_piutang_formal_custom</field> - <field name="binding_model_id" ref="model_surat_piutang"/> - <field name="binding_type">report</field> - </record> - - <!-- QWeb Template Surat --> - <template id="report_surat_piutang_formal_custom"> - <t t-call="indoteknik_custom.external_layout_no_company"> - <t t-set="doc" t-value="docs[0] if docs else None"/> - - <!-- SURAT CONTENT --> - <main class="o_report_layout_standard" style="font-size:12pt; font-family: Arial, sans-serif;"> - - <!-- Header Surat --> - <div class="row mb-3"> - <div class="col-6"> - Ref. No: <t t-esc="doc.name or '-'"/> - </div> - <div class="col-6 text-right"> - Jakarta, <t t-esc="doc.send_date and doc.send_date.strftime('%d %B %Y') or '-'"/> - </div> - </div> - - <!-- Tujuan --> - <div class="mb-3"> - <strong>Kepada Yth.</strong><br/> - <t t-esc="doc.partner_id.name if doc and doc.partner_id else '-'"/><br/> - <t t-esc="doc.partner_id.street if doc and doc.partner_id else '-'"/><br/> - <t t-esc="doc.partner_id.country_id.name if doc and doc.partner_id and doc.partner_id.country_id else '-'"/> - </div> - - <!-- UP & Perihal --> - <div class="mb-4"> - U.P. : <t t-esc="doc.tujuan_nama or '-'"/><br/> - <strong>Perihal:</strong> <t t-esc="doc.perihal or '-'"/> - </div> - - <!-- Isi Surat --> - <div class="mb-3">Dengan Hormat,</div> - <div class="mb-3">Yang bertanda tangan di bawah ini menyampaikan sebagai berikut:</div> - - <div class="mb-3 text-justify"> - Namun, bersama surat ini kami ingin mengingatkan bahwa hingga tanggal surat ini dibuat, masih terdapat tagihan yang belum diselesaikan oleh pihak - <t t-esc="doc.partner_id.name if doc and doc.partner_id else '-'"/> periode bulan <t t-esc="doc.periode_invoices_terpilih or '-'"/>, berdasarkan data korespondensi dan laporan keuangan yang kami kelola, - <t t-esc="doc.partner_id.name if doc and doc.partner_id else '-'"/> (“Saudara”) masih mempunyai tagihan yang telah jatuh tempo dan belum dibayarkan sejumlah - <t t-esc="doc.grand_total_text or '-'"/> (“Tagihan”). - </div> - - <div class="mb-3">Berikut kami lampirkan Rincian Tagihan yang telah Jatuh Tempo:</div> - - <!-- Tabel Invoice --> - <table class="table table-sm table-bordered mb-4"> - <thead class="thead-light"> - <tr> - <th>Invoice Number</th> - <th>Invoice Date</th> - <th>Due Date</th> - <th class="text-center">Day to Due</th> - <th>Reference</th> - <th class="text-right">Amount Due</th> - <th>Payment Terms</th> - </tr> - </thead> - <tbody> - <t t-foreach="doc.line_ids.filtered(lambda l: l.selected)" t-as="line"> - <tr> - <td><t t-esc="line.invoice_number or '-'"/></td> - <td><t t-esc="line.invoice_date and line.invoice_date.strftime('%d-%m-%Y') or '-'"/></td> - <td><t t-esc="line.invoice_date_due and line.invoice_date_due.strftime('%d-%m-%Y') or '-'"/></td> - <td class="text-center"><t t-esc="line.new_invoice_day_to_due or '-'"/></td> - <td><t t-esc="line.ref or '-'"/></td> - <td class="text-right"><t t-esc="line.amount_residual or '-'"/></td> - <td><t t-esc="line.payment_term_id.name or '-'"/></td> - </tr> - </t> - </tbody> - <tfoot> - <tr class="font-weight-bold"> - <td colspan="6" class="text-right"> - GRAND TOTAL INVOICE YANG BELUM DIBAYAR DAN TELAH JATUH TEMPO - </td> - <td class="text-right"> - <t t-esc="doc.grand_total or '-'"/> (<t t-esc="doc.grand_total_text or '-'"/>) - </td> - </tr> - </tfoot> - </table> - - <!-- Isi Penutup --> - <div class="mb-3"> - Kami belum menerima konfirmasi pelunasan ataupun pembayaran sebagian dari total kewajiban tersebut. Kami sangat terbuka untuk berdiskusi serta mencari solusi terbaik agar kerja sama tetap berjalan baik. - </div> - - <div class="mb-3"> - Oleh karena itu, kami mohon perhatian dan itikad baik dari pihak <t t-esc="doc.partner_id.name if doc and doc.partner_id else '-'"/> untuk segera melakukan pelunasan atau memberikan informasi terkait rencana pembayaran paling lambat dalam waktu 7 (tujuh) hari kerja sejak surat ini diterima. - </div> - - <div class="mb-3"> - Jika dalam waktu yang telah ditentukan belum ada penyelesaian atau tanggapan, kami akan mempertimbangkan untuk melanjutkan proses sesuai ketentuan yang berlaku. - </div> - - <div class="mb-4"> - Demikian kami sampaikan. Atas perhatian dan kerja samanya, kami ucapkan terima kasih. - </div> - - <div class="mb-2">Hormat kami,</div> - - <!-- TTD --> - <div class="mt-5"> - <img t-att-src="'https://erp.indoteknik.com/api/image/ir.attachment/datas/2851919'" style="width:200px; height:auto;"/><br/> - <div>Nama: Akbar Prabawa<br/>Jabatan: General Manager</div> - </div> - - </main> - </t> - </template> - - </data> -</odoo> diff --git a/indoteknik_custom/report/report_surat_piutang.xml b/indoteknik_custom/report/report_surat_piutang.xml index 62db7982..f41ae604 100644 --- a/indoteknik_custom/report/report_surat_piutang.xml +++ b/indoteknik_custom/report/report_surat_piutang.xml @@ -10,8 +10,8 @@ <field name="report_name">indoteknik_custom.report_surat_piutang</field> <field name="report_file">indoteknik_custom.report_surat_piutang</field> <field name="print_report_name">'%s - %s' % (object.perihal_label or '', object.partner_id.name or '')</field> - <field name="binding_model_id" ref="model_surat_piutang"/> - <field name="binding_type">report</field> + <!-- <field name="binding_model_id" ref="model_surat_piutang"/> + <field name="binding_type">report</field> --> </record> <template id="external_layout_surat_piutang"> @@ -216,7 +216,7 @@ <div style="height:120px; position: relative;"> <t t-if="doc.perihal != 'penagihan'"> <img src="https://erp.indoteknik.com/api/image/ir.attachment/datas/2851919" - style="width:300px; height:auto; margin-top:-40px;"/> + style="width:300px; height:auto; margin-top:-40px; margin-left:-20px;"/> </t> <t t-else=""> <div style="height:100px;"></div> diff --git a/indoteknik_custom/report/report_tutup_tempo.xml b/indoteknik_custom/report/report_tutup_tempo.xml new file mode 100644 index 00000000..1aa1367d --- /dev/null +++ b/indoteknik_custom/report/report_tutup_tempo.xml @@ -0,0 +1,158 @@ +<?xml version="1.0" encoding="utf-8"?> +<odoo> + <data> + + <record id="action_report_surat_tutup_tempo" model="ir.actions.report"> + <field name="name">Surat Penutupan Tempo</field> + <field name="model">surat.piutang</field> + <field name="report_type">qweb-pdf</field> + <field name="report_name">indoteknik_custom.report_surat_tutup_tempo</field> + <field name="report_file">indoteknik_custom.report_surat_tutup_tempo</field> + <field name="print_report_name">'%s - %s' % (object.perihal_label or '', object.partner_id.name or '')</field> + <!-- <field name="binding_model_id" ref="model_surat_piutang"/> + <field name="binding_type">report</field> --> + </record> + + <template id="external_layout_surat_tutup_tempo"> + <t t-call="web.html_container"> + <div class="header"> + <img src="https://erp.indoteknik.com/api/image/ir.attachment/datas/2498521" + style="width:100%; display: block;"/> + </div> + <div class="article" style="margin: 0 1.5cm 0 1.5cm; "> + <t t-raw="0"/> + </div> + <div class="footer"> + <img src="https://erp.indoteknik.com/api/image/ir.attachment/datas/2859765" + style="width:100%; display: block;"/> + </div> + </t> + </template> + + <template id="report_surat_tutup_tempo"> + <t t-call="web.html_container"> + <t t-foreach="docs" t-as="doc"> + <t t-call="indoteknik_custom.report_surat_tutup_tempo_document" + t-lang="doc.partner_id.lang"/> + </t> + </t> + </template> + + <template id="report_surat_tutup_tempo_document"> + <t t-call="indoteknik_custom.external_layout_surat_tutup_tempo"> + <t t-set="doc" t-value="doc.with_context(lang=doc.partner_id.lang)"/> + <div class="page"> + + <div class="row mb3"> + <div class="col-6"> + Ref. No: <t t-esc="doc.name or '-'"/> + </div> + <div class="col-6 text-right"> + Jakarta, <t t-esc="doc.send_date and doc.send_date.strftime('%d %B %Y') or '-'"/> + </div> + </div> + <br/> + <div class="mb3" style="max-width:500px; word-wrap:break-word; white-space:normal;"> + <strong>Kepada Yth.</strong><br/> + <strong><t t-esc="doc.partner_id.name or '-'"/></strong><br/> + <span style="display:inline-block; max-width:400px; word-wrap:break-word; white-space:normal;"> + <t t-esc="doc.partner_id.street or ''"/> + </span><br/> + <u>Republik Indonesia</u> + </div> + <br/> + <table style="margin-left:2cm;"> + <tr style="font-weight: bold;"> + <td style="padding-right:10px;">U.P.</td> + <td style="white-space: nowrap;">: <t t-esc="doc.tujuan_nama or '-'"/></td> + </tr> + <tr style="font-weight: bold;"> + <td style="padding-right:10px;">Perihal</td> + <td>: <u><t t-esc="doc.perihal_label or '-'"/></u></td> + </tr> + </table> + <br/> + <p><strong>Dengan Hormat,</strong></p> + <t t-set="selected_lines" t-value="doc.line_ids.filtered(lambda l: l.selected)"/> + <t t-set="line_count" t-value="len(selected_lines)"/> + <t t-if="line_count == 1"> + <t t-set="line" t-value="selected_lines[0]"/> + <p class="text-justify"> + Berdasarkan catatan kami, pembayaran atas invoice + <strong><t t-esc="line.invoice_number"/></strong> + yang jatuh tempo pada tanggal + <strong><t t-esc="line.invoice_date_due and line.invoice_date_due.strftime('%d %B %Y')"/></strong> + telah melewati batas waktu 30 (tiga puluh) hari. Sehubungan dengan hal tersebut, bersama ini kami sampaikan kebijakan perusahaan sebagai berikut: + </p> + </t> + + <t t-else=""> + <p class="text-justify"> + Berdasarkan catatan kami, pembayaran atas beberapa invoice yang telah melewati batas waktu 30 (tiga puluh) hari adalah sebagai berikut: + </p> + + <table class="table table-sm" style="font-size:13px; border:1px solid #000; margin-top:16px; margin-bottom:16px;"> + <thead style="background:#f5f5f5;"> + <tr> + <th style="border:1px solid #000; padding:4px; font-weight: bold;">Invoice</th> + <th style="border:1px solid #000; padding:4px; font-weight: bold;">Due Date</th> + <th style="border:1px solid #000; padding:4px; font-weight: bold;" class="text-center">Day to Due</th> + </tr> + </thead> + <tbody> + <tr t-foreach="selected_lines" t-as="line"> + <td style="border:1px solid #000; padding:4px;"><t t-esc="line.invoice_number"/></td> + <td style="border:1px solid #000; padding:4px;"><t t-esc="line.invoice_date_due and line.invoice_date_due.strftime('%d-%m-%Y')"/></td> + <td style="border:1px solid #000; padding:4px;" class="text-center"><t t-esc="line.new_invoice_day_to_due"/></td> + </tr> + </tbody> + </table> + + <p class="text-justify"> + Sehubungan dengan hal tersebut, bersama ini kami sampaikan kebijakan perusahaan sebagai berikut: + </p> + </t> + + <ol style="padding-left: 1.5em; margin-bottom: 1em;"> + <li class="text-justify" style="margin-bottom: 0.5em;"> + Secara sistem, akun akan otomatis terkunci (locked) apabila pembayaran telah melewati 30 (tiga puluh) hari dari tanggal jatuh tempo. + </li> + <li class="text-justify" style="margin-bottom: 0.5em;"> + Payment term yang semula Tempo akan otomatis berubah menjadi <strong>Cash Before Delivery (CBD)</strong>. + </li> + <li class="text-justify"> + Apabila Bapak/Ibu telah melakukan konfirmasi pembayaran atau memberikan informasi lanjutan terkait pelunasan, maka payment term dapat dibukakan kembali menjadi Tempo berdasarkan pengajuan dari tim Sales kami. + </li> + </ol> + + <p class="text-justify"> + Kebijakan ini kami terapkan untuk menjaga kelancaran proses transaksi serta memastikan hubungan kerja sama dapat terus berjalan dengan baik. + </p> + + <p class="text-justify"> + Atas perhatian dan kerja samanya kami ucapkan terima kasih. + </p> + <div class="mt32" style="page-break-inside: avoid;"> + <p>Hormat kami,<br/> + <strong>PT. Indoteknik Dotcom Gemilang</strong> + </p> + <div style="height:120px; position: relative;"> + <img src="https://erp.indoteknik.com/api/image/ir.attachment/datas/2869838" + style="width:300px; height:auto; margin-left:-20px;"/> + </div> + <table style="margin-top:10px;"> + <tr style="border-top:1px solid #000; font-weight: bold;"> + <td style="padding-right:50px; white-space: nowrap;">Nama</td> + <td>: Stephan Christianus</td> + </tr> + <tr style="font-weight: bold;"> + <td style="padding-right:50px; white-space: nowrap;">Jabatan</td> + <td>: FAT Manager</td> + </tr> + </table> + </div> + </div> + </t> + </template> + </data> +</odoo>
\ No newline at end of file diff --git a/indoteknik_custom/views/approval_payment_term.xml b/indoteknik_custom/views/approval_payment_term.xml index b0b99689..090c9b5c 100644 --- a/indoteknik_custom/views/approval_payment_term.xml +++ b/indoteknik_custom/views/approval_payment_term.xml @@ -32,6 +32,10 @@ <field name="arch" type="xml"> <form> <header> + <!-- <button name="button_closing_mail" + string="Send Closing by Email" + type="object" + /> --> <button name="button_approve" string="Approve" type="object" diff --git a/indoteknik_custom/views/close_tempo_mail_template.xml b/indoteknik_custom/views/close_tempo_mail_template.xml new file mode 100644 index 00000000..0f16d3ef --- /dev/null +++ b/indoteknik_custom/views/close_tempo_mail_template.xml @@ -0,0 +1,56 @@ +<?xml version="1.0" encoding="utf-8"?> +<odoo> + <data noupdate="0"> + <record id="close_tempo_mail_template" model="mail.template"> + <field name="name">Surat Penutupan Tempo</field> + <field name="model_id" ref="indoteknik_custom.model_surat_piutang"/> + <field name="subject">${object.perihal_label} - ${object.partner_id.name}</field> + <field name="email_from">finance@indoteknik.co.id</field> + <field name="email_to">${object.tujuan_email}</field> + <field name="body_html" type="html"> + <div style="font-family:Arial, sans-serif; font-size:13px; color:#333;"> + <div><b>Dengan hormat,</b></div> + <br/> + <div>Kepada Yth.</div> + <div><b>Manajemen ${object.partner_id.name}</b></div> + <br/> + <div> + Bersama email ini, kami sampaikan surat pemberitahuan resmi terkait <strong>penutupan pembayaran tempo</strong> + yang selama ini berlaku bagi ${object.partner_id.name}. + </div> + <br/> + + <div> + <b>Terhitung mulai tanggal ${object.due_date}</b>, + seluruh transaksi dengan ${object.partner_id.name} akan diberlakukan dengan sistem pembayaran + <b>Cash Before Delivery (CBD)</b>. + </div> + + <p> + Adapun surat resminya kami lampirkan, apabila diperlukan klarifikasi atau penyesuaian terkait kebijakan ini, + kami terbuka untuk mendiskusikannya lebih lanjut. + </p> + <br/> + <p> + Atas perhatian dan kerja samanya, kami ucapkan terima kasih. + </p> + + <br/><br/> + <p> + <b> + Best Regards,<br/><br/> + Widya R.<br/> + Dept. Finance<br/> + PT. INDOTEKNIK DOTCOM GEMILANG<br/> + <img src="https://erp.indoteknik.com/api/image/ir.attachment/datas/2135765" + alt="Indoteknik" style="max-width:18%; height:auto;"/><br/> + <a href="https://wa.me/6285716970374" target="_blank">+62-857-1697-0374</a> | + <a href="mailto:finance@indoteknik.co.id">finance@indoteknik.co.id</a> + </b> + </p> + </div> + </field> + <field name="auto_delete" eval="True"/> + </record> + </data> +</odoo>
\ No newline at end of file diff --git a/indoteknik_custom/views/letter_receivable.xml b/indoteknik_custom/views/letter_receivable.xml index 98ea7768..98186862 100644 --- a/indoteknik_custom/views/letter_receivable.xml +++ b/indoteknik_custom/views/letter_receivable.xml @@ -26,6 +26,7 @@ <form string="Surat Piutang"> <header> <field name="state" widget="statusbar" statusbar_visible="draft,waiting_approval_sales,waiting_approval_pimpinan,sent"/> + <button name="action_print" string="Print" type="object" /> <button name="action_approve" type="object" string="Approve" @@ -47,6 +48,12 @@ <div class="alert alert-info" role="alert" style="height: 40px; margin-bottom:0px;" + attrs="{'invisible': ['|', ('perihal', '!=', 'tutup_tempo'), ('state', '!=', 'waiting_approval_pimpinan')]}"> + <strong>Info!</strong> Surat penutupan tempo telah diajukan & surat otomatis terkirim bila telah di approve. + </div> + <div class="alert alert-info" + role="alert" + style="height: 40px; margin-bottom:0px;" attrs="{'invisible': ['|', ('perihal', '!=', 'penagihan'), ('state', '!=', 'waiting_approval_pimpinan')]}"> <strong>Info!</strong> Surat resmi penagihan telah diajukan & surat otomatis terkirim bila telah di approve. </div> @@ -60,7 +67,7 @@ <div class="alert alert-info" role="alert" style="margin-bottom:0px;" - attrs="{'invisible': ['|', ('perihal', '=', 'penagihan'), ('state', '!=', 'waiting_approval_pimpinan')]}"> + attrs="{'invisible': ['|', ('perihal', 'in', ['penagihan', 'tutup_tempo']), ('state', '!=', 'waiting_approval_pimpinan')]}"> <strong>Info!</strong> Surat peringatan piutang ini sedang menunggu persetujuan dari <b>Pimpinan</b>. Silakan hubungi Pimpinan terkait untuk melakukan approval agar surat dapat terkirim otomatis ke customer. </div> @@ -81,6 +88,7 @@ <field name="tujuan_nama" attrs="{'readonly':[('state','=','sent')]}"/> <field name="tujuan_email" attrs="{'readonly':[('state','=','sent')]}"/> <field name="perihal" attrs="{'readonly':[('state','=','sent')]}"/> + <field name="due_date" attrs="{'invisible': [('perihal', '!=', 'tutup_tempo')]}"/> <field name="partner_id" options="{'no_create': True}" attrs="{'readonly':[('state','=','sent')]}"/> </group> <group> diff --git a/indoteknik_custom/views/mail_template_closing_apt.xml b/indoteknik_custom/views/mail_template_closing_apt.xml new file mode 100644 index 00000000..5df2813b --- /dev/null +++ b/indoteknik_custom/views/mail_template_closing_apt.xml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="utf-8"?> +<odoo> + <data noupdate="0"> + <record id="mail_template_closing_apt" model="mail.template"> + <field name="name"></field> + <field name="model_id" ref="indoteknik_custom.model_approval_payment_term"/> + <field name="subject"></field> + <field name="email_from">finance@indoteknik.co.id</field> + <field name="email_to"></field> + <field name="body_html" type="html"> + <div style="font-family:Arial, sans-serif; font-size:13px; color:#333;"> + <p> + <b> + Best Regards,<br/><br/> + Widya R.<br/> + Dept. Finance<br/> + PT. INDOTEKNIK DOTCOM GEMILANG<br/> + <img src="https://erp.indoteknik.com/api/image/ir.attachment/datas/2135765" + alt="Indoteknik" style="max-width:18%; height:auto;"/><br/> + <a href="https://wa.me/6285716970374" target="_blank">+62-857-1697-0374</a> | + <a href="mailto:finance@indoteknik.co.id">finance@indoteknik.co.id</a> + </b> + </p> + <!-- <p style="font-size:11px; color:#777;"> + <i>Email ini dikirim secara otomatis. Abaikan jika pembayaran telah dilakukan.</i> + </p> --> + </div> + </field> + <field name="auto_delete" eval="True"/> + </record> + </data> +</odoo> |
