From 5b9d39060a25e51677c50db9862567f947c2b2bd Mon Sep 17 00:00:00 2001 From: Abdul Aziz Amrullah Date: Tue, 9 Jun 2026 09:30:39 +0700 Subject: [PATCH] add outlet code to file name --- wizard/pos_export_bc_wizard.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/wizard/pos_export_bc_wizard.py b/wizard/pos_export_bc_wizard.py index 83f2c45..dee6c5f 100644 --- a/wizard/pos_export_bc_wizard.py +++ b/wizard/pos_export_bc_wizard.py @@ -181,9 +181,17 @@ class PosExportBcWizard(models.TransientModel): workbook.close() output.seek(0) + company = self.env.company + company_ident = (company.company_registry or company.name or '').upper().replace(' ', '') + company_ident = company_ident[:14] # Limit to ensure total name is <= 40 characters + + start_str = self.start_date.strftime('%y%m%d') + end_str = self.end_date.strftime('%y%m%d') + file_name = f"POS_{company_ident}_{start_str}_to_{end_str}.xlsx" + # Save as an ir.attachment and return action to download attachment = self.env['ir.attachment'].create({ - 'name': f"POS_BC_{self.start_date}_to_{self.end_date}.xlsx", + 'name': file_name, 'type': 'binary', 'datas': base64.b64encode(output.read()), 'mimetype': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'