diff options
| author | Indoteknik . <it@fixcomart.co.id> | 2025-08-21 22:31:53 +0700 |
|---|---|---|
| committer | Indoteknik . <it@fixcomart.co.id> | 2025-08-21 22:31:53 +0700 |
| commit | 3f28815704346d81e42ea03a95f591ef1131a622 (patch) | |
| tree | becff9838f92c9ead50db31cea16eebb469ea2a7 | |
| parent | 0aa596341f2832ca17e713450f64d7f7f9b1ba4c (diff) | |
(andri) add flag dont send parent & all untuk reminder inv tempo
| -rw-r--r-- | indoteknik_custom/models/account_move.py | 17 | ||||
| -rw-r--r-- | indoteknik_custom/models/res_partner.py | 8 | ||||
| -rw-r--r-- | indoteknik_custom/views/res_partner.xml | 4 |
3 files changed, 23 insertions, 6 deletions
diff --git a/indoteknik_custom/models/account_move.py b/indoteknik_custom/models/account_move.py index e09f9c5c..a211d739 100644 --- a/indoteknik_custom/models/account_move.py +++ b/indoteknik_custom/models/account_move.py @@ -213,6 +213,15 @@ class AccountMove(models.Model): ) continue + emails = [] + # skip semua jika partner centang dont_send_reminder_inv_all + if partner.dont_send_reminder_inv_all: + _logger.info(f"Partner {partner.name} skip karena dont_send_reminder_inv_all aktif") + continue + # cek parent hanya dengan flag dont_sent_reminder_inv_parent + if not partner.dont_sent_reminder_inv_parent and partner.email: + emails.append(partner.email) + # Ambil child contact yang di-checklist reminder_invoices reminder_contacts = self.env['res.partner'].search([ ('parent_id', '=', partner.id), @@ -220,12 +229,8 @@ class AccountMove(models.Model): ('email', '!=', False), ]) _logger.info(f"Email Reminder Child {reminder_contacts}") - - # if not reminder_contacts: - # _logger.info(f"Partner {partner.name} tidak memiliki email yang sudah ceklis reminder") - # continue - - emails = list(filter(None, [partner.email])) + reminder_contacts.mapped('email') + + emails += reminder_contacts.mapped('email') if reminder_contacts: _logger.info(f"Email Reminder Child {reminder_contacts}") else: diff --git a/indoteknik_custom/models/res_partner.py b/indoteknik_custom/models/res_partner.py index e5e382a1..08b04e7d 100644 --- a/indoteknik_custom/models/res_partner.py +++ b/indoteknik_custom/models/res_partner.py @@ -31,6 +31,14 @@ class ResPartner(models.Model): string='Reminder Invoice?', help='Centang jika kontak ini harus menerima email pengingat invoice.', default=False ) + dont_send_reminder_inv_parent = fields.Boolean( + string='Dont Send Reminder Invoices Parent?', + help='Centang jika kontak utama tidak perlu menerima sent Reminder Invoices Otomatis', default=False + ) + dont_send_reminder_inv_all = fields.Boolean( + string='Dont Send Reminder Invoices to All?', + help='Centang jika semua kontak utama dan child tidak menerima sent Reminder Invoices', default=False + ) # informasi perusahaan name_tempo = fields.Many2one('res.partner', string='Nama Perusahaan',tracking=True) diff --git a/indoteknik_custom/views/res_partner.xml b/indoteknik_custom/views/res_partner.xml index c034651f..ca1a36de 100644 --- a/indoteknik_custom/views/res_partner.xml +++ b/indoteknik_custom/views/res_partner.xml @@ -216,6 +216,10 @@ <field name="dokumen_laporan_keuangan" /> <field name="dokumen_ktp_dirut" /> </group> + <group string="Reminder Invoices" attrs="{'invisible': [('parent_id', '!=', False), ('company_type', '!=', 'company')]}"> + <field name="dont_send_reminder_inv_parent"/> + <field name="dont_send_reminder_inv_all" /> + </group> </page> <page string="Aging Info"> <group string="Aging Info"> |
