Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Inline landed costing feature #31

Draft
wants to merge 10 commits into
base: version-14
Choose a base branch
from
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion inventory_tools/docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ The Inventory Tools application enhances and extends inventory-related functiona
- **[UOM Enforcement](./uom_enforcement.md)**: for doctypes that have an Items table or Unit of Measure (UOM) fields, this feature restricts the user's options from arbitrary selections to only UOMs defined in the Item master with a specified conversion factor
- **[Warehouse Path](./warehouse_path.md)**: for any warehouse selection field, this features helps clearly identify warehouses by creating a warehouse path and adding a human-readable string under the warehouse name in the format "parent warehouse(s)->warehouse"
- **[Subcontracting Workflow via Work Order](./wo_subcontracting.md)**: an alternative to ERPNext's subcontracting workflow that enables a user to employ Work Orders, subcontracting Purchase Orders, and manufacturing Stock Entries in lieu of Purchase Receipts or Subcontracting Orders/Receipts. Enhancements to the subcontracting Purchase Invoice allow a user to quickly reconcile what Items have been received with what is being invoiced
- **[Inline Landed Costing](./landed_costing.md)**: Coming soon! This features enables a user to include any additional costs to be capitalized into an Item's valuation directly in a Purchase Receipt or Purchase Invoice without needing to create a separate Landed Cost Voucher
- **[Inline Landed Costing](./landed_costing.md)**: This features enables a user to directly include any additional costs to be capitalized into an Item's valuation in a Purchase Receipt or Purchase Invoice without needing to create a separate Landed Cost Voucher
- **[Manufacturing Capacity](./manufacturing_capacity.md)**: a report-based interface to show, for a given BOM, the entire hierarchy of any BOM tree containing that BOM with demand and in-stock quantities for all levels

## Configuration
Expand Down
27 changes: 26 additions & 1 deletion inventory_tools/docs/landed_costing.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
# Inline Landed Costing

Coming soon!
This features enables a user to directly include any additional costs to be capitalized into an Item's valuation in a Purchase Receipt or Purchase Invoice without needing to create a separate Landed Cost Voucher.

By default, this feature is turned off, but may be toggled on by checking the Enable Inline Landed Costing checkbox in the Landed Costing Section in the Inventory Tools Settings document. As with all Inventory Tools Settings, these are set on a per-company basis.

![Screen shot of the Inventory Tools Settings document for Ambrosia Pie Company showing the Enable Landed Costing box checked.](./assets/inventory_tools_settings_inline_lc.png)

When the feature is on, the Purchase Receipt and Purchase Invoice documents will show an additional dropdown field called Distribute Landed Cost Charges Based On above the Items table. If there are no landed costs in the document, then the default Don't Distribute should remain selected. To include and distribute landed costs, the landed costs should be entered as row(s) into the Purchase Taxes and Charges table. The method to distribute landed costs may be based on the relative items' Qty or Amount.

