Movements producting negative qtyStorageOnHand set date material policy to movement date

Description

When allowing negative inventory we run into an issue making a movement resulting in a negative quantity as the date material policy on the negative storage on hand entry is set to the movement date. The issue comes up when trying to consolidate the negative inventory from another warehouse with an existing date material policy not equal to the movement date as we are getting multiple storage on hand entries (one negative the other positive).

Being my first patch I'm not sure the attached one solves the issue with all side effects. If thats preferred I can also move the code to an own function (or extend the existing MStorageOnHand.getDateMaterialPolicy with additional query criteria)?

What I'm trying to do is to set the date material policy of the StorageMA to the oldest or newest date material policy with sufficient qtyOnHand. For my scenario that fixes the duplicate storage on hand issue (testing with FIFO).

Environment

not using ASIs

Activity

Show:
Heng Sin Low
September 13, 2017, 7:27 AM

The patch is outdated. Please reopen with a new patch and test case if the problem is still there in current 4.1 code.

Assignee

Daniel Haag

Reporter

Daniel Haag

Labels

None

Tested By

None

Components

Affects versions

Priority

Critical
Configure