Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
3 Răspunsuri
12299 Vizualizări

Hi Team,

I am trying to workout how to add an attachment(s) field within the view (as opposed or in addition to the default attachments menu at the top of the screen).

I have looked at using the binary field type, but this seems to require the creation of a subform and view, etc.. Seems very complicated for something that I would have thought would be simple.  I don't want to go and over complicate things if not necessary.  


Any thoughts would be highly appreciated?

Thanks,

Damien

Imagine profil
Abandonează

Hi, define field in the form like this, attachment_ids = fields.Many2many('ir.attachment', string='Attachments')

Cel mai bun răspuns

Hi,

Try this example.

Python:

attachment_ids = fields.Many2many('ir.attachment', 'car_rent_checklist_ir_attachments_rel',
'rental_id', 'attachment_id', string="Attachments",
help="Images of the vehicle before contract/any attachments")

XML:

<field name="attachment_ids" widget="many2many_binary" class="oe_inline"/>

Thank you.

Imagine profil
Abandonează
Autor

Thankyou for this advise. I have followed this and it works well, however there is a major security issue with this method... The attachments are referred by a URL with an incremented number. This obviously means that any logged in user can go through the number range to get to all of the attachments. Is there anyway to lock down the attachments to the record for which they are attached? So only a person with the permission to that record could view those attachments?

THanks,

Damien

Cel mai bun răspuns

Hi 

Try this module

https://www.odoo.com/apps/modules/10.0/muk_dms/

Imagine profil
Abandonează