This is an automated email from the ASF dual-hosted git repository.

nmalin pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git


The following commit(s) were added to refs/heads/trunk by this push:
     new a46dabd57a Improved: Add service 'addInvoiceNote' (OFBIZ-13326)
a46dabd57a is described below

commit a46dabd57acf0a781c25d2148b259c5db9bc70b7
Author: Nicolas Malin <[email protected]>
AuthorDate: Fri Dec 12 17:16:11 2025 +0100

    Improved: Add service 'addInvoiceNote' (OFBIZ-13326)
    
    Currently on invoice when can add a invoiceNote to link an invoice to an 
existing note.
    
    We improved that to create direct a note and link it to an invoice on one 
service.
    
    Thanks to Marie-Aline Pantais for this improvement
---
 applications/accounting/config/AccountingUiLabels.xml       |  4 ++++
 applications/accounting/servicedef/services_invoice.xml     |  9 +++++++++
 .../ofbiz/accounting/invoice/InvoiceServicesScript.groovy   | 13 +++++++++++++
 3 files changed, 26 insertions(+)

diff --git a/applications/accounting/config/AccountingUiLabels.xml 
b/applications/accounting/config/AccountingUiLabels.xml
index f4e0391f49..fb301499df 100644
--- a/applications/accounting/config/AccountingUiLabels.xml
+++ b/applications/accounting/config/AccountingUiLabels.xml
@@ -7998,6 +7998,10 @@
         <value 
xml:lang="zh">发票[${invoiceId}有${invoiceApplyAvailable?currency(${isoCode})}要应用,但是请求的是${amountApplied?currency(${isoCode})}</value>
         <value 
xml:lang="zh-TW">發票[${invoiceId}有${invoiceApplyAvailable?currency(${isoCode})}要應用,但是請求的是${amountApplied?currency(${isoCode})}</value>
     </property>
+    <property key="AccountingInvoiceNoteAdded">
+        <value xml:lang="en">Invoice note added</value>
+        <value xml:lang="fr">Note de facture ajoutée</value>
+    </property>
     <property key="AccountingInvoiceNotEnough">
         <value xml:lang="ar">المبلغ المطلوب ${tooMuch?currency(${isoCode})} هو 
كثير جدا لهذه الفاتورة [${invoiceId}]</value>
         <value xml:lang="cs">Požadovaná částka ${tooMuch?currency(${isoCode})} 
je příliš vysoká pro fakturu [${invoiceId}]</value>
diff --git a/applications/accounting/servicedef/services_invoice.xml 
b/applications/accounting/servicedef/services_invoice.xml
index 0bd0690dc4..f0b2d25eaa 100644
--- a/applications/accounting/servicedef/services_invoice.xml
+++ b/applications/accounting/servicedef/services_invoice.xml
@@ -537,6 +537,15 @@ under the License.
         <auto-attributes include="nonpk" mode="IN" optional="true"/>
         <auto-attributes include="pk" mode="INOUT"/>
     </service>
+    <service name="addInvoiceNote" engine="groovy" auth="true"
+             
location="component://accounting/src/main/groovy/org/apache/ofbiz/accounting/invoice/InvoiceServicesScript.groovy"
+             invoke="addInvoiceNote">
+        <description>add a Note and associate it to an invoice</description>
+        <attribute name="invoiceId" type="String" mode="IN"/>
+        <attribute name="noteInfo" type="String" mode="IN" allow-html="safe"/>
+        <attribute name="noteName" type="String" mode="IN" optional="true"/>
+        <attribute name="noteId" type="String" mode="OUT"/>
+    </service>
     <service name="deleteInvoiceNote" default-entity-name="InvoiceNote" 
engine="entity-auto" invoke="delete" auth="true">
         <description>Delete a InvoiceNote</description>
         <auto-attributes include="pk" mode="IN"/>
diff --git 
a/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/invoice/InvoiceServicesScript.groovy
 
b/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/invoice/InvoiceServicesScript.groovy
index 13925d6dd0..a3e2793e71 100644
--- 
a/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/invoice/InvoiceServicesScript.groovy
+++ 
b/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/invoice/InvoiceServicesScript.groovy
@@ -649,3 +649,16 @@ Map isInvoiceInForeignCurrency() {
     Map serviceResult = run service: 'getPartyAccountingPreferences', with: 
[organizationPartyId: partyId]
     return success([isForeign: invoice.currencyUomId == 
serviceResult.baseCurrencyUomId])
 }
+
+/**
+ * Create a Note and link it to an Invoice
+ * @return Success response with the noteId created
+ */
+Map addInvoiceNote() {
+    Map serviceResult = run service: 'createNote', with: [*: parameters,
+                                                          note: 
parameters.noteInfo]
+    run service: 'createInvoiceNote', with: [*: parameters,
+                                             noteId: serviceResult.noteId]
+    return success(label('AccountingUiLabels', 'AccountingInvoiceNoteAdded'),
+            [noteId: serviceResult.noteId])
+}

Reply via email to