Contributors mailing list archives

contributors@odoo-community.org

Re: Well practise on rewrite action domain

by
Willdoo IT, Richard deMeester
- 26/01/2017 23:02:20
Hi Michael,

I understand your pain on this type of thing.

A solution of sorts, particularly if module A and module B are not dependent in either direction is:

Module A:
....
<field name="domain">[
                ('state', 'not in', ('draft', 'sent', 'cancel')),
                ('x_type_contract','=','1')   
            ]

Module B:
....
<field name="domain">[
                ('state', 'not in', ('archived')),
            ]

Module C: (depends on A, B and the clever part, auto_install = True so this module is automatic when A and B are both installed)
....
<field name="domain">[
                ('state', 'not in', ('draft', 'sent', 'cancel', 'archived')),
                ('x_type_contract','=','1')   
            ]


Of course, this is not as elegant as could be, and does mean rewriting the domain in two modules if it ever needs to change, and does not extend any base domains (or domains that a third party module may have just added to the same action!)

On 13 January 2017 at 07:38, Michael Delvoye <mdelvoye@misyl-services.com> wrote:
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




--

 

 

<img border="0" width="249" height="60" src="cid:image002.png@01D1EBFD.CB6A7560" alt="Willdoo Logo Positive" style="width:2.5937in;min-height:0.625in">

Richard deMeester

Senior Programmer/Developer/Analyst

WilldooIT Pty Ltd


E: richardd@willdooit.com
P: +61 3 9682 3700 
M: +61 403 76 76 76

Level 1, 119 Ferrars Street Southbank VIC, 3006

<img border="0" width="215" height="69" src="cid:image003.jpg@01D1EBFD.CB6A7560" alt="4" style="width:2.2395in;min-height:0.7187in"><img border="0" width="111" height="69" src="cid:image004.png@01D1EBFD.CB6A7560" alt="1" style="width:1.1562in;min-height:0.7187in"><img border="0" width="94" height="69" src="cid:image005.png@01D1EBFD.CB6A7560" alt="1" style="width:0.9791in;min-height:0.7187in"><img border="0" width="99" height="69" src="cid:image006.png@01D1EBFD.CB6A7560" alt="1" style="width:1.0312in;min-height:0.7187in"><img border="0" width="95" height="69" src="cid:image007.png@01D1EBFD.CB6A7560" alt="1" style="width:0.9895in;min-height:0.7187in">

DISCLAIMER | This electronic message together with any attachments is confidential. If you are not the recipient, do not copy, disclose, or use the contents in any way. Please also advise us by e-mail that you have received this message in error and then please destroy this email and any of its attachments. WilldooIT Pty. Ltd. is not responsible for any changes made to this message and/or any attachments after sending by WilldooIT Pty. Ltd. WilldooIT Pty. Ltd. use virus scanning software but exclude all liability for virus or anything similar in this email or attachment.