Adempiere column callout for fields not working on import and create lines from (from code) options

164 Views Asked by At

Adempiere callout for fields doesn't working on import options or create lines from option. It ignores field callout if i do things through code rather then manual selection. I thought for one solution which is,
Shifting callout code to model classes beforeSave() or afterSave() but that is too time consuming for all functionalities.
Please share, if there can be any other solutions

1

There are 1 best solutions below

0
On

You are correct that the callouts are only used during user input of a form or table. If you have rules that need to be applied to data changes programmatically, there are several options to consider:

  • Model changes, as you mentioned, but unless this is universal in nature, it makes your code different from the core project and makes upgrades more effort intensive;
  • Model validators - you could register a model validator that will be called during the before save or after save of the persistence object (PO).
  • In the table definition, you can define table validation rules.

To avoid time intensive operations on many records, you could also add the code to the import validators and "create from" process if those are the areas where you see the problem.

Lastly, you could create a separate process to validate the data and run it in the background if you need to.

On the other hand, if the code runs fast enough for a user callout (meaning the user doesn't notice an appreciable delay), then adding the code to a model validator should be fine.