python - Selecting all records id's from Odoo Contacts listview -


i have written python code in .py file display wizard

class displaywindow(models.model): _inherit = 'res.partner' wizard_id = fields.many2one('sale.example_wizard')  def result_to_search(self, cr, uid, active_ids):     wizard = self.pool['sale.example_wizard'].create(cr, uid, vals={         'partner_ids': [(6, 0, active_ids)]     })     return {         'name': _('account search'),         'type': 'ir.actions.act_window',         'res_model': 'sale.example_wizard',         'res_id': wizard,         'view_type': 'form',         'view_mode': 'form',         'target': 'new',     } 

and here .xml file

<openerp>     <data>         <!--this xml file responsible server action of displaying wizard-->         <record model="ir.actions.server" id="action_search_for_result">             <field name="name">account search</field>             <field name="model_id" ref="sale.model_res_partner"/>             <field name="code">                 if context.get('active_model') == 'res.partner' , context.get('active_ids'):                     action = self.pool['res.partner'].result_to_search(cr, uid, context.get('active_ids'))             </field>         </record>         <record model="ir.values" id="search_result">             <field name="model_id" ref="sale.model_res_partner"/>             <field name="name">account search</field>             <field name="key2">client_action_multi</field>             <!--automatically attach action dropdown button-->             <field name="value" eval="'ir.actions.server,' +str(ref('action_search_for_result'))"/>             <field name="key">action</field>             <field name="model">res.partner</field>         </record>     </data> </openerp> 

my problem when selecting customers cutomers' listview it's selecting first page contacts , whatever code have written wizard's button it's working first page's customers.but desired result suppose work on customers have in database. doing wrong piece of code

wizard = self.pool['sale.example_wizard'].create(cr, uid, vals={             'partner_ids': [(6, 0, active_ids)]         }) 

please me. can explain more if needed. thanks

you can selected record using following code.

wizard = self.pool['sale.example_wizard'].create(cr, uid, vals={         'partner_ids': [(6, 0, self._context.get('active_ids',[]))]     }) 

thanks


Comments

Popular posts from this blog

angular - Is it possible to get native element for formControl? -

unity3d - Rotate an object to face an opposite direction -

javascript - Why jQuery Select box change event is now working? -