تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
4637 أدوات العرض

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?

الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
0
أبريل 24
1791
4
نوفمبر 23
5838
0
أكتوبر 23
1629
1
فبراير 23
5905
0
ديسمبر 22
2510