Skip to Content
Menu
This question has been flagged
5 Replies
8709 Views

Hi,

Im trying to update the domain of a field but so far not working. Already tried below two techniques but still seeing the original.


<field name="account_id" position="replace">

<field domain="[('company_id', '=', company_id), ('internal_type', 'in', ('payable','liquidity') ), ('deprecated', '=', False)]" name="account_id" groups="account.group_account_user"/>

</field>

--------------------------------------


<!--xpath expr="//field[@name='account_id']" position="attributes">

<attribute name="domain">[('company_id', '=', company_id), ('internal_type', 'in', ('payable','liquidity') ), ('deprecated', '=', False)]</attribute>

</xpath-->

Can someone let me know how can I achieve domain modification?
Avatar
Discard

Your second example looks good and should work. Are you sure the view is loaded?

you are sure that the inherent is valid, check the record id or put all your code <record> to correct correctly

Best Answer
<xpath expr="//field[@name='slip_ids']" position="attributes">
<attribute name="domain">[('usage','=','asset')]</attribute>
</xpath>
Avatar
Discard
Best Answer

Try this one 

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

    <attribute name="domain">[('company_id', '=', company_id), ('internal_type', 'in', ['payable','liquidity'] ), ('deprecated', '=', False)]</attribute>
    <attribute name="groups">account.group_account_user</attribute>

</field>

Avatar
Discard
Author Best Answer

Thanks all for the tips, unfortunately change not being loaded as expected. When I edit the form in debug mode, the inherited form is there and the changes seems present but all the time only loads the original domain.

This is what Im doing (tried several options again and same bad luck):


<record id="view_invoice_base_account_form_inherit" model="ir.ui.view">

        <field name="name">account.invoice.supplier.purchase</field>

        <field name="model">account.invoice</field>

        <field name="inherit_id" ref="account.invoice_supplier_form"/>

        <field name="groups_id" eval="[(4,ref('purchase.group_purchase_user'))]"/>

        <field name="arch" type="xml">


<!--field name="account_id" position="replace">

<field domain="[('company_id', '=', company_id), ('internal_type', 'in', ('payable','liquidity') ), ('deprecated', '=', False)]" name="account_id" groups="account.group_account_user"/>

</field-->

<!--field name="account_id" position="attributes">

<attribute name="domain">[('company_id', '=', company_id), ('internal_type', 'in', ['payable','liquidity'] ), ('deprecated', '=', False)]</attribute>

<attribute name="groups">account.group_account_user</attribute>

</field-->

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

<attribute name="domain">[('company_id', '=', company_id), ('internal_type', 'in', ('payable','liquidity') ), ('deprecated', '=', False)]</attribute>

<attribute name="groups">account.group_account_user</attribute>

<attribute name="attrs">{}</attribute>

<attribute name="context">{'company_id': company_id}</attribute>

</xpath>

<!--xpath expr="//field[@name='account_id']" position="attributes">

 <attribute name="domain">[('company_id', '=', company_id), ('internal_type', 'in', ('payable','liquidity') ), ('deprecated', '=', False)]</attribute>

</xpath-->

        </field>

    </record>


Avatar
Discard