Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
4640 Visualizzazioni

Dear guys,

I have this field on my incident.report object that will become the input place for user to upload some attachment

attachments = fields.Many2many('ir.attachment', string="Attachments"

Question is how to pass the incident id to the res_id field in ir.attachment? I need this res_id for other purposes

I tried to extend the ir.attachment object and print the vals['res_id], it returns 0 instead

class document_file(Model):_inherit = 'ir.attachment'    def create(self, cr, uid, vals, context=None):
    print 'RES ID on create: ', vals['res_id'] #should return the incident id not 0
    return super(document_file, self).create(cr, uid, vals, context) 

But everytime I use the default Attachment(s) menu from the tree view, it always pass the res_id correctly. Why this happens?

Avatar
Abbandona
Post correlati Risposte Visualizzazioni Attività
0
apr 24
1815
4
nov 23
5846
0
ott 23
1655
1
feb 23
5937
0
dic 22
2533