gpt4 book ai didi

java - Apache ofbiz : include existing service in own component

转载 作者:行者123 更新时间:2023-12-02 04:13:55 25 4
gpt4 key购买 nike

我想使用现有服务 (createInvoice)在新的 ofbiz 组件中。

在我的 componentScreens.xml 中我添加了:一个部分

<decorator-section name="body">
<section>
<widgets>
<screenlet title="${uiLabelMap.AccountingCreateNewSalesInvoice}">
<include-form name="NewSalesInvoice" location="component://accounting/widget/InvoiceForms.xml"/>
</screenlet>
<screenlet title="${uiLabelMap.AccountingCreateNewPurchaseInvoice}">
<include-form name="NewPurchaseInvoice" location="component://accounting/widget/InvoiceForms.xml"/>
</screenlet>
</widgets>
</section>
</decorator-section>

显示正常。但是 NewPurchaseInovice-form 调用服务 createInvoice,该服务在/accounting/servicedef/services_invoice.xml

中定义

因此,当我的表单调用服务 ofbiz 时,会出现错误:

org.ofbiz.webapp.control.RequestHandlerException: Unknown request [createInvoice]; this request does not exist or cannot be called directly.

一种解决方案可能是在我的组件中重新定义(复制)服务服务.xml:

    <service name="createInvoice" engine="simple" default-entity-name="Invoice"
location="component://accounting/script/org/ofbiz/accounting/invoice/InvoiceServices.xml" invoke="createInvoice">
<description>Create Invoice Record</description>
<permission-service service-name="acctgInvoicePermissionCheck" main-action="CREATE"/>
<auto-attributes mode="INOUT" include="pk" optional="true"/>
<auto-attributes mode="IN" include="nonpk" optional="true"/>
<override name="invoiceTypeId" mode="IN" optional="false"/>
<override name="partyIdFrom" mode = "IN" optional="false"/>
<override name="partyId" mode = "IN" optional="false"/>
<override name="description" allow-html="safe"/>
<override name="invoiceMessage" allow-html="safe"/>
</service>

但也许有一个更简单的解决方案(也许有一种方法在请求映射中指定服务的位置?)。

最佳答案

错误org.ofbiz.webapp.control.RequestHandlerException:未知请求[createInvoice];此请求不存在或无法直接调用。 表示组件找不到指定的请求,这与服务定义无关。在请求定义中,您指定必须处理哪个事件服务

您的表单调用一个请求,该请求必须在组件的controller.xml 中指定,或者表单的请求必须指向已存在的会计组件的请求。

您不必复制服务定义即可在组件中使用它,OFBiz 按名称注册所有服务定义并为所有组件处理它们。

关于java - Apache ofbiz : include existing service in own component,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33519557/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com