summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIndoteknik . <it@fixcomart.co.id>2025-07-12 11:28:38 +0700
committerIndoteknik . <it@fixcomart.co.id>2025-07-12 11:28:38 +0700
commit6f4d19cd6985790414b06678fe2147c431caed9e (patch)
tree5d5b0a429b125b8a98e5727816c0b28d1947510e
parent575a7a506382487a625914a7bde9a18b20173cc6 (diff)
(andri)chatter send email reminder due invoices terkait
-rw-r--r--indoteknik_custom/models/account_move.py19
-rw-r--r--indoteknik_custom/views/mail_template_invoice_reminder.xml8
2 files changed, 22 insertions, 5 deletions
diff --git a/indoteknik_custom/models/account_move.py b/indoteknik_custom/models/account_move.py
index 5ac1c6e5..42f9f43a 100644
--- a/indoteknik_custom/models/account_move.py
+++ b/indoteknik_custom/models/account_move.py
@@ -85,7 +85,7 @@ class AccountMove(models.Model):
today + timedelta(days=7),
]
- partner = self.env['res.partner'].search([('name', 'ilike', 'FLYNINDO MEGA PERSADA')], limit=1)
+ partner = self.env['res.partner'].search([('name', 'ilike', 'BANGUNAN TEKNIK GRUP')], limit=1)
if not partner:
_logger.info("Partner tidak ditemukan.")
return
@@ -153,7 +153,22 @@ class AccountMove(models.Model):
_logger.info(f"VALUES: {values}")
- template.send_mail(invs[0].id, force_send=True, email_values=values)
+ # template.send_mail(invs[0].id, force_send=True, email_values=values)
+
+ # Default System User
+ user_system = self.env['res.users'].browse(25)
+ system_id = user_system.partner_id.id if user_system else False
+ _logger.info(f"System User: {user_system.name} ({user_system.id})")
+ _logger.info(f"System User ID: {system_id}")
+
+ for inv in invs:
+ inv.message_post(
+ subject=subject,
+ body=body_html,
+ subtype_id=self.env.ref('mail.mt_note').id,
+ author_id=system_id,
+ )
+
_logger.info(f"Reminder terkirim ke {partner.name} ({values['email_to']}) → {len(invs)} invoice")
diff --git a/indoteknik_custom/views/mail_template_invoice_reminder.xml b/indoteknik_custom/views/mail_template_invoice_reminder.xml
index 8b3b9880..21055eb0 100644
--- a/indoteknik_custom/views/mail_template_invoice_reminder.xml
+++ b/indoteknik_custom/views/mail_template_invoice_reminder.xml
@@ -13,7 +13,7 @@
<p>Berikut adalah daftar invoice Anda yang mendekati atau telah jatuh tempo:</p>
- <table border="1" cellpadding="6" cellspacing="0" style="border-collapse: collapse; width: 100%;">
+ <table border="1" cellpadding="4" cellspacing="0" style="border-collapse: collapse; width: 100%; font-size: 12px">
<thead>
<tr style="background-color: #f2f2f2;" align="left">
<th>Invoice Number</th>
@@ -37,9 +37,11 @@
<br/>
Widya R.<br/>
Dept. Finance<br/>
- PT. INDOTEKNIK DOTCOM GEMILANG</b><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;"></img><br/>
- +62-857-1697-0374 | finance@indoteknik.co.id</p>
+ <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>