How can I show form view in new tab when click on tree view. that means I want to show a form view in new tab by clicking on tree view item. Please help.
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Boekhouding
- Voorraad
- PoS
- Project
- MRP
Deze vraag is gerapporteerd
With the "ir.actions.act_url" you can open the view in a new tab by forming a URL of the view.
url = self.env['ir.config_parameter'].sudo().get_param('web.base.url')
url += '/web#id=%s&&model=sale.order&view_type=form' % self.id
return {
'type': 'ir.actions.act_url',
'target': 'new',
'url': url,
}
where I put this code? I create a new function called open_new_window and put this code in here. but its not working. here the code:
from odoo import models, fields, api, _
class Admission(models.Model):
_inherit = 'op.admission'
def open_new_window(self):
url = self.env['ir.config_parameter'].sudo().get_param('web.base.url')
url += '/web#id=%s&&model=op.admission&view_type=form' % self.id
return {
'type': 'ir.actions.act_url',
'target': 'new',
'url': url,
}
Not working means nothing happens when you click on a button or you are getting an error.
I want to show form view from dashboard. the dashboard showing list view. If i click any list item the form view needs to show in another tab. cause when the form view showing the group by expand option are closed in dashboard. thats why I want to show the form view in new tab
The simplest way i can think of is to add a button in list view.
when you click on this button you render a form view ( or a popup ) displaying all data you need.
your button's action must return smth like this:
return {
"name": _("your text"),
"type": 'ir.actions.act_window',
'view_mode': 'form' "res_model": 'your model',
'view_id': ref to your form view id,
"views": [[False, "form"]],
"target": 'new',
"context": {
context if necessary
},
}
Geniet je van het gesprek? Blijf niet alleen lezen, doe ook mee!
Maak vandaag nog een account aan om te profiteren van exclusieve functies en deel uit te maken van onze geweldige community!
Aanmelden