![Screen shot of a Purchase Receipt showing Distribute Charges Based On selection of Amount. There's one row in the Purchase Taxes and Charges table for landed costs of $10.00. The items table has additional columns showing the split of the landed costs based on the item amounts.](./assets/inline_lc_pr_with_lc.png)

Note that including landed costs in an item's valuation only works when it is marked as an asset or stock item in its Item master.

The feature assumes all rows in the Purchase Taxes and Charges table should be included and distributed as landed costs. If there are any rows that should be excluded (such as sales tax or a discount), then the user can click on the Edit field for the row, and change the Consider Tax or Charge For field to "Total".

![Screen shot of the edit form for a row in the Purchase Taxes and Charges table where the Consider Tax or Charge For field dropdown selection is being changed from Valuation and Total to Total since that row is not a landed cost.](./assets/inline_lc_change_category_of_non_lc.png)


## Avoid Double-Counting Landed Costs in a Purchase Invoice

In the event that a user includes landed costs in a Purchase Receipt, then creates a Purchase Invoice from that document, some adjustments are necessary to make sure the landed costs from the Purchase Receipt aren't included a second time in the item's valuation in the Purchase Invoice.

Set the Distribute Landed Cost Charges Based On selection to Don't Distribute. This change will remove landed costs from the items since they're already included via the Purchase Receipt. Under the hood, it resets the Consider Tax or Charge For field for each row in the Purchase Taxes and Charges table to Total. If that value were Valuation and Total, it would flag the row's amount to be included in the items' valuation rates. If this change isn't made, then the landed costs would be included a second time in the item valuation rates via the Purchase Invoice, thus double-counting them.

Note that changing the selection in the Distribute Landed Cost Charges Based On field back to either Qty or Amount will update all rows in the Purchase Taxes and Charges table so they're included in item landed costs and flipping it back to Don't Distribute will excludes all rows from item landed costs.

![Screen shot of the Distribute Landed Cost Charges Based On drop down selection set to Don't Distribute.](./assets/inline_lc_dont_distribute.png)
1 change: 1 addition & 0 deletions inventory_tools/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"Work Order": "public/js/work_order_custom.js",
"Purchase Order": "public/js/purchase_order_custom.js",
"Purchase Invoice": "public/js/purchase_invoice_custom.js",
"Purchase Receipt": "public/js/purchase_receipt_custom.js",
"Stock Entry": "public/js/stock_entry_custom.js",
"Job Card": "public/js/job_card_custom.js",
"Operation": "public/js/operation_custom.js",
Expand Down
120 changes: 120 additions & 0 deletions inventory_tools/inventory_tools/custom/purchase_invoice.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,125 @@
{
"custom_fields": [
{
"_assign": null,
"_comments": null,
"_liked_by": null,
"_user_tags": null,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"collapsible_depends_on": null,
"columns": 0,
"creation": "2023-08-25 14:44:28.153477",
"default": "Don't Distribute",
"depends_on": null,
"description": null,
"docstatus": 0,
"dt": "Purchase Invoice",
"fetch_from": null,
"fetch_if_empty": 0,
"fieldname": "distribute_charges_based_on",
"fieldtype": "Select",
"hidden": 0,
"hide_border": 0,
"hide_days": 0,
"hide_seconds": 0,
"idx": 37,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_preview": 0,
"in_standard_filter": 0,
"insert_after": "scan_barcode",
"is_system_generated": 0,
"is_virtual": 0,
"label": "Distribute Landed Cost Charges Based On",
"length": 0,
"mandatory_depends_on": null,
"modified": "2023-08-25 14:44:28.153477",
"modified_by": "Administrator",
"module": "Inventory Tools",
"name": "Purchase Invoice-distribute_charges_based_on",
"no_copy": 0,
"non_negative": 0,
"options": "Don't Distribute\nQty\nAmount",
"owner": "Administrator",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"print_width": null,
"read_only": 0,
"read_only_depends_on": null,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"translatable": 1,
"unique": 0,
"width": null
},
{
"_assign": null,
"_comments": null,
"_liked_by": null,
"_user_tags": null,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"collapsible_depends_on": null,
"columns": 0,
"creation": "2023-08-25 14:44:28.612035",
"default": null,
"depends_on": null,
"description": null,
"docstatus": 0,
"dt": "Purchase Invoice",
"fetch_from": null,
"fetch_if_empty": 0,
"fieldname": "total_with_landed_costs",
"fieldtype": "Currency",
"hidden": 0,
"hide_border": 0,
"hide_days": 0,
"hide_seconds": 0,
"idx": 55,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_preview": 0,
"in_standard_filter": 0,
"insert_after": "total",
"is_system_generated": 0,
"is_virtual": 0,
"label": "Total with Landed Costs",
"length": 0,
"mandatory_depends_on": null,
"modified": "2023-08-25 14:44:28.612035",
"modified_by": "Administrator",
"module": "Inventory Tools",
"name": "Purchase Invoice-total_with_landed_costs",
"no_copy": 0,
"non_negative": 0,
"options": null,
"owner": "Administrator",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"print_width": null,
"read_only": 1,
"read_only_depends_on": null,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"translatable": 0,
"unique": 0,
"width": null
},
{
"_assign": null,
"_comments": null,
Expand Down
Loading
Loading