Odoo Help

Welcome!

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.

0

How to remove domain attribute from ir.actions.act_window ?

By
jean44
on 8/27/14, 11:44 AM 4,672 views

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>

1

Sudhir Arya (SA)

--Sudhir Arya (SA)--
10150
| 6 8 8
Ahmedabad, India
--Sudhir Arya (SA)--

Working as an OpenERP/Odoo developer and a Team Leader 

Top 5 Odoo contributor On Stackoverflow

LinkedIn

Blog

Stackoverflow

Sudhir Arya (SA)
On 7/21/15, 6:07 AM

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.


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

Solanki Shamji
on 7/21/15, 6:21 AM

This code is fully work sir !!!

Ankit H Gandhi(AHG)
on 7/21/15, 9:51 AM

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

Sudhir Arya (SA)
on 7/22/15, 3:50 AM
1

Ankit H Gandhi(AHG)

--Ankit H Gandhi(AHG)--
996
| 5 3 6
Rajkot, India
--Ankit H Gandhi(AHG)--

Learning Python..

Ankit H Gandhi(AHG)
On 7/21/15, 9:50 AM

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.

0
Lucio
On 7/20/15, 7:24 PM

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.

0
jean44
On 8/29/14, 6:47 PM

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

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

Lucio
on 7/20/15, 7:20 PM
0
Ben Olsen
On 8/27/14, 1:12 PM

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.

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

2 follower(s)

Stats

Asked: 8/27/14, 11:44 AM
Seen: 4672 times
Last updated: 7/29/15, 5:11 AM