Я хотел бы использовать существующую службу (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.
Одним из решений может быть переопределение (копирование) службы в моих компонентах services.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>
Но может быть есть решение попроще (может есть способ указать местоположение сервиса в request-map?).