Generate Invoice from RMA non-functional when shipment on multishipment invoice

Description

If a shipment referenced by a customer RMA is invoiced on a multi shipment invoice the create invoice from RMA doesn't work with the following error message:

14:12:50.516===========> InvoiceGenerateRMA.process: java.lang.IllegalStateException: Not invoiced - RMA: 30009 [163]
java.lang.IllegalStateException: Not invoiced - RMA: 30009
at org.compiere.model.MInvoice.setRMA(MInvoice.java:2640)
at org.adempiere.process.InvoiceGenerateRMA.createInvoice(InvoiceGenerateRMA.java:143)
at org.adempiere.process.InvoiceGenerateRMA.generateInvoice(InvoiceGenerateRMA.java:192)
at org.adempiere.process.InvoiceGenerateRMA.doIt(InvoiceGenerateRMA.java:106)
at org.compiere.process.SvrProcess.process(SvrProcess.java:198)
at org.compiere.process.SvrProcess.startProcess(SvrProcess.java:144)
at org.adempiere.util.ProcessUtil.startJavaProcess(ProcessUtil.java:174)
at org.compiere.apps.AbstractProcessCtl.startProcess(AbstractProcessCtl.java:466)
at org.compiere.apps.AbstractProcessCtl.run(AbstractProcessCtl.java:234)
at java.lang.Thread.run(Thread.java:745)

Steps to reproduce:

  • Create 2-3 sales orders to the same customer.

  • Create individual shipments on the sales orders

  • Generate Invoice for all shipments (single invoice for all shipments).

  • Create a customer RMA and return one item on one shipment.

  • Create an invoice from customer RMA (doesn't work)

Link to suggested patch

https://bitbucket.org/dantam/idempiere.se/commits/af0ac519069583f3c19920e630c981953aca7704

Environment

None

Assignee

Daniel Tamm

Reporter

Daniel Tamm

Labels

Tested By

None

Time tracking

1h

Components

Affects versions

Priority

Major
Configure