Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0002626Openbravo ERP03. Procurement managementpublic2008-02-19 13:212008-06-12 09:43
user71 
gorkaion 
normalminoralways
closedfixed 
5
 
2.40alpha-r2 
No
Core
No
0002626: PROC. GENERATE_AVERAGE_COSTS & Reversed GoodsReceipts
Version 2.35MP1 (Oracle)

In the PROCEDURE “GENERATE_AVERAGE_COSTS”, it doesn't excluse the Reversed Goods Shipment.
To fix this error:

Replace the next SELECT:

    FOR Cur_InOutLine IN
      (SELECT M_INOUTLINE.M_INOUTLINE_ID, M_INOUTLINE.MOVEMENTQTY, M_PRODUCT.M_PRODUCT_ID, M_INOUT.MOVEMENTDATE,
        M_INOUTLINE.AD_CLIENT_ID, M_INOUTLINE.AD_ORG_ID, M_INOUT.C_BPARTNER_ID
      FROM M_INOUT, M_INOUTLINE, M_PRODUCT
      WHERE M_INOUT.M_INOUT_ID=M_INOUTLINE.M_INOUT_ID
        AND M_INOUTLINE.M_PRODUCT_ID=M_PRODUCT.M_PRODUCT_ID
        AND M_PRODUCT.COSTTYPE='AV'
        AND M_INOUT.ISSOTRX='N'
        AND M_INOUT.PROCESSED='Y'
        AND M_INOUTLINE.MOVEMENTQTY>0
        AND NOT EXISTS
        (SELECT 1 FROM M_COSTING WHERE M_INOUTLINE_ID=M_INOUTLINE.M_INOUTLINE_ID)
      ORDER BY M_PRODUCT.M_PRODUCT_ID, M_INOUT.MOVEMENTDATE, M_INOUTLINE.MOVEMENTQTY DESC
      )
    LOOP

With this one:

    FOR Cur_InOutLine IN
      (SELECT M_INOUTLINE.M_INOUTLINE_ID, M_INOUTLINE.MOVEMENTQTY, M_PRODUCT.M_PRODUCT_ID, M_INOUT.MOVEMENTDATE,
        M_INOUTLINE.AD_CLIENT_ID, M_INOUTLINE.AD_ORG_ID, M_INOUT.C_BPARTNER_ID
      FROM M_INOUT, M_INOUTLINE, M_PRODUCT
      WHERE M_INOUT.M_INOUT_ID=M_INOUTLINE.M_INOUT_ID
        AND M_INOUTLINE.M_PRODUCT_ID=M_PRODUCT.M_PRODUCT_ID
        AND M_PRODUCT.COSTTYPE='AV'
        AND M_INOUT.ISSOTRX='N'
        AND M_INOUT.PROCESSED='Y'
        AND M_INOUTLINE.MOVEMENTQTY>0
        AND NOT EXISTS
        (SELECT 1 FROM M_COSTING WHERE M_INOUTLINE_ID=M_INOUTLINE.M_INOUTLINE_ID)
--BEG MMR 19/02/2008: Estaba teniendo en cuenta los albaranes Anulados. Era un error que ya he reportado
        AND M_INOUT.DOCSTATUS<>'DR' AND M_INOUT.DOCSTATUS<>'RE'
--END MMR 19/02/2008
      ORDER BY M_PRODUCT.M_PRODUCT_ID, M_INOUT.MOVEMENTDATE, M_INOUTLINE.MOVEMENTQTY DESC
      )
    LOOP
No tags attached.
Issue History

Notes
(0006215)
user71   
2005-06-01 00:00   
(edited on: 2008-06-12 09:43)
This bug was originally reported in SourceForge bug tracker and then migrated to Mantis.

You can see the original bug report in:
https://sourceforge.net/support/tracker.php?aid=1896878 [^]