summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIndoteknik . <it@fixcomart.co.id>2025-08-27 16:05:55 +0700
committerIndoteknik . <it@fixcomart.co.id>2025-08-27 16:05:55 +0700
commit9b0ce82de8518012198f526737403648f94d21c7 (patch)
tree5d46afe338a24e8625fabac59713c1f2984d9c79
parent71bda6165a9439979b862fb9f9cb31b741477a87 (diff)
(andri) test
-rw-r--r--indoteknik_custom/models/account_move.py70
-rw-r--r--indoteknik_custom/views/mail_template_invoice_reminder.xml1
2 files changed, 24 insertions, 47 deletions
diff --git a/indoteknik_custom/models/account_move.py b/indoteknik_custom/models/account_move.py
index d9d15764..b97edd0a 100644
--- a/indoteknik_custom/models/account_move.py
+++ b/indoteknik_custom/models/account_move.py
@@ -179,7 +179,8 @@ class AccountMove(models.Model):
('state', '=', 'posted'),
('payment_state', 'not in', ['paid', 'in_payment', 'reversed']),
('invoice_date_due', 'in', target_dates),
- ('date_terima_tukar_faktur', '!=', False)
+ ('date_terima_tukar_faktur', '!=', False),
+ ('partner_id', 'in' , [14709])
], limit=5)
_logger.info(f"Invoices: {invoices}")
@@ -295,48 +296,22 @@ class AccountMove(models.Model):
currency = invs[0].currency_id if invs else partner.company_id.currency_id
limit_info_html = f"""
- <table border="0" cellpadding="0" cellspacing="0" width="100%" style="max-width:600px; border:1px solid #ddd; border-radius:8px; font-family:Arial, sans-serif; margin:20px 0;">
- <tr>
- <td colspan="3" style="background-color:#f5f5f5; padding:10px; font-size:12px; font-weight:bold; text-align:center; color:#333; border-bottom:1px solid #ddd;">
- Pembayaran Tempo
- </td>
- </tr>
- <tr>
- <td colspan="3" style="padding:15px; font-size:10px; color:#333;">
- <p style="margin:4px 0;"><b>Kredit Limit Anda</b><br/>
- {formatLang(self.env, blocking_limit, currency_obj=currency)}
- </p>
- <p style="margin:4px 0;"><b>Status Detail Tempo Pembayaran Anda</b><br/>
- {partner.property_payment_term_id.name or 'Review'}
- </p>
- </td>
- </tr>
- <tr>
- <!-- Sisa Kredit Limit -->
- <td style="width:33%; border-top:1px solid #ddd; padding:12px; text-align:center; font-size:10px; color:#333;">
- <div style="font-weight:bold; color:{'red' if (blocking_limit - outstanding_amount) < 0 else 'green'};">
- {formatLang(self.env, blocking_limit - outstanding_amount, currency_obj=currency)}
- </div>
- <div style="font-size:10px; opacity:0.8;">Sisa Kredit Limit</div>
- </td>
- <!-- Kredit Limit Terpakai -->
- <td style="width:33%; border-left:1px solid #ddd; border-top:1px solid #ddd; padding:12px; text-align:center; font-size:10px; color:#333;">
- <div style="font-weight:bold; color:red;">
- {formatLang(self.env, outstanding_amount, currency_obj=currency)}
- </div>
- <div style="font-size:10px; opacity:0.8;">Kredit Limit Terpakai</div>
- <div style="font-size:9px; color:#666;">{len(outstanding_invoices)} Transaksi</div>
- </td>
- <!-- Jatuh Tempo -->
- <td style="width:33%; border-left:1px solid #ddd; border-top:1px solid #ddd; padding:12px; text-align:center; font-size:10px; color:#333;">
- <div style="font-weight:bold; color:red;">
- {formatLang(self.env, overdue_amount, currency_obj=currency)}
- </div>
- <div style="font-size:10px; opacity:0.8;">Jatuh Tempo</div>
- <div style="font-size:9px; color:#666;">{len(overdue_invoices)} Invoice</div>
- </td>
- </tr>
- </table>
+ <p><b>Informasi Tambahan:</b></p>
+ <ul style="font-size:12px; color:#333; line-height:1.4; padding-left:0; margin-left:0; list-style-position:inside;">
+ <li>Kredit Limit Anda: {formatLang(self.env, blocking_limit, currency_obj=currency)}</li>
+ <li>Status Detail Tempo: {partner.property_payment_term_id.name or 'Review'}</li>
+ <li style="color:{'red' if (blocking_limit - outstanding_amount) < 0 else 'green'};">
+ Sisa Kredit Limit: {formatLang(self.env, blocking_limit - outstanding_amount, currency_obj=currency)}
+ </li>
+ <li style="color:red;">
+ Kredit Limit Terpakai: {formatLang(self.env, outstanding_amount, currency_obj=currency)}
+ <span style="font-size:12px; color:#666;">({len(outstanding_invoices)} Transaksi)</span>
+ </li>
+ <li style="color:red;">
+ Jatuh Tempo: {formatLang(self.env, overdue_amount, currency_obj=currency)}
+ <span style="font-size:12px; color:#666;">({len(overdue_invoices)} Invoice)</span>
+ </li>
+ </ul>
"""
days_to_due_message = ""
@@ -385,7 +360,8 @@ class AccountMove(models.Model):
).replace('${object.name}', partner.name) \
.replace('${object.partner_id.name}', partner.name) \
.replace('${days_to_due_message}', days_to_due_message) \
- .replace('${closing_message}', limit_info_html + closing_message)
+ .replace('${closing_message}', closing_message) \
+ .replace('${limit_info_html}', limit_info_html)
cc_list = [
'finance@indoteknik.co.id',
@@ -408,11 +384,11 @@ class AccountMove(models.Model):
# 'reply_to': 'finance@indoteknik.co.id',
}
- # template.send_mail(invs[0].id, force_send=True, email_values=values)
- _logger.info(f"Mengirim email ke: {values['email_to']} > email CC: {values['email_cc']}")
+ template.send_mail(invs[0].id, force_send=True, email_values=values)
+ # _logger.info(f"Mengirim email ke: {values['email_to']} > email CC: {values['email_cc']}")
_logger.info(f"Reminder terkirim ke {partner.name} ({values['email_to']}) → {len(invs)} invoice (dtd = {dtd})")
# flag
- invs.write({'reminder_sent_date': today})
+ # invs.write({'reminder_sent_date': today})
# Post ke chatter
user_system = self.env['res.users'].browse(25)
system_id = user_system.partner_id.id if user_system else False
diff --git a/indoteknik_custom/views/mail_template_invoice_reminder.xml b/indoteknik_custom/views/mail_template_invoice_reminder.xml
index 3a02fa2e..13c02a08 100644
--- a/indoteknik_custom/views/mail_template_invoice_reminder.xml
+++ b/indoteknik_custom/views/mail_template_invoice_reminder.xml
@@ -33,6 +33,7 @@
</table>
<p>${closing_message}</p>
+ ${limit_info_html}
<br/>
<p>Terima Kasih.</p>
<br/><br/>