diff options
| author | Azka Nathan <darizkyfaz@gmail.com> | 2024-07-05 11:15:13 +0700 |
|---|---|---|
| committer | Azka Nathan <darizkyfaz@gmail.com> | 2024-07-05 11:15:13 +0700 |
| commit | f46a71310cc775be744e583ee67a2a1ced8edff1 (patch) | |
| tree | 72368f2960a057c9ebc0aef5bcc379ad9a8d1195 | |
| parent | 6d70cf1b6cfb0754a160251946a6a3954c7df0bd (diff) | |
activate function send email document efaktur
| -rw-r--r-- | indoteknik_custom/models/account_move.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/indoteknik_custom/models/account_move.py b/indoteknik_custom/models/account_move.py index fbadd2aa..a7010bbe 100644 --- a/indoteknik_custom/models/account_move.py +++ b/indoteknik_custom/models/account_move.py @@ -78,18 +78,20 @@ class AccountMove(models.Model): }) return attachment - # @api.constrains('efaktur_document') + @api.constrains('efaktur_document') def send_scheduled_email(self): # Get the records for which emails need to be sent records = self.search([('id', 'in', self.ids)]) + template = self.env.ref('indoteknik_custom.mail_template_efaktur_document') for record in records: - attachment = self.generate_attachment(record) - email_values = { - 'attachment_ids': [(4, attachment.id)] - } - template.send_mail(record.id, email_values=email_values, force_send=True) + if record.invoice_payment_term_id.id == 26: + attachment = self.generate_attachment(record) + email_values = { + 'attachment_ids': [(4, attachment.id)] + } + template.send_mail(record.id, email_values=email_values, force_send=True) @api.model def create(self, vals): |
