How to add a default filter in odoo12 Community Version
How to add the default filter with branch as CS selected defaultly in the filter...
My model for branch is:-
class StudentBranch(models.Model):
_name = 'student.branch'
_rec_name = 'branchname'
branchname = fields.Char(string = 'BranchName')
branchcode = fields.Integer(string = 'Branch Code')
subname = fields.One2many('student.subject', 'branch_id',
string = 'Subject Name',store=True)
And View of branch is:-
<!-- Tree View of branch -->
<record id="view_tree_studentbranch" model="ir.ui.view">
<field name="name">Branch.tree</field>
<field name="model">student.branch</field>
<field name="arch" type="xml">
<tree string="Branch Tree">
<field name="branchname"/>
<field name="branchcode"/>
<field name="subname"/>
</tree>
</field>
</record><!-- Kanban View of Branch -->
<record id="studentbranch_kanban_view" model="ir.ui.view">
<field name="name">StudentBranch Kanban</field>
<field name="model">student.branch</field>
<field name="arch" type="xml">
<kanban>
<templates>
<t t-name="kanban-box">
<div class="oe_kanban_global_click">
<div class="oe_kanban_details">
<ul>
<li><field name="branchname"/></li>
<li><field name="branchcode"/></li>
</ul>
</div>
</div>
</t>
</templates>
</kanban>
</field>
</record>
<!--Branch Generic View -->
<record id="studentbranch_menu_action" model="ir.actions.act_window">
<field name="name">Branch</field>
<field name="res_model">student.branch</field>
<field name="view_type">form</field>
<field name="view_mode">kanban,tree,form</field>
<field name="domain">[]</field>
<field name="help" type="html">
<p class="oe_view_nocontent_create">Create The First Branch
</p>
</field>
</record>
Please Help
Thanks in Advance..
Please try to search the existing questions before asking: https://www.odoo.com/forum/help-1/question/set-default-filter-value-in-search-view-5856
+1 to the reply from Cyrosys, this is a Google search away. Besides of this your questions are usually rather vague, please try to explain them more. Do you want to apply a default filter on a new search view? Do you want to filter on a field? Do you want to filter on a field with a specific value in the field?
I want to filter on a field with a specific value in the field
selected defaultly in the filter
My question is very clear I have mentioned it above as
'How to add the default filter with branch as CS selected defaultly in the filter...'