Contributors mailing list archives

contributors@odoo-community.org

Browse archives

Avatar

Re: Well practise on rewrite action domain

by
MISYL SERVICES., Michael Delvoye
- 18/01/2017 21:30:13
Hi Miku.
Thanks for your answer and your advice. I think it's the solution of my problem


2017-01-15 21:23 GMT+01:00 Miku Laitinen <miku@avoin.systems>:
We're using something we call configuration modules. They don't necessarily do anything else than depend on other modules (combined with git = basic configuration management). They are always specific to a single client. I'm assuming this is also your case.

Most often we place this kind of modifications in the configuration module to "have the final word". If a module is the last one to be updated in the module graph, it gets to overwrite the other definitions.

So, if your modules A and B modify the same action definition (and you want to keep them generic), create module C that depends on A and B, and overwrite the action's domain there in XML. Yes, you will be breaking the DRY principle but as there's no way of "cumulating" the domain, you don't have much of a choice. 

How would Odoo even know how to deal with combining the domain? We'd probably have conflicts in the domains if Odoo would automatically combine them.

- Miku

On Sun, Jan 15, 2017 at 4:38 PM Houssine BAKKALI <houssine.bakkali@gmail.com> wrote:
 if one module depends on the other it's OK otherwise it could be a bit tricky. 



Le 15 janv. 2017 11:38, "Michael Delvoye" <mdelvoye@misyl-services.com> a écrit :
Hello Houssine
Yes I do that
But my question is if I have 2 modules where I need to overwrite the action 

This 2 modules can be installed alone or on the same database
How can I do to make them complementary

For example
The first modify the domain to exclude records Parma A

The second also do that but another field Param B

I want to have an addition of these 2 rules 
Filter A and B


Michael Delvoye 

Le 15 janv. 2017 à 10:38, Houssine BAKKALI <houssine.bakkali@gmail.com> a écrit :

You just need to redefine the XML record using the same record Id (but prefixed with the name of the module where it's defined originally). 

Doing this your XML record will override the existing one
Le 12 janv. 2017 21:38, "Michael Delvoye" <mdelvoye@misyl-services.com> a écrit :
Hi every body
i need to rewrite action sale order like this in one module : 

<record id="sale.action_orders" model="ir.actions.act_window">
<field name="view_id" ref="sale.view_order_tree"/>
<field name="domain">[
('state', 'not in', ('draft', 'sent', 'cancel')),
('x_type_contract','=','1')
]
</field>
</record>

Bu in an other module i need to exclude 'state' '='  'archived')
I don't know the best practise to do that.

Can you orient me. Of course I . can centralize it in one module but i would prefer to keep each module and to "cumulate" the domain.

Thanks for help


--
Michael Delvoye
Directeur Technique
MISYL SERVICES

_______________________________________________
Mailing-List: http://odoo-community.org/groups/contributors-15
Post to: mailto:contributors@odoo-community.org
Unsubscribe: http://odoo-community.org/groups?unsubscribe

_______________________________________________
Mailing-List: http://odoo-community.org/groups/contributors-15
Post to: mailto:contributors@odoo-community.org
Unsubscribe: http://odoo-community.org/groups?unsubscribe

_______________________________________________
Mailing-List: http://odoo-community.org/groups/contributors-15
Post to: mailto:contributors@odoo-community.org
Unsubscribe: http://odoo-community.org/groups?unsubscribe

--
Miku Laitinen
AVOIN.SYSTEMS

_______________________________________________
Mailing-List: http://odoo-community.org/groups/contributors-15
Post to: mailto:contributors@odoo-community.org
Unsubscribe: http://odoo-community.org/groups?unsubscribe




--
Michael Delvoye
Directeur Technique
MISYL SERVICES

Reference