0

is there any way to get the report output from Aeroo named with a custom naming pattern? I.e., for the invoice: [year]_[invoice number]...

RaffaeleT
  • 255
  • 3
  • 16

1 Answers1

2

@Raffaele, I'd recommend taking a look here and to this forum post.

You'll need to use some basic python logic in the report_custom_filename module to create the file name you need according to your requirements.

Using the following example I can create output for a filename for Sales Order/Quotation:

${(object.name or '').replace('/','_')}_${object.state == 'draft' and 'draft' or '' +'.xls'}

That looks like this:

SO039_.xls

You can add another field from the document/report you're printing out by adding another section, for example:

${(object.client_order_ref or '').replace('/','_')}_

this will add the field client_order_ref in front of the document name like this:

[Here's your client order reference]_SO039.xls

Have a look at what fields are available in the model you're trying to get this information from (eg. in my case sale.order) and I think you'll find roughly what you need there.

I have still not figured out how to add a date/timestamp like you are requesting (eg. Year), however someone else may be able to offer some advice on this.

Yurets
  • 3,999
  • 17
  • 54
  • 74
  • Date/ Timestamp ${format_tz(object.write_date, tz='UTC', format='%d/%m/%Y')} Found here https://stackoverflow.com/questions/43146954/formatting-date-in-odoo-email-template by My Phillip Stack – Floggedhorse Feb 09 '19 at 14:36