Sales Order fields not automatically filled in


When I create a sales order in Axelor, the amout related fields (total, TVA amount…) are automatically filled in when I add a sales order line.
When I create a sales order programmatically, the automation does not work anymore. Can anyone tell me why I can’t reproduce the first behavior programmatically? Or do I have to fill in thoses fields and to the math in my code?

Thank you

If something is done by action on a view, e.g. adding a line in a list refresh a widget with a new sum value of a prop in the list, then it may be done only by xml logic in that action. Trigerred by onSelect for exemple or chained.

If this is the case, it will only happen when using that view, the logic isn’t called in a service.

That said, if you programmatically want to do something that is only implemented in XML, you could refacto both in a service that will be called by the previous action in an action method. (if you don’t want to keep up to date two differents implementation of the same logic)


Those information is computed on change of field, action is called from xml view on change of the field. To compute those values, right now it’s indirectly calling service methods only. So if you are creating the saleOrder pragmatically you need to call the methods if you want same behavior to set all those value for your saleOrder Or if you want to change some logic you can override required methods.

Thank you.