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
Idempiere 2.0 - Oracle Xe 11G
, 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.
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 ?
according to the code, there must be two records maybe with same locator, product, asi and date
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