Ir al contenido
Menú
Se marcó esta pregunta
1 Responder
4288 Vistas

Hi,

I want to integrate the Documents app in my custom module. I found the DocumentMixin Class with description 'Inherit this mixin to automatically create a `documents.document` when

an `ir.attachment` is linked to a record.
Override this mixin's methods to specify an owner, a folder or tags
for the document.'

This sounds very promising, but I have no clue how to begin with this.
Ideally, I want, when uploading a document, to specify tags, workspace etc, so that Odoo can create the Document accordingly.
Any suggestions?

Bart


Avatar
Descartar

Hello Bart.
I have the same problems, i need inherited _makefileupload function to overwrite because I want, when uploading a document, to specify some info of the context. You resolver this problems?. Sorry for my english

Hi Bart, same issue for me. I came across that Model too. How do I implement it?
Thanks
Friedrich

Mejor respuesta

Hi,
I did this in crm.lead by doing 

class CrmLead(models.Model):
_name = 'crm.lead'
_inherit = ['crm.lead', 'documents.mixin']

then just use the methods from document.mixin to create a new folder and set other parameters

def _get_document_folder(self):
return self.env['documents.folder'].create({'name': 'Crm'})

def _get_document_partner(self):
return self.partner_id
Avatar
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
0
sept 24
1327
0
sept 24
850
1
jul 23
5898
3
may 23
6466
0
ene 23
1717