add outlet code to file name
This commit is contained in:
parent
d49700e18a
commit
5b9d39060a
@ -181,9 +181,17 @@ class PosExportBcWizard(models.TransientModel):
|
|||||||
workbook.close()
|
workbook.close()
|
||||||
output.seek(0)
|
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
|
# Save as an ir.attachment and return action to download
|
||||||
attachment = self.env['ir.attachment'].create({
|
attachment = self.env['ir.attachment'].create({
|
||||||
'name': f"POS_BC_{self.start_date}_to_{self.end_date}.xlsx",
|
'name': file_name,
|
||||||
'type': 'binary',
|
'type': 'binary',
|
||||||
'datas': base64.b64encode(output.read()),
|
'datas': base64.b64encode(output.read()),
|
||||||
'mimetype': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
|
'mimetype': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user