We're updating the issue view to help you get more done. 

Production: Could not save MA for Production line

Description

Hi ,

After changes when I try to "Reverse - Correct" a production order I'm getting a "Could not save MA for Production line" error.

Changing the MProductionLine by this way appears to solved the problem here:

I'm able to reproduce the error on test server as you can see below :

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 18:28:34.287===========> DB.executeUpdate: INSERT INTO M_ProductionLineMA (UpdatedBy,Updated,CreatedBy,Created,IsActive,AD_Org_ID,AD_Client_ID,M_AttributeSetInstance_ID,M_ProductionLine_ID,MovementQty,M_ProductionLineMA_UU,DateMaterialPolicy) VALUES (?,?,?,?,?,?,?,?,?,?,?,trunc(cast(? as TIMESTAMP))) [WFP_96c67249-995e-46cf-8bd1-0b4182987571] [56] org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "m_productionlinema_pkey" Detail: Key (m_productionline_id, m_attributesetinstance_id, datematerialpolicy)=(1000068, 0, 2017-09-18 00:00:00) already exists.; State=23505; ErrorCode=0 at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2455) at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2155) at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:288) at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:430) at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:356) at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:168) at org.postgresql.jdbc.PgPreparedStatement.executeUpdate(PgPreparedStatement.java:135) at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeUpdate(NewProxyPreparedStatement.java:384) at sun.reflect.GeneratedMethodAccessor129.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.compiere.db.StatementProxy.invoke(StatementProxy.java:128) at com.sun.proxy.$Proxy6.executeUpdate(Unknown Source) at org.compiere.util.DB.executeUpdate(DB.java:1038) at org.compiere.util.DB.executeUpdate(DB.java:1007) at org.compiere.model.PO.doInsert(PO.java:3009) at org.compiere.model.PO.saveNew(PO.java:2813) at org.compiere.model.PO.save(PO.java:2157) at org.compiere.model.PO.save(PO.java:2361) at org.compiere.model.MProductionLine.createTransactions(MProductionLine.java:125) at org.compiere.model.MProduction.processLines(MProduction.java:170) at org.compiere.model.MProduction.completeIt(MProduction.java:114) at org.compiere.process.DocumentEngine.completeIt(DocumentEngine.java:494) at org.compiere.process.DocumentEngine.processIt(DocumentEngine.java:311) at org.compiere.process.DocumentEngine.processIt(DocumentEngine.java:275) at org.compiere.model.MProduction.processIt(MProduction.java:452) at org.compiere.model.MProduction.reverse(MProduction.java:740) at org.compiere.model.MProduction.reverseCorrectIt(MProduction.java:692) at org.compiere.process.DocumentEngine.reverseCorrectIt(DocumentEngine.java:585) at org.compiere.process.DocumentEngine.processIt(DocumentEngine.java:357) at org.compiere.process.DocumentEngine.processIt(DocumentEngine.java:275) at org.compiere.model.MProduction.processIt(MProduction.java:452) at org.compiere.wf.MWFActivity.performWork(MWFActivity.java:1014) at org.compiere.wf.MWFActivity.run(MWFActivity.java:879) at org.compiere.wf.MWFProcess.startNext(MWFProcess.java:373) at org.compiere.wf.MWFProcess.checkActivities(MWFProcess.java:283) at org.compiere.wf.MWFActivity.setWFState(MWFActivity.java:280) at org.compiere.wf.MWFActivity.run(MWFActivity.java:896) at org.compiere.wf.MWFProcess.startWork(MWFProcess.java:505) at org.compiere.wf.MWorkflow.start(MWorkflow.java:690) ------------------------------- 18:28:34.420===========> DB.saveError: SaveErrorNotUnique - ERROR: duplicate key value violates unique constraint "m_productionlinema_pkey" Detail: Key (m_productionline_id, m_attributesetinstance_id, datematerialpolicy)=(1000068, 0, 2017-09-18 00:00:00) already exists. [56] ------------------------------- 18:28:34.425-----------> MProductionLineMA.doInsert: [WFP_96c67249-995e-46cf-8bd1-0b4182987571]Not inserted - M_ProductionLineMA [56] 18:28:34.796===========> MProductionLineMA.saveError: SaveErrorNotUnique - ERROR: duplicate key value violates unique constraint "m_productionlinema_pkey" Detail: Key (m_productionline_id, m_attributesetinstance_id, datematerialpolicy)=(1000068, 0, 2017-09-18 00:00:00) already exists. [56] ------------------------------- 18:28:34.798===========> MProductionLine.createTransactions: Could not save MA for Production line:100 -- -2 of PChair [56]

Environment

None

Status

Assignee

Heng Sin Low

Reporter

muriloht

Labels

None

Tested By

None

Components

Fix versions

Affects versions

4.1

Priority

Blocker