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 28c89678be Fixed: Purchase Order approval fails when payment auto 
create config is disabled (OFBiz-13335)
28c89678be is described below

commit 28c89678beac97b37933ea0684287e5d6650c2bb
Author: Nicolas Malin <[email protected]>
AuthorDate: Thu Jan 8 14:34:08 2026 +0100

    Fixed: Purchase Order approval fails when payment auto create config is 
disabled (OFBiz-13335)
    
    When purchase order should be approved with no payment records generated, 
the payment service failed with an error that rollback the process instead 
finish as success.
    
    Thanks to Nameet Jain for fixed this issue
---
 .../apache/ofbiz/accounting/payment/PaymentServices.groovy | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git 
a/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/payment/PaymentServices.groovy
 
b/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/payment/PaymentServices.groovy
index 8e536328b7..8a58107cec 100644
--- 
a/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/payment/PaymentServices.groovy
+++ 
b/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/payment/PaymentServices.groovy
@@ -611,16 +611,20 @@ Map createPaymentFromOrder() {
     GenericValue orderHeader = from('OrderHeader').where(parameters).queryOne()
     if (orderHeader) {
         if (orderHeader.orderTypeId == 'PURCHASE_ORDER') {
-            String purchaseAutoCreate = 
UtilProperties.getPropertyValue('accounting', 
'accounting.payment.purchaseorder.autocreate', 'Y')
+            String purchaseAutoCreate = 
EntityUtilProperties.getPropertyValue('accounting',
+                    'accounting.payment.purchaseorder.autocreate', 'Y', 
delegator)
             if (purchaseAutoCreate != 'Y') {
-                return error('payment not created from approved order because 
config' +
-                        ' (accounting.payment.salesorder.autocreate) is not 
set to Y (accounting.properties)')
+                logInfo('payment not created from approved order because 
config' +
+                        '(accounting.payment.purchaseorder.autocreate) is not 
set to Y (accounting.properties)')
+                return success()
             }
         } else if (orderHeader.orderTypeId == 'SALES_ORDER') {
-            String salesAutoCreate = 
UtilProperties.getPropertyValue('accounting', 
'accounting.payment.salesorder.autocreate', 'Y')
+            String salesAutoCreate = 
EntityUtilProperties.getPropertyValue('accounting',
+                    'accounting.payment.salesorder.autocreate', 'Y', delegator)
             if (salesAutoCreate != 'Y') {
-                return error('payment not created from approved order because 
config' +
+                logInfo('payment not created from approved order because 
config' +
                         ' (accounting.payment.salesorder.autocreate) is not 
set to Y (accounting.properties)')
+                return success()
             }
         }
 

Reply via email to