Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
6 ตอบกลับ
10902 มุมมอง

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.

คำตอบที่ดีที่สุด

Example (standard base action modified, Poland filtering):

        <record id="base.action_country_state" model="ir.actions.act_window">
            <field name="name">Fed. States</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">res.country.state</field>
            <field name="view_type">form</field>
            <field name="res_model">res.country.state</field>
            <field name="view_id" ref="base.view_country_state_tree"/>
            <field name="domain">[('country_id', '=', 178)]</field>
        </record>

PS. Do you have defined any res.country.state for Slovakia?

อวตาร
ละทิ้ง
ผู้เขียน

Thanks it works... I thought I tried this... looks like I Fed something up. HAHA... Slovakia. I have filled the records with a data xml for Slovenian states.

I apologize to Slovenia :), in my database 201 = Slovakia

Related Posts ตอบกลับ มุมมอง กิจกรรม
2
เม.ย. 24
4901
1
ต.ค. 22
4185
1
เม.ย. 20
3668
3
ม.ค. 24
16671
0
พ.ย. 19
3602