Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0003459Openbravo ERP04. Warehouse managementpublic2008-02-08 15:402012-07-30 14:02
user71 
gorkaion 
normalminoralways
closedfixed 
5
 
3.0MP13 
Core
No
0003459: generate average costs no work correctly with invoice return
when you create invoice returns without m_inout associated to lines, the process generate_average_costs don't calculate cost with this lines.
No tags attached.
blocks feature request 0004252pi acknowledged rmorley Cost management enhancements 
Issue History
2008-07-01 18:12pjuvaraRelationship addedblocks 0004252
2008-07-01 18:12pjuvaraStatusnew => acknowledged
2008-11-16 07:44pjuvaraAssigned Touser71 => pjuvara
2011-02-04 09:16jpabloaeAssigned Topjuvara => rmorley
2011-09-08 13:15eintelauIssue Monitored: eintelau
2012-07-30 14:01gorkaionStatusacknowledged => scheduled
2012-07-30 14:01gorkaionAssigned Tormorley => gorkaion
2012-07-30 14:01gorkaionfix_in_branch => pi
2012-07-30 14:02gorkaionNote Added: 0050989
2012-07-30 14:02gorkaionStatusscheduled => closed
2012-07-30 14:02gorkaionResolutionopen => fixed
2012-07-30 14:02gorkaionFixed in Version => 3.0MP13

Notes
(0007048)
user71   
2005-06-01 00:00   
(edited on: 2008-06-12 09:44)
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=1889633 [^]
(0003941)
user71   
2008-02-15 12:18   
(edited on: 2008-06-12 09:26)
Logged In: YES
user_id=1701456
Originator: YES

i have solved this problem:
 1. in generate_average_costs, i modified the pl in the cursor Cur_InOutLine. I added a "select union" of all invoice returns with lines not associated to m_inout:
   FOR Cur_InOutLine IN
      (SELECT M_INOUTLINE_ID, MOVEMENTQTY, M_PRODUCT_ID, MOVEMENTDATE,
        AD_CLIENT_ID, AD_ORG_ID, C_BPARTNER_ID, C_INVOICELINE_ID
      FROM
      (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, NULL AS C_INVOICELINE_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)
       /**** new:
          UNION
        SELECT NULL, IL.QTYINVOICED AS MOVEMENTQTY, IL.M_PRODUCT_ID, I.DATEINVOICED AS DATEMOVEMENT,
        IL.AD_CLIENT_ID, IL.AD_ORG_ID, I.C_BPARTNER_ID, IL.C_INVOICELINE_ID
        FROM C_INVOICELINE IL, C_INVOICE I
        WHERE IL.M_INOUTLINE_ID IS NULL
        AND IL.C_INVOICE_ID = I.C_INVOICE_ID
        AND IL.C_ORDERLINE_ID IS NULL
        AND IL.QTYINVOICED <0
        AND NOT EXISTS (SELECT 1 FROM M_COSTING WHERE C_INVOICELINE_ID=IL.C_INVOICELINE_ID))
        ORDER BY M_PRODUCT_ID, MOVEMENTDATE, MOVEMENTQTY DESC) loop ****** end new***
 2. in tab of costs, exists a field of invoiceLineFrom (like inoutLineFrom), but this field is hidden. I showed this field.
(0050989)
gorkaion   
2012-07-30 14:02   
new cost engine manages return shipments and receipts.