Skip to Content
Menu
This question has been flagged
1 Reply
4079 Views

I had def create(self,values) method that return similar number when a customer create new one.

@api.model

    def create(self, values):

        record=super(similar_contact,self).create(values)

           val=self.env['checked.criteria'].search([('name','=',record.name)])

            if (val != 0):

            count=0

            for x in val:

            if x:

            count=count+1

                logging.info("Data are")

                    logging.info(x.id)

 return record

logging.info(x.id) get ids of similar contacts.I want to pass these ids to tree view to show the similar lists according to these ids.I don't know how to pass it to tree view.

@api.multi

def similar_list_button_action(self):

tree_view_id = self.env.ref('similar_contact.similar_detail_tree_view').id

my_id = context["active_ids"]

logging.info(my_id)

return{

'name' : 'Similar Detail Tree View',

'type' : 'ir.actions.act_window',

'res_model' : 'similar.task',

'view_type' : 'form',

'view_mode' : 'tree',

'view_id' : [(tree_view_id,'tree')],

'res_id' : my_id,

'target' : 'new'

}


Avatar
Discard
Best Answer

Instead of using

'res_id': my_id where my_id is list of ids like [1,2,3,4]

you can use 

'domain': [('id', 'in', my_id]

It will display list view with only records that exist in my_id. Hope this will help you. 

Avatar
Discard
Related Posts Replies Views Activity
2
Jul 24
942
1
Jun 24
3564
1
Oct 23
8591
1
Oct 23
97
1
Aug 23
2192