Skip to content

Commit

Permalink
Improved: Convert InvoiceServices.xml from mini-lang to Groovy (OFBIZ…
Browse files Browse the repository at this point in the history
…-13085)

Convert following services to groovy :
 * createInvoice
 * copyInvoice
 * getInvoice
 * updateInvoice
 * setInvoiceStatus
 * copyInvoiceToTemplate
 * checkInvoiceStatusInProgress
 * createInvoiceItem
 * updateInvoiceItem
 * removeInvoiceItem
 * sendInvoicePerEmail
 * autoGenerateInvoiceFromExistingInvoice
 * cancelInvoice
 * getInvoiceRunningTotal
 * addTaxOnInvoice
 * getInvoicesFilterByAssocType
 * removeInvoiceItemAssocOnCancelInvoice
 * resetOrderItemBillingAndOrderAdjustmentBillingOnCancelInvoice
 * massChangeInvoiceStatus
 * createInvoiceFromOrder
 * isInvoiceInForeignCurrency
 * removePaymentApplication (move to payment package)

These services to entity-auto :
 * createInvoiceRole
 * removeInvoiceRole
 * createInvoiceTerm
 * createInvoiceContent
 * updateInvoiceContent

Introduce new services :
 * checkInvoiceStatusInProgress
 * createInvoiceContentAndUpdateContent
 * updateInvoiceContentAndContent

checkInvoiceStatusInProgress have been added as permission service to autorize or not edit service on invoice.
createInvoiceContentAndUpdateContent and updateInvoiceContentAndContent have be added to manage both entity InvoiceContent and Content, and let createInvoiceContent and updateInvoiceContent as crud service
  • Loading branch information
nmalin committed May 7, 2024
1 parent fd97e48 commit a380a78
Show file tree
Hide file tree
Showing 9 changed files with 779 additions and 1,082 deletions.
22 changes: 11 additions & 11 deletions applications/accounting/config/AccountingUiLabels.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8500,17 +8500,17 @@
<value xml:lang="zh-TW">發票[${invoiceId}]金額合計為0....無法應用...</value>
</property>
<property key="AccountingInvoiceUpdateOnlyWithInProcessStatus">
<value xml:lang="ar">يمكن تحديث الفاتورة فقط عندما تكون الحالة قيد الإنجاز... الحالة الحالية: ${lookedUpValue.statusId}</value>
<value xml:lang="de">Kann nur Rechnungen im Status "in Bearbeitung" aktualisieren... aktueller Status: ${lookedUpValue.statusId}</value>
<value xml:lang="en">Can only update Invoice, when status is in-process...current status: ${lookedUpValue.statusId}</value>
<value xml:lang="es">Sólo puede actualizar la factura, cuando el estado está 'En Proceso'. Estado actual: ${lookedUpValue.statusId}</value>
<value xml:lang="fr">Il n'est possible de mettre à jour une facture que si son statut est "en cours", actuellement il est ${lookedUpValue.statusId}</value>
<value xml:lang="it">La fattura può essere aggiornata solo quando lo stato è in-corso...stato attuale: ${lookedUpValue.statusId}</value>
<value xml:lang="ja">処理中の請求書のみ更新可能です...現在のステータス: ${lookedUpValue.statusId}</value>
<value xml:lang="pt">Só é possível atualizar fatura quando o estado é "em processo"... estado atual: ${lookedUpValue.statusId}</value>
<value xml:lang="vi">Chỉ có thể cập nhật Hóa đơn khi trạng thái là 'Đang xử lý'... trạng thái hiện tại là: ${lookedUpValue.statusId}</value>
<value xml:lang="zh">只有在状态为处理中(in-process)时才能更新发票(Invoice),当前状态:${lookedUpValue.statusId}</value>
<value xml:lang="zh-TW">只有在狀態為處理中(in-process)時才能更新發票(Invoice),目前狀態:${lookedUpValue.statusId}</value>
<value xml:lang="ar">يمكن تحديث الفاتورة فقط عندما تكون الحالة قيد الإنجاز... الحالة الحالية: ${statusId}</value>
<value xml:lang="de">Kann nur Rechnungen im Status "in Bearbeitung" aktualisieren... aktueller Status: ${statusId}</value>
<value xml:lang="en">Can only update Invoice, when status is in-process...current status: ${statusId}</value>
<value xml:lang="es">Sólo puede actualizar la factura, cuando el estado está 'En Proceso'. Estado actual: ${statusId}</value>
<value xml:lang="fr">Il n'est possible de mettre à jour une facture que si son statut est "en cours", actuellement il est ${statusId}</value>
<value xml:lang="it">La fattura può essere aggiornata solo quando lo stato è in-corso...stato attuale: ${statusId}</value>
<value xml:lang="ja">処理中の請求書のみ更新可能です...現在のステータス: ${statusId}</value>
<value xml:lang="pt">Só é possível atualizar fatura quando o estado é "em processo"... estado atual: ${statusId}</value>
<value xml:lang="vi">Chỉ có thể cập nhật Hóa đơn khi trạng thái là 'Đang xử lý'... trạng thái hiện tại là: ${statusId}</value>
<value xml:lang="zh">只有在状态为处理中(in-process)时才能更新发票(Invoice),当前状态:${statusId}</value>
<value xml:lang="zh-TW">只有在狀態為處理中(in-process)時才能更新發票(Invoice),目前狀態:${statusId}</value>
</property>
<property key="AccountingInvoices">
<value xml:lang="ar">الفواتير</value>
Expand Down
895 changes: 0 additions & 895 deletions applications/accounting/minilang/invoice/InvoiceServices.xml

