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
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign upRelated Posts | Replies | Views | Activity | |
---|---|---|---|---|
|
1
Jun 25
|
857 | ||
|
3
May 25
|
2589 | ||
|
1
May 25
|
826 | ||
|
1
May 25
|
1007 | ||
|
4
May 25
|
2289 |