I want to have a custom view where I have only the states from my country. I've tried everything I found but I can't get it working.
<record model="ir.ui.view" id="res_country_state_sifranti_tree_view"> <field name="name">Šifranti občin</field> <field name="model">res.country.state</field> <field name="arch" type="xml"> <tree> <field name="code"/> <field name="name"/> <field name="country_id" domain="[('country_id','=','201')]"/> <!-- and the domain="[('id','=','201')]" --> </tree> </field> </record>
and in the action
<record model="ir.actions.act_window.view" id="res_country_state_sifranti_action_tree"> <field name="sequence" eval="1"/> <field name="view_mode">tree</field> <field name="domain">[('country_id', '=', '201')]</field> <field name="view_id" ref="res_country_state_sifranti_tree_view"/> <field name="act_window_id" ref="res_country_state_sifranti_action_window"/> </record>
Only this two options didn't cause errors. But the only thing I accomplished is that I get an empty view.
How should I show only those records that have the country_id 201?
'201' is not equal 201
Tried that one to... didn't work.
You use domain only in action.
I don't understand what you want to say. Maybe you could use more than one sentence. :)
Make sure the related field having set to store="true", if the field is persist in database then it will work fine smoothly like other fields.