Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
7 Trả lời
19373 Lượt xem

Hello,

I just added the domain attribute in the window action. When I tried to remove it of a ir.actions.act_window in its xml file and update the module, the domain is not removed actually. It works the other way round. How to remove it please ?

        <record id="expense_all" model="ir.actions.act_window">
            <field name="name">Expenses</field>
            <field name="res_model">hr.expense</field>
            <field name="view_type">form</field>
            <field name="search_view_id" ref="view_hr_expense_filter"/>
            <field name="view_id" ref="view_expenses_tree"/>
            <!--<field name="domain">[('user_id','=',uid)]</field>-->

</record>

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hi jean44

Better to have domain attribute as it is in xml and remove its value.

Ex:

<record id="expense_all" model="ir.actions.act_window">
<field name="name">Expenses</field>
<field name="res_model">hr.expense</field>
<field name="view_type">form</field>
<field name="search_view_id" ref="view_hr_expense_filter"/>
<field name="view_id" ref="view_expenses_tree"/>
<field name="domain">[]</field>
</record>

Now, when you will update the module, old value in domain field will be replaced with blank value.

Hope this will help you.


Ảnh đại diện
Huỷ bỏ

Hello Sudhir, can we inherit action like view? can I use xpath with attributes for change value of domain in action?

This code is fully work sir !!!

Solanki: you have to override the action using its xml ID. Ex:

Câu trả lời hay nhất

Hello Lucio,

You can remove domain from action like this

Go To 

Settings > Technical > Actions > Window Actions >

Type your action name like Expenses

Remove the Domain Value which is inside the General Settings tab.

or

You can also try to @ Sudhir Arya answer's it's also fully work.

I think this is help full for you

Regards,

Ankit H Gandhi.

Ảnh đại diện
Huỷ bỏ
Tác giả Câu trả lời hay nhất

THANK YOU FOR YOUR REPLY, I THINK IT IS SOME SORT OF  A BUG IN OpenERP, I JUST CHANGED THE ID OF THE WINDOW ACTION, IT SOLVED THE PROBLEM

Ảnh đại diện
Huỷ bỏ

This isn't right. It's not a bug. In the XML's you are always "adding" info. See my answer below

Câu trả lời hay nhất

What you're doing sounds correct. Double check that you are updating your module and restarting the openerp-server service. I notice you're trying to add uid in the domain (a very common request that still isn't supported, sadly). That will cause an error in your interface, so if you're trying to reload your module with the "upgrade" button in the interface, that may not work. A better way to reload a module is to do it when running the openerp-server command on the command line:

./openerp-server -c /some/path/openerp-server.conf -u my_custom_module

The paths will be different on your machine, but the "-u module_name" is the key. That will restart the service and cause the module to completely be reloaded.

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hi,

when doing changes in an XML, you cannot "remove" info this way. You are always adding or changing the information that is already there.

In  your case, you can just leave the domain tag, but changing the value to be empty or something that always evaluates to "True" (e.g. [('1','=','1')] )

<record id="expense_all" model="ir.actions.act_window">
<field name="name">Expenses</field>
<field name="res_model">hr.expense</field>
<field name="view_type">form</field>
<field name="search_view_id" ref="view_hr_expense_filter"/>
<field name="view_id" ref="view_expenses_tree"/>
<field name="domain">[('1','=','1')]</field>
</record>

Hope this helps someone.

Ảnh đại diện
Huỷ bỏ