Odoo Help


This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


howto set search_default in inherit search view ?

on 10/31/13, 11:22 AM 2,369 views

I have inherited an account analytic search view to insert an archive button like this

<record id="view_account_analytic_account_search" model="ir.ui.view">
    <field name="name">account.analytic.account.search.inherit</field>
    <field name="model">account.analytic.account</field>
    <field name="type">search</field>
    <field name="inherit_id" ref="account.view_account_analytic_account_search"/>
    <field name="arch" type="xml">
      <field name="name" position="before">
        <filter string="Archive" name="archivefo" icon="gtk-no" domain="[('archive','=',1)]"/>
        <filter string="Archive" name="archivef" icon="gtk-yes" domain="[('archive','=',0)]"/>
       <separator orientation="vertical"/>

and i try without succes to put search default on

<record id="action_account_analytic_account_tree" model="ir.actions.act_window">
    <field name="name">Analytic Accounts</field>
    <field name="res_model">account.analytic.account</field>
    <field name="view_type">form</field>
    <field name="view_mode">tree,graph,form</field>
    <field name="view_id" ref="account.view_account_analytic_account_tree"/> 
    <field name="context">{"search_default_archivef":1}</field>
    <field name="search_view_id" ref="view_account_analytic_account_search"/>

but it juste create another action_view and my context don't conactenate with the original view.

follow result about my sql_query on ir_act_window table

select id, name, type, view_id, view_type,context, search_view_id from ir_act_window where name = 'Analytic Accounts';

id | name | type | view_id | view_type | context | search_view_id
326 | Analytic Accounts | ir.actions.act_window | 528 | form | {} | 527
834 | Analytic Accounts | ir.actions.act_window | | form | {"search_default_archivef":1} | 527
836 | Analytic Accounts | ir.actions.act_window | 528 | form | {"search_default_archivef":1} | 1450

My action seem to be correct, method too i dont' find my error if someone could help

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)


Asked: 10/31/13, 11:22 AM
Seen: 2369 times
Last updated: 3/16/15, 8:10 AM