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 append a domain with "|" to existing domain?

By
samba
on 7/23/14, 7:03 AM 1,344 views

This domain probelm in a function not in view.

domain_before=(('type', '=', 'purchase')) is there, i want to append one more domain domain_append_1=('type','=','general') with "|" operator using domain.append() function.

0

Ben Bernard

--Ben Bernard--
1083
| 4 3 6
Jakarta, Indonesia
--Ben Bernard--
Ben Bernard
On 7/23/14, 10:57 PM

You can override search method of your target model. Then you can save existing target domain, remove from domain list. You need to delete because string '|' need to append in the begining of domain list. Append string '|' in domain list. After this you can append your desired domain tuple and the existing one sequentially.

 

 

0

Prakash

--Prakash--
3173
| 5 4 7
Bikaner, India
--Prakash--

OpenERP Devloper at SunARC Technology

Prakash
On 7/23/14, 8:01 AM

Purchase Order xml file override and add your domain and also python init file add depends purchase module.

Example,

<record model="ir.ui.view" id="purchase_order_domin_form">
    <field name="name">purchase.order.form.domain</field>
    <field name="model">purchase.order</field>
    <field name="inherit_id" ref="purchase.purchase_order_form"/>
    <field name="arch" type="xml">
      <xpath expr="//field[@name='pricelist_id']" position="replace">
        <field domain="['|',('type','=','purchase'),('type','=','general')]" name="pricelist_id" groups="product.group_purchase_pricelist" on_change="onchange_pricelist(pricelist_id, context)"/>
      </xpath>
     </field>
</record>

 

Thank you Prakash, This domain probelm in a function not in view. domain_before=(('type', '=', 'purchase')) is there, i want to append one more domain domain_append_1=('type','=','general') with "|" operator using domain.append() function. Please tell me the way

samba
on 7/23/14, 10:07 AM

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

1 follower(s)

Stats

Asked: 7/23/14, 7:03 AM
Seen: 1344 times
Last updated: 3/16/15, 8:10 AM