Search code examples
filenamesodooaeroolib

Custom naming of Aeroo report filename in Odoo


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]...


Solution

  • @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.