Anonymous | Login
Project:
RSS
  
News | My View | View Issues | Roadmap | Summary

View Issue DetailsJump to Notes ] Issue History ] Print ]
ID
0021884
TypeCategorySeverityReproducibilityDate SubmittedLast Update
defect[Openbravo ERP] 05. Production managementmajoralways2012-10-08 18:032012-10-18 18:39
ReporterVictorVillarView Statuspublic 
Assigned ToioritzCia 
PriorityimmediateResolutionfixedFixed in Version
StatusclosedFix in branchpiFixed in SCM revision805f83eefd43
ProjectionnoneETAnoneTarget Version3.0MP17
OSAnyDatabaseAnyJava version
OS VersionDatabase versionAnt version
Product VersionpiSCM revision 
Review Assigned To
Web browser
ModulesCore
Regression level
Regression date
Regression introduced in release
Regression introduced by commit
Triggers an Emergency PackNo
Summary

0021884: wrong calculation of ending date for m_costing register under some cirumstancies

DescriptionUsing the old generate average cost process, under some cirumstancies the new register in the m_costing has a wrong calculation date.
Steps To Reproduceas group admin role,
Go to Product window,
   Create a new register:
       Org: España
       Name: test
       cost type: legacy average
       purchase: Yes
       Sale: yes
  go to price list tab:
      new register for Tarifa Bebidas Alegres
  go to Costing tab:
      create a new register org: España
      Cost type: Legacy Standard
      Starting date: 01-07-2011
      Ending date: 02-07-2011
Go to Goods receipt window:
      create a new register for Org: España
       business partner: Fruta de la vida
       movement date: 03-07-2011
     Lines tab:
       product: test
       movement qty: 40
       storage bin: whatever
Complete it.

Go to Purchase order window:
     Create a new register:
       org: España
       BP: Bebidas Alegres
       price list: Bebidas Alegres
 lines tab:
      Product: test
      ordered qty: 3
Book it

Go to Goods receipt window:
      create a new register for Org: España
       business partner: Bebidas Alegres
       movement date: today
   Create lines from order created before
Complete it

Launch the Generate average cost process, incremental= No
Go to Product || Costing tab: realise that the date to of the second register is lower than the date from.

the problem is that there is an update of dates before check if it is possible to calculate the cost:

  v_Cost:=Cur_ProdCost.COST;
  v_Date:=Cur_ProdCost.DATETO;
          UPDATE M_COSTING
          SET DATETO = Cur_InOutLine.MOVEMENTDATE,
          Updated=now(),
            UpdatedBy=v_User
          WHERE M_COSTING_ID = Cur_ProdCost.M_COSTING_ID;
       
Proposed SolutionThe solution should be:
1.- First check if it is possible to calculate the cost before doing the any date update.

Move the following update:

UPDATE M_COSTING
          SET DATETO = Cur_InOutLine.MOVEMENTDATE,
          Updated=TO_DATE(NOW()),
            UpdatedBy=v_User
          WHERE M_COSTING_ID = Cur_ProdCost.M_COSTING_ID;

just before the insert:

INSERT
          INTO M_COSTING
        (
          M_COSTING_ID, CREATED, CREATEDBY, UPDATED,
          UPDATEDBY, AD_CLIENT_ID, AD_ORG_ID, M_PRODUCT_ID,
          DATETO, DATEFROM, ISMANUAL, M_INOUTLINE_ID,
          C_INVOICELINE_ID, QTY, PRICE, CUMQTY,
          COST, COSTTYPE, ISPERMANENT
        )
        VALUES
        (
          Ad_Sequence_Nextno('M_Costing'), TO_DATE(NOW()), v_User, TO_DATE(NOW()),
          v_User, Cur_InOutLine.AD_CLIENT_ID, Cur_InOutLine.AD_ORG_ID, Cur_InOutLine.M_PRODUCT_ID,
          COALESCE(v_Date, TO_DATE('31-12-9999', 'DD-MM-YYYY')), Cur_InOutLine.MOVEMENTDATE, 'N', Cur_InOutLine.M_INOUTLINE_ID,
          NULL, Cur_InOutLine.MOVEMENTQTY, v_PriceNew, COALESCE(v_Qty, 0) + Cur_InOutLine.MOVEMENTQTY + v_CumQty, v_CostNew,
          'AV', 'N'
        );

Also it should be necessary assign the Cur_ProdCost.M_COSTING_ID into a variable in order to use it later in the update before the insert.
TagsNo tags attached.
Attached Files

- Relationships Relation Graph ] Dependency Graph ]

-  Notes
(0053361)
hgbot (developer)
2012-10-16 09:13

Repository: erp/devel/pi
Changeset: 805f83eefd4313796312f807f63a4197440754a4
Author: Ioritz Cia <ioritz.cia <at> openbravo.com>
Date: Wed Oct 10 18:55:28 2012 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/805f83eefd4313796312f807f63a4197440754a4 [^]

Fixes issue 21884: wrong calculation of ending date
for m_costing register under some cirumstancies.

---
M src-db/database/model/functions/M_GENERATE_AVERAGE_COSTS.xml
---
(0053400)
hudsonbot (developer)
2012-10-16 18:54

A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/0381663eaf40 [^]

Maturity status: Test
(0053477)
VictorVillar (developer)
2012-10-18 18:39

Verified

- Issue History
Date Modified Username Field Change
2012-10-08 18:03 VictorVillar New Issue
2012-10-08 18:03 VictorVillar Assigned To => dmiguelez
2012-10-08 18:03 VictorVillar Modules => Core
2012-10-08 18:04 VictorVillar Assigned To dmiguelez => jonalegriaesarte
2012-10-08 18:04 VictorVillar Issue Monitored: networkb
2012-10-10 10:54 VictorVillar Proposed Solution updated
2012-10-10 11:17 jonalegriaesarte Assigned To jonalegriaesarte => ioritzCia
2012-10-15 09:45 ioritzCia Status new => scheduled
2012-10-15 09:45 ioritzCia fix_in_branch => pi
2012-10-16 09:13 hgbot Checkin
2012-10-16 09:13 hgbot Note Added: 0053361
2012-10-16 09:13 hgbot Status scheduled => resolved
2012-10-16 09:13 hgbot Resolution open => fixed
2012-10-16 09:13 hgbot Fixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/805f83eefd4313796312f807f63a4197440754a4 [^]
2012-10-16 18:54 hudsonbot Checkin
2012-10-16 18:54 hudsonbot Note Added: 0053400
2012-10-18 18:39 VictorVillar Note Added: 0053477
2012-10-18 18:39 VictorVillar Status resolved => closed


Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker