Skip to Content
Menu
This question has been flagged
3 Replies
6508 Views
I want to filter only company in partner_id field but new domain is not working

<record id="car_to_point_payment_custom" model="ir.ui.view">
<field name="name">account.payment.form</field>
<field name="model">account.payment</field>
<field name="inherit_id" ref="account.view_account_payment_form"/>

<xpath expr="//field[@name='partner_id']" position="replace">    
<field name="partner_id" nolabel="1"
attrs="{'required': [('payment_type', 'in', ('inbound', 'outbound'))], 'invisible': [('payment_type', 'not in', ('inbound', 'outbound'))], 'readonly': [('state', '!=', 'draft')]}"
context="{'default_is_company': True, 'default_supplier': payment_type == 'outbound', 'default_customer': payment_type == 'inbound'}"/>
<!--<attribute name ="domain">"('company_type', '=', 'company')"</attribute>--></xpath>
Avatar
Discard
Best Answer

try

<attribute name ="domain">[('company_type', '=', 'company')]</attribute>
Avatar
Discard
Author

i tried like this ...

<xpath expr="//field[@name='partner_id']" position="attributes">

<attribute name ="domain">[('company_type', '=', 'company')]</attribute>

But its not working in account.payment model

Best Answer

Try this 

[('is_company', '=', 'True')]

Avatar
Discard
Best Answer

Hello,

try 

<field name="partner_id" position="attributes">

        <attribute name ="domain">[('company_type', '=', 'company')]</attribute>

</field>

Avatar
Discard
Author

No Jagadish,Its not working i tried can u add this domain into ur locally for account.payment model

company_type type field is many2one with res.company object ? or its selection field ?

Author

Company_type is selection field in res.partner object,the default one

Author

In res.partner one filed is there company_type ,I want to add domain based on that field

Try this

<attribute name ="domain">[('partner_id.company_type', '=', 'company')]</attribute>

Author

Tried same but not working