Borealis
Borealis

Reputation: 1137

Open a specific tree

How can I open a specific tree when I select a record of another tree ?

for example if I click on Sales department instead of openning its form I need to open the sales tree (just an example)

enter image description here

Upvotes: 3

Views: 40

Answers (1)

Charif DZ
Charif DZ

Reputation: 14731

You can do some thing like that by adding a button to the tree view. and when you show your data use only tree view without form to force the use to click on the button.

   <tree> 
        <field....>
        <field....>
        <field....>
        <button name="open_other_view" ....>
   </tree>

and in your model define a function to open another view :

  @api.mutli
  def open_other_view(self):
      ......
      ......
      ......
      tree_id = self.env.ref('module_name.tree_xml_id').id
      return {
         'type': 'ir.actions.act_window',
         'name': 'title',
         'views': [(tree_id, 'tree'), (False, 'form')],
         ....
         ....
         ....
      }

i think this technique is much simple.

Upvotes: 2

Related Questions