This file was deleted.

339 changes: 175 additions & 164 deletions applications/accounting/servicedef/services_invoice.xml

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions applications/accounting/servicedef/services_payment.xml
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ under the License.
<attribute name="invoiceProcessing" type="String" mode="IN" optional="true"/>
<override name="paymentId" optional="false"/>
</service>
<service name="removePaymentApplication" default-entity-name="PaymentApplication" engine="simple"
location="component://accounting/minilang/invoice/InvoiceServices.xml" invoke="removePaymentApplication">
<service name="removePaymentApplication" default-entity-name="PaymentApplication" engine="groovy"
location="component://accounting/src/main/groovy/org/apache/ofbiz/accounting/payment/PaymentServices.groovy" invoke="removePaymentApplication">
<description>Delete a paymentApplication record.</description>
<permission-service service-name="acctgInvoicePermissionCheck" main-action="UPDATE"/>
<auto-attributes mode="IN" include="pk" optional="false"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class AutoAcctgInvoiceTests extends OFBizTestCase {
fromDate: UtilDateTime.nowTimestamp(),
userLogin: userLogin
]
Map serviceResult = dispatcher.runSync('createInvoiceContent', serviceCtx)
Map serviceResult = dispatcher.runSync('createInvoiceContentAndUpdateContent', serviceCtx)
assert ServiceUtil.isSuccess(serviceResult)

GenericValue invoiceContent = from('InvoiceContent')
Expand All @@ -53,7 +53,6 @@ class AutoAcctgInvoiceTests extends OFBizTestCase {
void testCreateSimpleTextContentForInvoice() {
Map serviceCtx = [
invoiceId: '1009',
contentId: '1001',
contentTypeId: 'DOCUMENT',
invoiceContentTypeId: 'COMMENTS',
text: 'Content for invoice # 1009',
Expand All @@ -65,7 +64,6 @@ class AutoAcctgInvoiceTests extends OFBizTestCase {

GenericValue invoiceContent = from('InvoiceContent')
.where('invoiceId', '1009',
'contentId', '1001',
'invoiceContentTypeId', 'COMMENTS')
.queryFirst()

Expand Down Expand Up @@ -141,7 +139,8 @@ class AutoAcctgInvoiceTests extends OFBizTestCase {
void testCreateInvoiceItem() {
Map serviceCtx = [
invoiceId: '1003',
invoiceTypeId: 'PINV_FXASTPRD_ITEM',
invoiceItemTypeId: 'PINV_FXASTPRD_ITEM',
amount: 1,
userLogin: userLogin
]
Map serviceResult = dispatcher.runSync('createInvoiceItem', serviceCtx)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ class InvoicePerShipmentTests extends OFBizTestCase {

// Step 3
GenericValue orderHeader = from('OrderHeader').where('orderTypeId', 'SALES_ORDER').orderBy('-entryDate').queryFirst()
logInfo('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx : ' + orderHeader)
logInfo('===== >>> orderHeader : ' + orderHeader)

if (invoicePerShipment) {
// if this value is available that means we need to set this on the order
Expand Down
Loading

0 comments on commit a380a78

Please sign in to comment.