Settings to define if ISR and QR should be added to email template, and also if it should only be done when invoice is not paid

->l10n_ch_report_optional
This commit is contained in:
Renzo Meister 2022-05-10 15:20:53 +02:00
parent c10ba87c3f
commit 4ee306f1b1

View File

@ -25,6 +25,8 @@ def generate_email(self, res_ids, fields):
if self.model == 'account.move': if self.model == 'account.move':
for record in self.env[self.model].browse(res_ids): for record in self.env[self.model].browse(res_ids):
if record.move_type != 'out_invoice':
continue
inv_print_name = self._render_field('report_name', record.ids, compute_lang=True)[record.id] inv_print_name = self._render_field('report_name', record.ids, compute_lang=True)[record.id]
new_attachments = [] new_attachments = []
if not self.env.company.l10n_ignore_qr_when_reconciled or record.payment_state != 'paid': if not self.env.company.l10n_ignore_qr_when_reconciled or record.payment_state != 'paid':