webERP Forum
Why use field glcode in purchdetails table? - Printable Version

+- webERP Forum (http://www.weberp.org/forum)
+-- Forum: webERP Discussion (http://www.weberp.org/forum/forumdisplay.php?fid=1)
+--- Forum: Development Discussion & Specification (http://www.weberp.org/forum/forumdisplay.php?fid=10)
+--- Thread: Why use field glcode in purchdetails table? (/showthread.php?tid=8156)



Why use field glcode in purchdetails table? - PakRicard - 04-24-2018

Hi all:

Why are we using the field glcode in table purchdetails when receiving goods to assign the value of goods received into the stock GL account, instead of using the stock GL code of the inventory category of the item?

I found out that some items had the stock value wrongly assigned when receiving. It turns out that some items change their inventory category during its lifetime so, they had a category A with GLcode GLA, then (for business reasons) category changed to B with GLCode GLB before reception.
At reception time, stock gets assigned to the old category GLA account.

The code is quite clear and there must be an accounting reason for this, but I can't find it. Why couldn't we use directly the GL assigned to the stock category of the item?



P.S.: We use stockcategory to control cycle of life of the items, having stock categories: test, stable, discounted, etc... so all the items pass though some stock categories during its life.



RE: Why use field glcode in purchdetails table? - TimSchofield - 04-24-2018

Hi Ricard, how are you?

I think the idea was that once the order was made, that the details pertaining to that item/supplier/order should remain fixed, which does make sense in most environments, though I can see how it wouldn't with the way you use stock categories. Not sure what to suggest though, as changing it would be a big change in policy, that vI am not sure I would be in favour of.

Thanks
Tim


RE: Why use field glcode in purchdetails table? - PakRicard - 04-25-2018

Hi Tim:
My point is that I detected this behaviour (or bug, depending on POV) as everytime we received goods from PO's some stock valuation get unbalanced compared against the Balance Sheer (as we keep different stock GL accounts for different stock categories).

Let's imagine we have just a PO for one item. In the case mentioned on the initial post, stock gets assigned to GL account A but once sold stock value gets deducted from GL Account B, which is wrong accounting :-(

I understand my case could be not a general case, and the code to change is very easy (just grab the glcode from stockcategories instead of using teh one from purchorderdetails) around line 725 on GoodsReceived.php, but I would like to know the rationale behind the standard webERP system, so I do not create a worst collateral damage somewhere.

In my case it does not work, and after some years chasing it (on and off) I could finally locate it ;-) If stock category remain constant for any stockid during its lifetime, then there is no problem.




RE: Why use field glcode in purchdetails table? - TimSchofield - 04-25-2018

Hi Ricard, well I think the rationale was as I said to maintain the consistency from the order through to invoice. However reading your post I do see the problem, and I for one would have no problem with that change being put in.

Tim


RE: Why use field glcode in purchdetails table? - phil - 04-27-2018

This looks like a bug to me.... However, changes in stock category stock gl codes could easily cause such differences also - not sure how we could nail that down.