Skip to Content
Menu
This question has been flagged
2 Replies
2516 Views

In Odoo 16 and previous versions, it was very easy to use Automated Actions to create a record in a linked Model and set fields.  For example, to create an Analytic Account for a Sales Order in Odoo 15:


In Odoo 17, Automation Rules allow you to create a linked record, but do not allow you to set other fields.  So it will fail when trying to create an Analytic Account because it needs some fields to be set (including the Plan).

It is possible to write Python code for some of this, though (not being a Python programmer) I can't figure out how to create an Analytic Account and link it to the sales order.

Similar problem if you want to update multiple fields or use a Python expression rather than set a fixed value.

Also (as discussed elsewhere), only some triggers can be selected, though all of them still seem to be there!

Are these "improvements" because Automated Actions were too powerful or was it overlooked?  Or is there a solution I am missing?  

Avatar
Discard

I hope it was only be overlooked and that it will be a solution/fix soon!

Hello,

can I ask if you use a execute code , do I have to have the custome plan ? if I am using odoo standard how can I create a new recored 

Help - I've been trying to create this but even with Ray's work around we still get an error that a mandatory field isn't being set? What am I missing?

Author

Hi Tammie - it should work if you set a user-defined default for the Plan field: https://odootricks.tips/user-defined-defaults/

Best Answer

The issue here is that an Analytic Account has two required fields (Name and Plan) and the Automation Rules only allow you to specify a value for the Name.

If you have a User Defined Default setup for Plan, then the following Automation Rule works, updating through the linked field:


When using the UPDATE Action, you can switch from UPDATE to COMPUTE like this:

Avatar
Discard

In Odoo 19.0, we are bringing back "ON CREATE" and "ON CREATE AND EDIT" and removing "ON SAVE".

We are adding DUPLICATE and SEND WHATSAPP Actions.

Author

Thanks @Ray - but I think I'm missing something here. How do you create an action that is "Compute...."

@Chris, see the last part of my updated answer above.

Author

Thanks @Ray - and it's good news that some of the simplification to the UI in v17 is being reverted.

Related Posts Replies Views Activity
2
Mar 24
2039
2
Jan 25
2351
1
Mar 24
2060
1
Feb 24
2265
1
Feb 24
2189