Open HKuz opened 1 year ago
@HKuz I tried to rebase this but I don't feel confident in the decisions I was making, can I get you to rebase this and we'll split the remaining work into separate ticket?
@agritheory I rebased this, but in testing I realized at least one function needs to be updated for version-14 changes (it's trying to access a default account that isn't listed in Company settings anymore). I can ping you when this is updated and ready.
@HKuz Just had a look at this again, we need to add docs but should probably split out the tests into another ticket.
All code is now updated and re-tested for changes in ERPNext's underlying functions. In running through the test scenarios above, I added another one to create a PR with LCs, then create a PI off it with additional LCs. This uncovered a bug where it's double-counting the LCs when the PI is submitted.
In our JS code, when the Distribute Landed Costs Based On field is changed to either Qty or Amount, it's assuming everything in the taxes and charges table should be allocated (automatically sets the category to Valuation and Total and includes in the sum for the items table). It wasn't allowing the user to exclude a row (like sales tax in a PI) and recalculate the landed cost amount.
UPDATE - adjustments made in the javascript to let the user change the tax category and it triggers a re-calc of the landed cost amounts (excluding anything not marked as Valuation or Valuation and Total). Docs are also updated to note this.
For the double-counting solution I need to add a check in the PI for any LCs already in the PR so they're not double-counted.
Addresses #4
Opening PR to track progress - for now I see this as two 'phases' - 1) get the feature working on a standalone basis in v14 and 2) integrate the feature to work with WO subcontracting.
PHASE I
PHASE II and tests -> moved to a separate issue