i have 3 binary fields where the users upload documents, how can i do for view all documents in my smart button?
camp1= fields.Binary()
camp2= fields.Binary()
camp3= fields.Binary()
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
i have 3 binary fields where the users upload documents, how can i do for view all documents in my smart button?
camp1= fields.Binary()
camp2= fields.Binary()
camp3= fields.Binary()
Hi
You can try this code
<odoo>
<data>
<record id="button_id" model="ir.ui.view">
<field name="name">model.view.form</
<field name="arch" type="xml">
<div name="button_box" position="inside">
<button class="oe_stat_button" type="object" name="button_name"
icon="">
<field string="Attachment" name="attathment_count" widget="statinfo"/>
</button>
</div>
</field>
</record>
</data>
</odoo>
you need to add a many2one field for relates the attahcment module like
attachment_ids = fields.Many2many(
comodel_name='ir.attachment'
)
class search(models.Model):
_inherit = 'model_name'
def button_name(self):
self.ensure_one()
return {
'type': 'ir.actions.act_window',
'name': 'Attachment',
'view_mode': 'tree',
'res_model': 'ir.attachment',
'domain': [('id', 'in' http://attachment_ids.id" target="_blank">attachment_ids.id)],
'context': "{'create': False}"
}
Hope it helps
Buat akun sekarang untuk menikmati fitur eksklufi dan agar terlibat dengan komunitas kami!
Daftar| Post Terkait | Replies | Tampilan | Aktivitas | |
|---|---|---|---|---|
|
|
2
Okt 25
|
2874 | ||
|
|
1
Sep 25
|
2870 | ||
|
|
3
Jul 25
|
4208 | ||
|
|
1
Mei 25
|
2302 | ||
|
|
4
Mei 25
|
3663 |