Skip to content

Commit

Permalink
fix: stock onboarding (backport #35453) (#35480)
Browse files Browse the repository at this point in the history
* fix: stock settings tour

- remove dead fields
- Keep only essential fields in tour

(cherry picked from commit 2e13fba)

# Conflicts:
#	erpnext/stock/doctype/stock_settings/stock_settings.json

* fix: hide ledger button on new warehouse

(cherry picked from commit 7a18db5)

* fix: warehouse form cleanup

- organize fields
- group transit fields and move them lower
- enable/disable should be button
- hide pointless fields from listview

(cherry picked from commit 40ce33d)

* fix: disable/enable with button

(cherry picked from commit 81e901b)

* fix: warehouse tour

- remove warehouse type, it doesn't do what it says. Misleading.

(cherry picked from commit aa9f926)

* fix: filter parent warehouses by company

(cherry picked from commit 3341cd6)

* fix: reorder stock reco tour

(cherry picked from commit dd245cc)

* fix: replace stock projected with ledger

Ledger is much more widely used report, better to show that first?

(cherry picked from commit 8fe8f80)

* chore: docs for stock settings

[skip ci]

(cherry picked from commit 964bb1d)

# Conflicts:
#	erpnext/stock/doctype/stock_settings/stock_settings.json

* chore: conflicts

---------

Co-authored-by: Ankush Menat <ankush@frappe.io>
  • Loading branch information
mergify[bot] and ankush authored May 30, 2023
1 parent 09d3a98 commit d231b19
Show file tree
Hide file tree
Showing 12 changed files with 176 additions and 122 deletions.
7 changes: 4 additions & 3 deletions erpnext/stock/doctype/stock_settings/stock_settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
"defaults_tab",
"item_defaults_section",
"item_naming_by",
"valuation_method",
"item_group",
"stock_uom",
"column_break_4",
"default_warehouse",
"sample_retention_warehouse",
"valuation_method",
"stock_uom",
"price_list_defaults_section",
"auto_insert_price_list_rate_if_missing",
"column_break_12",
Expand Down Expand Up @@ -96,6 +96,7 @@
"fieldtype": "Column Break"
},
{
"documentation_url": "https://docs.erpnext.com/docs/v14/user/manual/en/stock/articles/calculation-of-valuation-rate-in-fifo-and-moving-average",
"fieldname": "valuation_method",
"fieldtype": "Select",
"label": "Default Valuation Method",
Expand Down Expand Up @@ -346,7 +347,7 @@
"index_web_pages_for_search": 1,
"issingle": 1,
"links": [],
"modified": "2022-02-05 15:33:43.692736",
"modified": "2023-05-29 15:09:54.959411",
"modified_by": "Administrator",
"module": "Stock",
"name": "Stock Settings",
Expand Down
39 changes: 24 additions & 15 deletions erpnext/stock/doctype/warehouse/warehouse.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ frappe.ui.form.on("Warehouse", {
return {
filters: {
is_group: 1,
company: doc.company,
},
};
});
Expand All @@ -39,26 +40,34 @@ frappe.ui.form.on("Warehouse", {
!frm.doc.__islocal
);

if (!frm.doc.__islocal) {
if (!frm.is_new()) {
frappe.contacts.render_address_and_contact(frm);

let enable_toggle = frm.doc.disabled ? "Enable" : "Disable";
frm.add_custom_button(__(enable_toggle), () => {
frm.set_value('disabled', 1 - frm.doc.disabled);
frm.save()
});

frm.add_custom_button(__("Stock Balance"), function () {
frappe.set_route("query-report", "Stock Balance", {
warehouse: frm.doc.name,
});
});

frm.add_custom_button(
frm.doc.is_group
? __("Convert to Ledger", null, "Warehouse")
: __("Convert to Group", null, "Warehouse"),
function () {
convert_to_group_or_ledger(frm);
},
);

} else {
frappe.contacts.clear_address_and_contact(frm);
}

frm.add_custom_button(__("Stock Balance"), function () {
frappe.set_route("query-report", "Stock Balance", {
warehouse: frm.doc.name,
});
});

frm.add_custom_button(
frm.doc.is_group
? __("Convert to Ledger", null, "Warehouse")
: __("Convert to Group", null, "Warehouse"),
function () {
convert_to_group_or_ledger(frm);
},
);

if (!frm.doc.is_group && frm.doc.__onload && frm.doc.__onload.account) {
frm.add_custom_button(
Expand Down
30 changes: 20 additions & 10 deletions erpnext/stock/doctype/warehouse/warehouse.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
{
"actions": [],
"allow_import": 1,
"creation": "2013-03-07 18:50:32",
"creation": "2023-05-29 13:02:17.121296",
"description": "A logical Warehouse against which stock entries are made.",
"doctype": "DocType",
"document_type": "Setup",
"engine": "InnoDB",
"field_order": [
"warehouse_detail",
"disabled",
"warehouse_name",
"column_break_3",
"warehouse_type",
"parent_warehouse",
"default_in_transit_warehouse",
"is_group",
"parent_warehouse",
"column_break_4",
"account",
"company",
"disabled",
"address_and_contact",
"address_html",
"column_break_10",
Expand All @@ -32,6 +30,10 @@
"city",
"state",
"pin",
"transit_section",
"warehouse_type",
"column_break_qajx",
"default_in_transit_warehouse",
"tree_details",
"lft",
"rgt",
Expand All @@ -58,7 +60,7 @@
"fieldname": "is_group",
"fieldtype": "Check",
"in_list_view": 1,
"label": "Is Group"
"label": "Is Group Warehouse"
},
{
"fieldname": "company",
Expand All @@ -78,7 +80,7 @@
"default": "0",
"fieldname": "disabled",
"fieldtype": "Check",
"in_list_view": 1,
"hidden": 1,
"label": "Disabled"
},
{
Expand Down Expand Up @@ -164,7 +166,6 @@
{
"fieldname": "city",
"fieldtype": "Data",
"in_list_view": 1,
"label": "City",
"oldfieldname": "city",
"oldfieldtype": "Data"
Expand Down Expand Up @@ -238,13 +239,23 @@
"fieldtype": "Link",
"label": "Default In-Transit Warehouse",
"options": "Warehouse"
},
{
"collapsible": 1,
"fieldname": "transit_section",
"fieldtype": "Section Break",
"label": "Transit"
},
{
"fieldname": "column_break_qajx",
"fieldtype": "Column Break"
}
],
"icon": "fa fa-building",
"idx": 1,
"is_tree": 1,
"links": [],
"modified": "2022-03-01 02:37:48.034944",
"modified": "2023-05-29 13:10:43.333160",
"modified_by": "Administrator",
"module": "Stock",
"name": "Warehouse",
Expand All @@ -261,7 +272,6 @@
"read": 1,
"report": 1,
"role": "Item Manager",
"set_user_permissions": 1,
"share": 1,
"write": 1
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,54 +2,75 @@
"creation": "2021-08-24 14:44:46.770952",
"docstatus": 0,
"doctype": "Form Tour",
"first_document": 0,
"idx": 0,
"include_name_field": 0,
"is_standard": 1,
"modified": "2021-08-25 16:26:11.718664",
"list_name": "List",
"modified": "2023-05-29 13:38:27.192177",
"modified_by": "Administrator",
"module": "Stock",
"name": "Stock Reconciliation",
"new_document_form": 0,
"owner": "Administrator",
"reference_doctype": "Stock Reconciliation",
"save_on_complete": 1,
"steps": [
{
"description": "Set Purpose to Opening Stock to set the stock opening balance.",
"field": "",
"fieldname": "purpose",
"fieldtype": "Select",
"has_next_condition": 1,
"hide_buttons": 0,
"is_table_field": 0,
"label": "Purpose",
"modal_trigger": 0,
"next_on_click": 0,
"next_step_condition": "eval: doc.purpose === \"Opening Stock\"",
"parent_field": "",
"offset_x": 0,
"offset_y": 0,
"popover_element": 0,
"position": "Top",
"title": "Purpose"
"title": "Purpose",
"ui_tour": 0
},
{
"description": "Edit the Posting Date by clicking on the Edit Posting Date and Time checkbox below.",
"fieldname": "posting_date",
"fieldtype": "Date",
"has_next_condition": 0,
"hide_buttons": 0,
"is_table_field": 0,
"label": "Posting Date",
"modal_trigger": 0,
"next_on_click": 0,
"offset_x": 0,
"offset_y": 0,
"popover_element": 0,
"position": "Bottom",
"title": "Posting Date",
"ui_tour": 0
},
{
"description": "Select the items for which the opening stock has to be set.",
"field": "",
"fieldname": "items",
"fieldtype": "Table",
"has_next_condition": 1,
"hide_buttons": 0,
"is_table_field": 0,
"label": "Items",
"modal_trigger": 0,
"next_on_click": 0,
"next_step_condition": "eval: doc.items[0]?.item_code",
"parent_field": "",
"offset_x": 0,
"offset_y": 0,
"popover_element": 0,
"position": "Top",
"title": "Items"
},
{
"description": "Edit the Posting Date by clicking on the Edit Posting Date and Time checkbox below.",
"field": "",
"fieldname": "posting_date",
"fieldtype": "Date",
"has_next_condition": 0,
"is_table_field": 0,
"label": "Posting Date",
"parent_field": "",
"position": "Bottom",
"title": "Posting Date"
"title": "Items",
"ui_tour": 0
}
],
"title": "Stock Reconciliation"
"title": "Stock Reconciliation",
"track_steps": 0,
"ui_tour": 0
}
Loading

0 comments on commit d231b19

Please sign in to comment.