Unique constraint error completing Returns

Description

When I try to complete some returns documents I have ​​this error

DB.saveError: SaveErrorNotUnique - ORA-00001: unique constraint (ADEMPIERE.M_INOUTLINEMA_KEY) violated

The error occours also upgrading to 2.1 version

I found that the error occurs inside the method checkMaterialPolicy of MInOut.java class

For testing porpouse if I write
int no = MInOutLineMA.deleteInOutLineMA(line.getM_InOutLine_ID(), get_TrxName());

before any new MInOutLineMA creation block inside checkMaterialPolicy method and the document is completed successfully

Environment

Idempiere 2.0 - Oracle Xe 11G

Activity

Show:
Carlos Ruiz
January 28, 2015, 2:22 PM

, I was not able to reproduce the issue.

Looking at the code maybe you have duplicates in your M_StorageOnHand table.

If you find a case able to be reproduced please reopen the ticket with steps to reproduce.

Regards,

Carlos Ruiz

Fabio Canella
January 28, 2015, 4:43 PM

Thanks Carlos, as you said there are many "duplicates" rows in M_StorageOnHand table:

same M_LOCATOR_ID, M_PRODUCT_ID and M_ATTRIBUTESETINSTANCE_ID value but different DATEMATERIALPOLICY value

is not correct ? what you mean by duplicates rows ?

Best Regards,
Fabio

Carlos Ruiz
January 28, 2015, 4:45 PM

according to the code, there must be two records maybe with same locator, product, asi and date

Fabio Canella
January 28, 2015, 6:31 PM

I found the solution:
there was an old key M_INOUTLINEMA_KEY that is wrong, the new key is M_INOUTLINEMA_PKEY
I deleted the old one and now it seem ok

this was probably a migration error

Assignee

Carlos Ruiz

Reporter

Fabio Canella

Labels

None

Tested By

None

Affects versions

Priority

Major
Configure