Context: I’m in the process of migrating some Odoo sites to ERPNext and have created some in-house applications to map data structures and facilitate the transfer of data using the ERPNext Import facility. When it comes to images, it is not only data that needs to be imported by physical files need to be transferred as well. Hence a separate utility to move images for contacts, etc. The process reads images from Odoo, you select the link type customer/vendor etc and the file is copied to the appropriate ERPNext directory. An import file for the graphic is created together with a Customer/Supplier import file linking the graphic to the record previously imported into ERPNext.
The Problem:
The problem is that is a file is copied to /private/files and the associated import record is then imported, the file is renamed instead of just registering an existing file in ERPNext.
For example, 01-0142ddc716ead38a9aea64b1c6239c2fa6ad6a77.png becomes 01-0142ddc716ead38a9aea64b1c6239c2fa6ad6a77<LAST 6 Digits of CONTENT HASH>.png
as a result, my utility has now lost control of the file transfer link process.
If I skip, the “copy to ERPNext server” part of the process and simply process the images to an intermediate directory, AND then use the Add File feature in ERPNext, I can add several hundred files, all named correctly and the import to link the graphic to the contact record works like a charm. The problem with this approach is that I have to separate the private/public files where my original process handled this for me.
Here is a sample of my File Import CSV
File Name File Size File Type File URL Folder Is Attachments Folder Is Folder Is Home Folder Is Private
01-0142ddc716ead38a9aea64b1c6239c2fa6ad6a77.png 16865 PNG /private/files/01-0142ddc716ead38a9aea64b1c6239c2fa6ad6a77.png Home 0 0 0 1
Here is a sample of my Contact to Image CSV
|ID|Image|
|---|---|
|Samantha.Bazley@plasdene.com.au|/private/files/01-0142ddc716ead38a9aea64b1c6239c2fa6ad6a77.png|
It seems to me that the import process is seeing an existing file and is renaming it so there isn’t a duplicate. I can use a URL for the file and the process works perfectly, however, the files aren’t stored as a typical ERPNext attachment.
Is there some process to force the file import process to take the file as given and protect the filename in the process?
Is there ome other approach I could take?
Am I missing anything?
I’ve appreciate any feedback on this. Thanks
Eric.