Fixed: Create return is not working on demo trunk
Weirdly (I guess I did not save) this syntax did not work 1st time I tried it
@@ -95,16 +95,13 @@ def createReturnHeader() {
userLogin: systemLogin]
GenericValue partyAcctgPreference = serviceResult.partyAccountingPreference
- if (partyAcctgPreference) {
- if ("Y" == partyAcctgPreference.useInvoiceIdForReturns) {
+ if (partyAcctgPreference && "Y" == partyAcctgPreference.useInvoiceIdForReturns) {
Map serviceResultInvoice = run service: "getNextInvoiceId", with: [partyId: parameters.toPartyId]
newEntity.returnId = serviceResultInvoice.invoiceId
} else {
newEntity.returnId = delegator.getNextSeqId("ReturnHeader")
}
- } else {
- newEntity.returnId = delegator.getNextSeqId("ReturnHeader")
- }
+
result.returnId = newEntity.returnId
boolean hasCreatePermission = security.hasEntityPermission("ORDERMGR", "_CREATE", parameters.userLogin)
