Hi,
Is there a way to download multiple attachments at once?
For example, downloading all supplier invoices of last month.
Note that i’m talking about the original invoice which I have attached to the record, not the “invoice” report.
Thanks.
Hi,
Is there a way to download multiple attachments at once?
For example, downloading all supplier invoices of last month.
Note that i’m talking about the original invoice which I have attached to the record, not the “invoice” report.
Thanks.
No you need to make a development.
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.
Hi,
Following what I’ve asked here: Downloading multiple attachments , has anyone had the same need? I’m struggling on managing such situation, as what I want is something like a wizard, where I can select many records and download all their attachments but each on a different file, and all compressed on a zip.
The main target model of this action are invoices but I’ve also been asked to implement this on other models, so I should make it generic, but I don’t even know if this is the proper solution, any hints?
Thanks.
In our case, we store all reports (invoices, sale/purchase order, packing list, …) in our CMS (www.alfresco.com) when printing in Tryton. And I made a tool to search in the CMS (through the api) and get multiple documents at once.
You should probably develop a wizard which is not linked to any model (so you can execute it for any model)
From there its just a mather of reading the data from the ir.attachment
model. You need to get the attachments related to your selected records. Something like:
attachments = Attachment.search([('resource', 'in', [str(r) for r in self.records])]
Once you get the attachment you just need to build the zip file using the standard zipfile method
Once you have the wizard you can link it to any record by just creating a action keyword on the wizard which is not linked to any record. This way the action will be available on all modules.
If you want to share your development with others (I personally think this is usefull), you can ask for a repository under tryton-community incubator. I will do the effort to review the code and improve it so we can promote as oficial tryton-community module.
Thank you both for your quick responses.
Yes, I already got there, but I still have the technical question on how to return the zip to the user (as it was a report).
I think the same as you, thanks for the proposal.
By the way how do I do this?
If you want to return as a report, you need to create a custom report and include in the execute method all the code needed to build the zip file and return its contents.
Its explained on the tryton community website but I will copy it here to make it easier:
If you want to bring in your project, please create an issue in tryton-community @ heptapod project with the “Hosting Request” template.