Closed HKuz closed 1 year ago
@agritheory - I know you're traveling, whenever suits your timing, this is in a state where a demo/discussion to get feedback makes sense.
Status update: Comments are resolved - I created two BOMs and revised the test data with a few tweaks (and tested that the site re-installs without issue). The UOM conversions from one commit were moved into the Item UOM Conversion Detail table instead. To test this, I created two Pie Crust Service items - one in stock UOMs of Nos, the other in Hours and checked that adjustments to quantities were using the right UOM when WOs were adding or removing finished good qtys.
One head's up, I had to manually adjust the columns in the Subcontracting table on the Purchase Invoice to see all the necessary columns (the Paid_Qty and To_Pay_Qty fields weren't showing automatically).
There are a handful of potential UI refinements that are still outstanding (also noted in code):
One head's up, I had to manually adjust the columns in the Subcontracting table on the Purchase Invoice to see all the necessary columns (the Paid_Qty and To_Pay_Qty fields weren't showing automatically).
What does "manually adjust" mean?
@agritheory - manually adjust means I had to click the wheel icon at the side of the table, and tick off those fields to include them (then adjust the widths so everything would fit)
manually adjust means I had to click the wheel icon at the side of the table, and tick off those fields to include them (then adjust the widths so everything would fit)
@hkuz I added some JS to handle this as well as some changes to the workflow. I've been testing by creating a PO from the Work Order; it seem to go according to plan. Can you give this some testing to see how if works for you? Please do a reinstall and setup to pick up some new details
@agritheory - new functionality looks good! I removed a couple text artifacts that threw errors. Also, when a new subcontracting PO was created off a WO, I was getting an error that the Item had to be a non-stock one, then couldn't be None. To get around these, I commented out the line that adds the item_code
field (so Item will be blank for User to fill in) and put the doc's 'ignore_validate' and 'ignore_mandatory' flags to true. When the filter in subcontracted POs that forces only service items is removed, we should be able to revert the changes I made.
To get around these, I commented out the line that adds the item_code field (so Item will be blank for User to fill in) and put the doc's 'ignore_validate' and 'ignore_mandatory' flags to true. When the filter in subcontracted POs that forces only service items is removed, we should be able to revert the changes I made.
I think we should consider the fix for #14 as well as a server-side validation in scope of this PR.
Edit: added it to JS, there is no server-side validation.
Latest push includes:
update_stock
check box in a subcontracting PI (if the WO subcontracting workflow is enabled)Purchase Receipt
button, also removes the create Subcontracting Order
button from the POThe validation fix ended up needing the monkey patch in __init__
vs a query change. The override whitelisted function with an in-function monkey patch worked great as long as that got called in a session first by say, adding an item to a form in the UI. However, the get_item_details
and problematic validate_item_details
get called in the validation process purely on the server side when we create a PO from a WO. So if I ran bench migrate
and refreshed the app, then tried creating the PO programmatically off the WO before a client-side call, it used the erpnext versions and would error out. But putting the patch in __init__
handled that case.
We are going to want to very clearly comment the override in __init__
, it's just about the biggest footgun possible.
@HKuz Please pull / rebase. This now incorporates the changes from version-14
. What needs validation now is that the manual tests for this work. Automated tests for the other features pass.
@agritheory - I retested the latest code and all functionality looked good. I had to make one tweak to the PI stock entry query to ignore entries against a cancelled PO (this came up when a subcontracting PO's WO had stock entries, then I added a new WO to that PO (cancelling and amended it), then when I fetched stock entries in the PI I saw the ones for the original WO displayed for both the cancelled and the amended PO).
DRAFT Addresses #2
Updated to-dos:
Two new WO validations:
[x] As settings dictate, remove the v14 item filter for when a PO/PI is subcontracted it only allows service items in the Items table dropdown -> details in issue #14
[x] add necessary fields to Stock Entry Detail to track paid qty, show
Total Qty
,Paid Qty
, andTo Pay Qty
fields in the Subcontracting table in the PI as the source of truth for reconciliationtie WOs to POs:
When a WO is cancelled, update the PO (this works if PO is draft, but if PO is submitted, ERPNext detects linked docs and user can only cancel PO then manually amend, vs doing this programmatically)
Purchase Invoice
[x] The visibility of subcontracting info table in PO and PI is based on the
is_subcontracted
check box and the inventory tools settings options[ ] Print/email format in workflow to notify subcontractor materials are ready
[ ] Add test data for this workflow (subcontracted WOs, material txfr SEs, multiple manufacture SE receiving subcontracted goods)
Process refinements to discuss:
fg_item
andfg_item_qty
). As of now, the code cancels/amends the doc to add a new blank item with those fields filled in based on the WO info, then lets the user adjust anything else and re-submit.Valuation comment: we discussed that accurate valuation would be an issue to tackle. For now, I included a valuation rate in Pie Crust item master (so the receiving stock entries wouldn't complain) equal to the value of the raw materials. This is static / not sensitive to timing of rate updates, and doesn't capture the subcontracted value-add (we talked about using an LCV-esque approach for this). Let me know if we should set up the test data differently / accept zero valuation rate in the SE / something else.