Page 1 of 1

Update Home Landed and Suppliers Cost

PostPosted: Wed Aug 31, 2022 12:46 pm
by DannyC
How feasible would it be to knock up a plugin which only updates the purchasing Home Landed Cost and Suppliers Cost, currently ticked in Sys Configuration for Purchase Orders, GRNs and Purchase Invoices, to only update if the existing costs are lower?
My client doesn't want any costs to update if something was purchased from their suppliers at some kind of special, discount etc. Particularly IN_Main.LCost. That should remain at the highest cost.

cheers

Re: Update Home Landed and Suppliers Cost

PostPosted: Wed Aug 31, 2022 12:54 pm
by Mike.Sheen
DannyC wrote:My client doesn't want any costs to update if something was purchased from their suppliers at some kind of special, discount etc. Particularly IN_Main.LCost. That should remain at the highest cost.


You're preventing the price from EVER going down by doing that. I get you want to preclude specials / promotions, but is by only ever allowing an increase might not be the best way - what about a way of flagging the PO or PO Line as being a promotional price and THAT being what determines if the last cost gets updated?

Re: Update Home Landed and Suppliers Cost

PostPosted: Wed Aug 31, 2022 5:04 pm
by DannyC
You're preventing the price from EVER going down by doing that

Yep. The client knows that.

what about a way of flagging the PO or PO Line as being a promotional price and THAT being what determines if the last cost gets updated?

Good idea.
Progressing that thought, I think for this client it would be most relevant to put a custom field on the purchase invoice line. So if I add a checkbox to PI lines, how then would I stop the costs getting updated? I know how to read the custom field, its the prevention of updating which I am a bit stumped on.

Re: Update Home Landed and Suppliers Cost  Topic is solved

PostPosted: Wed Aug 31, 2022 5:16 pm
by Mike.Sheen
There is a system setting, UpdateLastCost - which when set to False will cause Purchase Invoices, GRN's and Shipment BookIns to NOT set the last cost (IN_Main.LCost) when activating.

As our business logic objects all typically follow a pattern where the system settings they are interested in are cached into a SystemSettings class at the time of the business logic being created, a Plugin could selectively set that value to control the behaviour.

So, PurchaseInvoice.SystemSettings.UpdateLastCost set to False won't change the actual system setting, but the cached copy it uses, which makes the Purchase Invoice behave as if it was set to False. Same applies to Purchase Orders and BookIns.

Re: Update Home Landed and Suppliers Cost

PostPosted: Wed Aug 31, 2022 5:29 pm
by DannyC
Righto. That gives me something to go on.
Appreciate the help. :)