diff options
| author | unknown <it@fixcomart.co.id> | 2025-09-17 11:09:35 +0700 |
|---|---|---|
| committer | unknown <it@fixcomart.co.id> | 2025-09-17 11:09:35 +0700 |
| commit | d37525b0dbdec49d2e812fc1945fb6a81a570e94 (patch) | |
| tree | 15c347131743e0f06c8c2482586af85025de7560 | |
| parent | 3f43b0bb62cc8524c05fa9ac7ee0be9408f73381 (diff) | |
(andri) add numbering + testing
| -rw-r--r-- | indoteknik_custom/models/account_move.py | 13 | ||||
| -rw-r--r-- | indoteknik_custom/views/mail_template_invoice_reminder.xml | 1 |
2 files changed, 10 insertions, 4 deletions
diff --git a/indoteknik_custom/models/account_move.py b/indoteknik_custom/models/account_move.py index b20e07c8..f10ca23f 100644 --- a/indoteknik_custom/models/account_move.py +++ b/indoteknik_custom/models/account_move.py @@ -203,6 +203,7 @@ class AccountMove(models.Model): ('invoice_date_due', 'in', target_dates), ('date_terima_tukar_faktur', '!=', False), ('invoice_payment_term_id.name', 'ilike', 'tempo')]) + _logger.info(f"Found {len(invoices)} invoices due for reminder {invoices}.") if not invoices: _logger.info("Tidak ada invoice yang due") return @@ -217,7 +218,9 @@ class AccountMove(models.Model): ('payment_state', 'not in', ['paid', 'in_payment', 'reversed']), ('invoice_date_due', '<', today), ('date_terima_tukar_faktur', '!=', False), - ('invoice_payment_term_id.name', 'ilike', 'tempo')]) + ('invoice_payment_term_id.name', 'ilike', 'tempo'), + ('partner_id', 'in', [94603])]) + _logger.info(f"Found {len(invoices)} invoices overdue for reminder {invoices}.") if not invoices: _logger.info("Tidak ada invoice yang overdue") return @@ -281,11 +284,12 @@ class AccountMove(models.Model): invoice_table_rows = "" grand_total = 0 - for inv in invs: + for idx, inv in enumerate(invs, start=1): # numbering days_to_due = (inv.invoice_date_due - today).days if inv.invoice_date_due else 0 grand_total += inv.amount_total invoice_table_rows += f""" <tr> + <td>{idx}</td> <td>{inv.partner_id.name}</td> <td>{inv.ref or '-'}</td> <td>{inv.name}</td> @@ -296,6 +300,7 @@ class AccountMove(models.Model): <td>{days_to_due}</td> </tr> """ + invoice_table_footer = f""" <tfoot> <tr style="font-weight:bold; background-color:#f9f9f9;"> @@ -428,10 +433,10 @@ class AccountMove(models.Model): } 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"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 13c02a08..3534f7f6 100644 --- a/indoteknik_custom/views/mail_template_invoice_reminder.xml +++ b/indoteknik_custom/views/mail_template_invoice_reminder.xml @@ -17,6 +17,7 @@ style="border-collapse:collapse; font-size:12px; border:1px solid #ddd;"> <thead> <tr style="background-color:#f2f2f2; text-align:left;"> + <th style="border:1px solid #ddd;">No.</th> <th style="border:1px solid #ddd;">Customer</th> <th style="border:1px solid #ddd;">No. PO</th> <th style="border:1px solid #ddd;">Invoice Number</th> |
