I've this field (one2many) in a form:
<field name="utenzeEE_ids" context="{'default_id_immobile':active_id}">
<tree>
<field name="pod"/>
<field name="matricola"/>
<field name="tipo"/>
<field name="indirizzo"/>
<field name="sub"/>
<field name="dal"/>
<field name="al"/>
<field name="id_cig" widget="selection"/>
</tree>
<form>
<header></header>
<sheet>
<group>
<field name="pod"/>
<field name="matricola"/>
<field name="tipo"/>
<field name="indirizzo"/>
<field name="sub"/>
<field name="dal"/>
<field name="al"/>
<field name="id_cig" widget="many2one_list"/>
<field name="id_misuratore" widget="many2one_list"/>
<field name="id_immobile" widget="many2one_list"/>
<field name="attivitasvolte_ids" widget="one2many_list"/>
</group>
</sheet>
</form>
</field>
i've edit the tree and form view because i've to hide some field form the standard tree/form view of the module.
What i want is to open the form_view detail without pop-up in normal window.
I've read that this isn't possible, is it true?
Otherwise how can i add a button in the tree_view that call the correct form_view of the record i've clicked and how to disable the pop-up opening?
Or how would you do that?what is the right way?
EDIT 1 :
After Anitha answer i've edit immobili_view.xml (master view) like this :
<field name="utenzeEE_ids" context="{'default_id_immobile':active_id}">
<tree editable="top">
<field name="pod"/>
<field name="matricola"/>
<field name="tipo"/>
<field name="indirizzo"/>
<field name="sub"/>
<field name="dal"/>
<field name="al"/>
<field name="id_cig" widget="selection"/>
<button string="view" name="action_view_form_modelname" type="object" alt="Dettaglio" class="btn btn-small btn-primary" />
</tree>
<form>
<header></header>
<sheet>
<group>
<field name="pod"/>
<field name="matricola"/>
<field name="tipo"/>
<field name="indirizzo"/>
<field name="sub"/>
<field name="dal"/>
<field name="al"/>
<field name="id_cig" widget="many2one_list"/>
<field name="id_misuratore" widget="many2one_list"/>
<field name="id_immobile" widget="many2one_list"/>
<field name="attivitasvolte_ids" widget="one2many_list"/>
</group>
</sheet>
</form>
</field>
and in utilitypower_ee_utenze.py (details model) i've add the function:
@api.multi
def action_view_form_modelname(self):
view = self.env.ref('utilitypower.utenze_ee')
return {
'type' : 'ir.actions.act_window',
'view_type' : 'form',
'view_mode' : 'form',
'res_model' : 'utilitypower.utenze_ee',
'views': [(view.id,'form')],
'view_id': view.id,
'res_id': self.id,
'context': self.env.context
}
1 - is it correct to put the function here in the model of the one2many ("detail model")?
2 - view = self.env.ref('module.form_view_name')
i don't understand wich module i've to put here, let me explaine that i've "utilitypower.immobili" that is the module of the form_view where the tree with the button is, and "utilitypower.utenze_ee" is the module of the view of the detail..i think that is the destination module of the action,because we use it for view_id and view parameter (according https://www.odoo.com/documentation/12.0/reference/actions.html), is it correct?
3 - 'res_model': 'model for eg: hr.payslip',
here i know that i've to insert the model to present views for so in my case utilitypower.utenze_ee
If what i do is correct when i try to click on the button i've this error :
Odoo Server Error
Traceback (most recent call last):
File "/opt/odoo/odoo12/odoo/tools/cache.py", line 88, in lookup
r = d[key]
File "/opt/odoo/odoo12/odoo/tools/func.py", line 69, in wrapper
return func(self, *args, **kwargs)
File "/opt/odoo/odoo12/odoo/tools/lru.py", line 44, in __getitem__
a = self.d[obj].me
KeyError: ('ir.model.data', <function IrModelData.xmlid_lookup at 0x7fe3b62f5400>, 'utilitypower.immobili')
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/odoo/odoo12/odoo/http.py", line 654, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/opt/odoo/odoo12/odoo/http.py", line 312, in _handle_exception
raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])
File "/opt/odoo/odoo12/odoo/tools/pycompat.py", line 87, in reraise
raise value
File "/opt/odoo/odoo12/odoo/http.py", line 696, in dispatch
result = self._call_function(**self.params)
File "/opt/odoo/odoo12/odoo/http.py", line 344, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/opt/odoo/odoo12/odoo/service/model.py", line 97, in wrapper
return f(dbname, *args, **kwargs)
File "/opt/odoo/odoo12/odoo/http.py", line 337, in checked_call
result = self.endpoint(*a, **kw)
File "/opt/odoo/odoo12/odoo/http.py", line 939, in __call__
return self.method(*args, **kw)
File "/opt/odoo/odoo12/odoo/http.py", line 517, in response_wrap
response = f(*args, **kw)
File "/opt/odoo/odoo12/addons/web/controllers/main.py", line 966, in call_button
action = self._call_kw(model, method, args, {})
File "/opt/odoo/odoo12/addons/web/controllers/main.py", line 954, in _call_kw
return call_kw(request.env[model], method, args, kwargs)
File "/opt/odoo/odoo12/odoo/api.py", line 749, in call_kw
return _call_kw_multi(method, model, args, kwargs)
File "/opt/odoo/odoo12/odoo/api.py", line 736, in _call_kw_multi
result = method(recs, *args, **kwargs)
File "/opt/odoo/odoo12-custom-addons/utility_power/models/utilitypower_ee_utenze.py", line 23, in action_view_form_modelname
view = self.env.ref('utilitypower.utenze_ee')
File "/opt/odoo/odoo12/odoo/api.py", line 854, in ref
return self['ir.model.data'].xmlid_to_object(xml_id, raise_if_not_found=raise_if_not_found)
File "/opt/odoo/odoo12/odoo/addons/base/models/ir_model.py", line 1396, in xmlid_to_object
t = self.xmlid_to_res_model_res_id(xmlid, raise_if_not_found)
File "/opt/odoo/odoo12/odoo/addons/base/models/ir_model.py", line 1380, in xmlid_to_res_model_res_id
return self.xmlid_lookup(xmlid)[1:3]
File "<decorator-gen-25>", line 2, in xmlid_lookup
File "/opt/odoo/odoo12/odoo/tools/cache.py", line 93, in lookup
value = d[key] = self.method(*args, **kwargs)
File "/opt/odoo/odoo12/odoo/addons/base/models/ir_model.py", line 1369, in xmlid_lookup
raise ValueError('External ID not found in the system: %s' % xmlid)
ValueError: External ID not found in the system: utilitypower.immobili
where i'm wrong?