Acumatica - 在采购订单上为重量总计创建自定义用户字段

时间:2018-04-03 16:06:16

标签: customization acumatica

我正在尝试通过自定义浏览器将新字段添加到“采购订单”屏幕(PO301000)。我通过“新建字段”按钮创建了字段,并稍微编辑了数据访问,以便为字段提供默认参数。以下是数据访问中的代码:

[PXDBDecimal]
[PXDefault(TypeCode.Decimal, "0.0")]
[PXUIField(DisplayName="Weight Total")]

此字段将用于计算采购订单的总重量,我希望将其存储在数据库中。 我在发布时遇到此错误:

An error while publishing the database item POOrder
 with the message:
Nullable object must have a value.

我尝试将PXDBDecimal更改为PXDBQuantity。这必须通过自定义浏览器而不是数据库本身来完成,因为该项目将在SaaS托管站点上进行,我无法访问数据库。我还尝试仅通过DAC创建字段,并在尝试打开页面时收到此错误:

    Invalid column name 'UsrWeightTotal'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.Data.SqlClient.SqlException: Invalid column name 'UsrWeightTotal'.

1 个答案:

答案 0 :(得分:1)

在自定义中查看项目xml中的POOrder表条目时,我发现列类型的十进制需要一些额外/缺少的属性。

有一个MaxLength属性,没有DecimalLength属性。我将它与添加十进制类型的新字段进行比较,并查看项目xml以得出以下内容:

<Table TableName="POOrder"> 
<Column TableName="POOrder" ColumnName="UsrWeightTotal" ColumnType="decimal" AllowNull="True" DecimalPrecision="6" DecimalLength="19" IsNewColumn="True" IsUnicode="True" /> 
</Table>

我敢打赌错误是抱怨丢失的DecimalLength值(结果是null但是发布过程需要)。