From 6f4d19cd6985790414b06678fe2147c431caed9e Mon Sep 17 00:00:00 2001 From: "Indoteknik ." Date: Sat, 12 Jul 2025 11:28:38 +0700 Subject: (andri)chatter send email reminder due invoices terkait --- indoteknik_custom/models/account_move.py | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'indoteknik_custom/models/account_move.py') 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") -- cgit v1.2.3 From 8ff2da221c3e744706a69b0f8016f65169b61aca Mon Sep 17 00:00:00 2001 From: "Indoteknik ." Date: Sat, 12 Jul 2025 14:18:20 +0700 Subject: (andri) add reply dan masuk ke chatter --- indoteknik_custom/models/account_move.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indoteknik_custom/models/account_move.py') diff --git a/indoteknik_custom/models/account_move.py b/indoteknik_custom/models/account_move.py index 42f9f43a..72ac5452 100644 --- a/indoteknik_custom/models/account_move.py +++ b/indoteknik_custom/models/account_move.py @@ -149,11 +149,12 @@ class AccountMove(models.Model): 'email_to': 'andrifebriyadiputra@gmail.com', # Ubah ke partner.email untuk produksi 'email_from': 'finance@indoteknik.co.id', 'body_html': body_html, + 'reply_to': f'invoice+account.move_{invs[0].id}@indoteknik.co.id', } _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) -- cgit v1.2.3