summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAzka Nathan <darizkyfaz@gmail.com>2024-07-05 11:15:13 +0700
committerAzka Nathan <darizkyfaz@gmail.com>2024-07-05 11:15:13 +0700
commitf46a71310cc775be744e583ee67a2a1ced8edff1 (patch)
tree72368f2960a057c9ebc0aef5bcc379ad9a8d1195
parent6d70cf1b6cfb0754a160251946a6a3954c7df0bd (diff)
activate function send email document efaktur
-rw-r--r--indoteknik_custom/models/account_move.py14
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):