diff options
| author | Indoteknik . <it@fixcomart.co.id> | 2025-08-20 10:10:03 +0700 |
|---|---|---|
| committer | Indoteknik . <it@fixcomart.co.id> | 2025-08-20 10:10:03 +0700 |
| commit | caaef86e4c60f026a2b2b7abcad355f2d18366c3 (patch) | |
| tree | 68a231e522771d3b53a58972a2848adcebaa84ef | |
| parent | dde108ba7e3690b0ef655fe7449814e9021bab74 (diff) | |
(andri) add flag janji bayar di send mail reminder
| -rw-r--r-- | indoteknik_custom/models/account_move.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/indoteknik_custom/models/account_move.py b/indoteknik_custom/models/account_move.py index 3a07cf87..e5e68146 100644 --- a/indoteknik_custom/models/account_move.py +++ b/indoteknik_custom/models/account_move.py @@ -214,6 +214,15 @@ class AccountMove(models.Model): _logger.info(f"Reminder untuk {partner.name} sudah terkirim hari ini, skip.") continue + promise_dates = [inv.customer_promise_date for inv in invs if inv.customer_promise_date] + if promise_dates: + earliest_promise = min(promise_dates) # ambil janji paling awal + if today <= earliest_promise: + _logger.info( + f"Skip reminder untuk {partner.name} karena ada Janji Bayar sampai {earliest_promise}" + ) + continue + # Ambil child contact yang di-checklist reminder_invoices reminder_contacts = self.env['res.partner'].search([ ('parent_id', '=', partner.id), @@ -325,7 +334,7 @@ class AccountMove(models.Model): } _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) + template.send_mail(invs[0].id, force_send=True, email_values=values) # flag invs.write({'reminder_sent_date': today}) # Post ke chatter |
