简体   繁体   English

字段的 Adempiere 列标注不适用于导入和从(来自代码)选项创建行

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

Adempiere callout for fields doesn't working on import options or create lines from option.字段的 Adempiere标注不适用于导入选项或从选项创建行 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 .将标注代码转移到 model 类 beforeSave() 或 afterSave() 但这对于所有功能来说太耗时了
Please share, if there can be any other solutions请分享,如果还有其他解决方案

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 发生了变化,但除非这本质上是通用的,否则它会使您的代码与核心项目不同,并使升级更加费力;
  • Model validators - you could register a model validator that will be called during the before save or after save of the persistence object (PO). Model 验证器 - 您可以注册一个 model 验证器,它将在持久性 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.另一方面,如果代码运行得足够快,可以让用户调用(意味着用户没有注意到明显的延迟),那么将代码添加到 model 验证器应该没问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM