diff options
| author | Indoteknik . <it@fixcomart.co.id> | 2025-08-13 16:02:59 +0700 |
|---|---|---|
| committer | Indoteknik . <it@fixcomart.co.id> | 2025-08-13 16:02:59 +0700 |
| commit | 1a0f0657125831bd9dae86b12e7e2b13528b3d14 (patch) | |
| tree | 57f4ac164fcd1c57a84355a2483ea8a325821644 | |
| parent | a2d087032e5b14901f4128c81b58143bcff4286f (diff) | |
(andri) add filter date terima faktur & reminder kelipatan 7 jika sudah lewat dari H+7
| -rw-r--r-- | indoteknik_custom/models/account_move.py | 33 |
1 files changed, 5 insertions, 28 deletions
diff --git a/indoteknik_custom/models/account_move.py b/indoteknik_custom/models/account_move.py index 273bcdf9..b0ffd8b9 100644 --- a/indoteknik_custom/models/account_move.py +++ b/indoteknik_custom/models/account_move.py @@ -121,20 +121,6 @@ class AccountMove(models.Model): else: move.payment_date = False - # def name_get(self): - # result = [] - # for move in self: - # if move.move_type == 'entry': - # # Jika masih draft, tampilkan 'Draft CAB' - # if move.state == 'draft': - # label = 'Draft CAB' - # else: - # label = move.name - # result.append((move.id, label)) - # else: - # # Untuk invoice dan lainnya, pakai default - # result.append((move.id, move.display_name)) - # return result def send_due_invoice_reminder(self): today = fields.Date.today() @@ -146,31 +132,22 @@ class AccountMove(models.Model): today + timedelta(days=7), ] - # --- TESTING --- - # partner = self.env['res.partner'].search([('name', 'ilike', 'DIRGANTARA YUDHA ARTHA')], limit=1) - # if not partner: - # _logger.info("Partner tidak ditemukan.") - # return - # invoices = self.env['account.move'].search([ - # ('move_type', '=', 'out_invoice'), - # ('state', '=', 'posted'), - # ('payment_state', 'not in', ['paid', 'in_payment', 'reversed']), - # ('invoice_date_due', 'in', target_dates), - # ('partner_id', '=', partner.id), - # ]) + for days_after_due in range(14, 181, 7): + target_dates.append(today - timedelta(days=days_after_due)) invoices = self.env['account.move'].search([ ('move_type', '=', 'out_invoice'), ('state', '=', 'posted'), ('payment_state', 'not in', ['paid', 'in_payment', 'reversed']), ('invoice_date_due', 'in', target_dates), + ('date_terima_tukar_faktur', '!=', False) ]) - _logger.info(f"Invoices tahap 1: {invoices}") + _logger.info(f"Invoices: {invoices}") invoices = invoices.filtered( lambda inv: inv.invoice_payment_term_id and 'tempo' in (inv.invoice_payment_term_id.name or '').lower() ) - _logger.info(f"Invoices tahap 2: {invoices}") + # _logger.info(f"Invoices tahap 2: {invoices}") if not invoices: _logger.info("Tidak ada invoice yang due") |
