changes
This commit is contained in:
@@ -105,9 +105,11 @@ class AccountMove(models.Model):
|
||||
try:
|
||||
report = self.env.ref('fusion_claims.action_report_mod_invoice')
|
||||
pdf_content, _ = report._render_qweb_pdf(report.id, [self.id])
|
||||
client_name = (so.partner_id.name or 'Client').replace(' ', '_').replace(',', '')
|
||||
name_parts = (so.partner_id.name or 'Client').strip().split()
|
||||
first = name_parts[0] if name_parts else 'Client'
|
||||
last = name_parts[-1] if len(name_parts) > 1 else ''
|
||||
att = Attachment.create({
|
||||
'name': f'Invoice - {client_name} - {self.name}.pdf',
|
||||
'name': f'{first}_{last}_MOD_Invoice_{self.name}.pdf',
|
||||
'type': 'binary',
|
||||
'datas': base64.b64encode(pdf_content),
|
||||
'res_model': 'account.move',
|
||||
|
||||
Reference in New Issue
Block a user