muk-it / muk_dms

MuK Document Management System
GNU Lesser General Public License v3.0
91 stars 144 forks source link

[11.0] muk_dms deleting attachments during Document Migration #80

Closed amirpadilla closed 5 years ago

amirpadilla commented 5 years ago

Hello @Kerrim- @keshrath

I notice something during the document migration, files are deleted instead of migrating them.

Steps to reproduce:

Change Storage Location from Muk Documents to File Storage and click save 1

Go to the Attachment menu and locate one attachment, in this case we have two Deal Memos that are attachments in the hr.employee model 2 3

Start the migration of the documents 4

Once Finished the migration, attachments are lost from the MUK menu and from the original place 5 6

Even if I search the name of the document it doesn't show 7

My question is: How can I migrate the documents without losing them? I need to migrate the attachments and keep them, to be able to uninstall the module.

Related with #79 because I thinks that is what is happening, with the less files.

Regards, Amir

amirpadilla commented 5 years ago

Any update on this?

Kerrim- commented 5 years ago

Hi,

I did some testing but I still can't reproduce this error. Does this also happen to you on a new database? And if so can you also post the version numbers of your modules?

amirpadilla commented 5 years ago

Hi @Kerrim- I will try in a new database.

Modules Versions: MuK Documents - 11.0.2.1.6 MuK Documments Attachments - 11.0.2.0.3

image

amirpadilla commented 5 years ago

Hi @Kerrim-

Tried in a clean environment got the same error.

System: Odoo 11 CE

Modules Installed: Employee Directory (hr) Attachments List and Document Indexation (document) MuK Documents MuK Documents Attachment MuK Documents Attachment Automation

Steps: 1.- Configure MUK DMS

2.- Attach Files to Employee

3.- Verify Attachments in MuK image

4.- Change Settings for migration / uninstall MuK

5.- Run the migration -- From Attachments Run the Migration image

-- Attachments are missing Now in MuK image

-- Attachments are missing in Employee as well image

I Got the same result as our production system, there's nothing else installed in the system besides the modules described here.

As you might know the idea is migrate (without losing the attachments) to uninstall MuK DMS.

Please let me know if you need further information about the issue since it's reproducible.

Regards, Amir

amirpadilla commented 5 years ago

@Kerrim- @keshrath Any update on this?

keshrath commented 5 years ago

I really couldn't reproduce the error with your instructions, but my guess is that it's muk_dms_file. We rewrote this module for version 12, because there were some problems and under certain circumstances this behavior is also a result of it. Or can you reproduce the error without this module?

amirpadilla commented 5 years ago

Hi @keshrath not sure what module are you referring?

These are the modules that I have image

And

Employee Directory (hr) Attachments List and Document Indexation (document)

both from Odoo

Do you have an Odoo v11 CE machine where you can test this? Do you want me to test in Odoo v12? but that won't solve my issue in v11

Regards, Amir

keshrath commented 5 years ago

What happens if you migrate them one by one?

image

amirpadilla commented 5 years ago

@keshrath it does the same. attachment is deleted from the employee

keshrath commented 5 years ago

https://github.com/muk-it/muk_dms/blob/11.0/muk_dms_attachment/models/ir_attachment.py#L88

amirpadilla commented 5 years ago

@keshrath Not sure what should I be looking in the code, but yes even with one attachment it deletes it from muk documents and from the employee record.

amirpadilla commented 5 years ago

@Kerrim- @keshrath

Video Example

https://bpmint-my.sharepoint.com/:v:/p/apadilla/Eb1XfmWpau5JnR15WMbLP8QBmIZBnbnkGoJTUfKKPI9Mpw?e=Oy3fDZ

keshrath commented 5 years ago

This is the code executed by the action. Also in your video, but I can do the same steps and don't get the same result. The code doesn't delete the attachment either, because nowhere is unlink called. You can try to debug the Python code and see what happens when you trigger the action. Maybe you can find the place where the attachment is deleted.

keshrath commented 5 years ago

Take a look at @profile https://www.odoo.com/documentation/11.0/howtos/profilecode.html

amirpadilla commented 5 years ago

Hi @keshrath @Kerrim- any update on this besides me trying to debug the code?

amirpadilla commented 5 years ago

@Kerrim- @keshrath Can you send me the latest versions of my MUK Modules to check if something changed?

https://user-images.githubusercontent.com/42611243/57243323-da3aa500-7003-11e9-89ba-593723e151bd.png

Thanks, Amir

keshrath commented 5 years ago

Github has the newest versions.

amirpadilla commented 5 years ago

Github has the newest versions.

@keshrath Can you please add me to the repositories (privates) of the paid modules that I have, so I can update the whole suit.

Thanks, Amir

keshrath commented 5 years ago

For the paid modules you can download them again from the Odoo store. I just updated them again to make sure the are up to date.