Maybe we can use the record variable to template and call it for each record on the list.
If not template is set we may keep the current behaviour (using the rec_name) of the record.
In this case I think we can follow the same patter but add the id at the end. To make it unique.
Currently the id is added at the start and we get some complaints becausae the order of the filenames is lost when using the zip folder.
Another problem with zip files is that the name can not be customized without altering the rec_name.
Thatās some feedback we received recently from a customer that wanted to get the PDF of multiple invoices in a zip file.
To be honest ā¦ I am currently contemplating if I can/should just customize rec_name in our caseā¦ it might be a feasible option for this report at least ā¦ but I am unsure where rec_name shows up / is used otherwise so I need to check
For me I care the most about the name of the invoices and sale orders, because Iām sending them via email and have now change the name manually. The rec_name is already a very good improvement so keep that.
As an extra I can imagine an extra field (ācustomize report nameā) on the report record. This field is only active when āSingleā is checked, so there is just one record on the report. The field behaves exactly the same as the āsubjectā field of the (new) email template (I love it!), so you can add for example Invoice ${record.number}. The name of the report becomes then āInvoice 202134929ā or whatever number the invoice has.
Together with the new email templates and sending email from Tryton that will be a nice addition.
I agree that rec_name is a quite good default, but ā¦ here is my biggest issue with that:
I have more than one report from the sale module ā¦ one for pre-production (internal) documentation and then I will also have another one for the actual sale later (unless I use invoice directly there ā¦)
so being able to configure that on the Report record would be definitely a great option as I might not want every report for each type to have the same name.
Though I have no idea how common it is across the user base, that there are different reports available, that should ideally have different names.
like I want my project documentation to have the name different from the actual Sale docs / invoice (i know invoice is account.invoice of course so that is seperate)
To stay with the invoice example, you can even add the state of the invoice to the report name. So you have a clear distinction.
I have also multiple reports for invoice or sale. Because when Iām sending the report by email I want to have it as PDF and with my company letterhead as background. For printing I donāt want to have a letterhead.
As I look into the patch https://codereview.tryton.org/306161002/patch/300481002/306461003 It seems to me that the report name will be still the field name from the report template but also including the rec_name from the first 5 records.
So to sum it with an example:
name field on the report template is āDefault Invoiceā rec_name of the record is āINV392890 [OR342432]ā
You report name will be Default Invoice-INV392890 [OR342432]
I think what I will do is, is implement this on my custom class and see if it works or crashes ā If it works Iāll post a link to it here for either further discussion or future reference for people with similar requirements
Our requirement was that the customer wants to include the customer name in the exported filename but did not want to customize the record_name (because he does not know how to code). Exactly the same as it was asked here
As we allow to create reports without coding, it makes sense to also set the filename without coding.
Actually I like the idea of being able to somehow (in the UI) be able to customize rec_name without additional coding. - I did not check the code now if that is already possible somewhere (in other modules) ā¦ though it would not solve my āissueā that I want different filenames for different reports on the same module / record
So you mean we should not allow to replace the {report_name} but allot to configure the other part of the name (currently the rec_name) with any attribute of the record?
If yes, that sounds like a good improvement for me.