Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
Is it possible to set up something to have an attachment stored to the Sales Order, accesible from the attachments from the generated invoice (from this SO)?
So if I were to add a PDF with delivery dates to the sales order; I would like to automatically have this attachment linked to the invoice once the invoice is created.
Alternatively, in case this isn't feasible - is there a way to force the name a file gets when stored? For instance if I add the attachment "Receipt.pdf" to SO010, can I force it to be saved as "ReceiptSO010.pdf"?
Yes, I wrote a module for this precise concept. FOREWARNING: This was written for 6.1 and has not been tested on 7.0. It also only modifies behavior in the web client, but that's also all we use.
Essentially you are inheriting the original attachment reading function and looking for a many2one 'sale_id' field within that model. If it's set, find all of the relevant attachments from that record and display them in the list of attachments along with everything from the invoice itself. This module was configured for our heavy manufacturing use, but could easily be adapted to search from other models.
I tried to be careful in adding this new function so that the extra overhead is as minimal as possible when not needed (it gets called a lot), but I'm sure it could be written better than it is.
If you want this you can create a module that follow this steps:
- Inherit sale order confirmation function
- When the order is confermed, get the invoice id
- Search in ir.attachment (attachments class) the document with res_model = 'sale.order' and res_id = confirmed order
- Duplicate this attachment record and change res_model to 'account.invoice' and res_id to new invoice id
In this way you have the some attachment in two different classes and records.
About This Community
This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.Register
Odoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now
|Asked: 5/14/13, 2:32 PM|
|Seen: 2764 times|
|Last updated: 3/16/15, 8:10 AM|