Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
1 Balas
4493 Tampilan



can anyone explain me why the attachment section is showing in chatter section. can i shift this attachment to form view ?

Thank you :)

Avatar
Buang
Jawaban Terbai

Hi,


That is the default working of odoo. When you add an attachment, it will be displayed in the chatter section, to shift it to the form view, you need to customise it by adding a field and search the attachment from ir.attachment model and show that.


You can use compute function,


attachment_ids = fields.Many2many('ir.attachment',

                                      compute='_compute_attachments')


def _compute_attachments(self):

    attachment_ids = self.env['ir.attachment'].search([

            ('res_model', '=', self._name),

            ('res_id', '=', self.id)

        ])

        self.attachment_ids = attachment_ids.ids

Now you can see all the attachments in the chatter in many2many field in form.


You can define the new field in the view


Hope it helps

Avatar
Buang
Post Terkait Replies Tampilan Aktivitas
2
Agu 24
9718
0
Des 23
1010
1
Feb 23
2240
0
Feb 23
157
1
Feb 23
3571