Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
4254 Tampilan

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?

Avatar
Buang
Penulis

If ever someone will have the same problem, I solved it like this:

1 - I've add a button to the tree that open the form_view of the detail :

<button string="view" name="action_view_form_modelname" type="object" alt="Dettaglio" class="btn btn-small btn-primary" />

2 - then i've add the function with an action on the model detail that call the view to open :

@api.multi

def action_view_dettaglio_utenza_ee(self):

view = self.env.ref('utility_power.view_form_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

}

You can see the full answer of my request on Stackoverflow by Anitha here :

https://stackoverflow.com/questions/57285140/odoo12-how-to-show-form-view-from-a-tree-view-without-pop-up/57285363?noredirect=1#comment101074384_57285363

3 - At this point i've half solution because on clicking on a record cell of the tree i still have the pop-up. I resolved this by adding a css class to the field :

<field name="utenzeEE_ids" context="{'default_id_immobile':active_id}" class="DisableTableRows">

After that i've add at the css style sheet the class with a change the pointer-events for the row and the button :

div.DisableTableRows { pointer-events: none;}

table.o_list_view tr.o_data_row td.o_list_button{ pointer-events: all;}

It seems to works

Post Terkait Replies Tampilan Aktivitas
1
Jul 22
2401
1
Des 20
277
1
Mar 15
4025
1
Jan 25
1454
5
Agu 24
46298