Using Studio to fix a problem

Bad news: there is a problem in Automated Actions. Good news: it’s possible to fix it using Studio. Even better news: someone who is smarter than me can probably fix it without Studio (eventually).

The bug is that the field “Link using field” has an incorrect domain (meaning that nothing can be selected). Details are here and there are several possible workarounds.

One solution is to remove the incorrect line, but (as shown below) Studio is no help because it does not support this type of domain:

So we’ll try to fix it properly – by adding a Related Field and then using that in the domain.

First add the Related Field, which is simply the technical name of the ‘target’ model.

We need to confirm that we have the right field:

Click on “Confirm”

Now some tidying-up. We will rename the field to “Model”

Odoo will change the “Technical Name”

We’ll also make it Read-Only

Now we need to manually update the XML

We will add a few lines of XML

<xpath expr="//field[@name='link_field_id']" position="attributes">
    <attribute name="domain">[('model_id', '=', model_id), ('relation', '=', x_studio_model)]</attribute>
  </xpath>

It should look like this:

Click on “Save” and we’re done.

After this fix, the field can be selected:

As you’d expect, there is one field linking Sales Order to Analytic Accounts:

It’s a many2one field on sale.order (Sales Order) and the Object Relation is account.analytic.account (Analytic Accounts).

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s