diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 3fdd00237e7..e3235379127 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -461,3 +461,4 @@ erpnext.patches.v15_0.create_accounting_dimensions_in_advance_taxes_and_charges execute:frappe.delete_doc_if_exists("Workspace Sidebar", "Opening & Closing") erpnext.patches.v16_0.migrate_transaction_deletion_task_flags_to_status # 2 erpnext.patches.v16_0.set_ordered_qty_in_quotation_item +erpnext.patches.v16_0.update_company_custom_field_in_bin \ No newline at end of file diff --git a/erpnext/patches/v16_0/update_company_custom_field_in_bin.py b/erpnext/patches/v16_0/update_company_custom_field_in_bin.py new file mode 100644 index 00000000000..e0b36d91fd7 --- /dev/null +++ b/erpnext/patches/v16_0/update_company_custom_field_in_bin.py @@ -0,0 +1,14 @@ +import frappe + + +def execute(): + frappe.reload_doc("stock", "doctype", "bin") + + frappe.db.sql( + """ + UPDATE `tabBin` b + INNER JOIN `tabWarehouse` w ON b.warehouse = w.name + SET b.company = w.company + WHERE b.company IS NULL OR b.company = '' + """ + ) diff --git a/erpnext/stock/doctype/bin/bin.json b/erpnext/stock/doctype/bin/bin.json index 7de1aa9d189..b0668896597 100644 --- a/erpnext/stock/doctype/bin/bin.json +++ b/erpnext/stock/doctype/bin/bin.json @@ -22,6 +22,7 @@ "reserved_stock", "section_break_pmrs", "stock_uom", + "company", "column_break_0slj", "valuation_rate", "stock_value" @@ -132,6 +133,14 @@ "options": "UOM", "read_only": 1 }, + { + "fetch_from": "warehouse.company", + "fieldname": "company", + "fieldtype": "Link", + "label": "Company", + "options": "Company", + "read_only": 1 + }, { "fieldname": "valuation_rate", "fieldtype": "Float", @@ -186,7 +195,7 @@ "idx": 1, "in_create": 1, "links": [], - "modified": "2024-03-27 13:06:39.414036", + "modified": "2026-02-01 08:11:46.824913", "modified_by": "Administrator", "module": "Stock", "name": "Bin", @@ -231,8 +240,9 @@ } ], "quick_entry": 1, + "row_format": "Dynamic", "search_fields": "item_code,warehouse", "sort_field": "creation", "sort_order": "ASC", "states": [] -} \ No newline at end of file +} diff --git a/erpnext/stock/doctype/bin/bin.py b/erpnext/stock/doctype/bin/bin.py index 62c4528f432..ae1c44d6419 100644 --- a/erpnext/stock/doctype/bin/bin.py +++ b/erpnext/stock/doctype/bin/bin.py @@ -19,6 +19,7 @@ class Bin(Document): from frappe.types import DF actual_qty: DF.Float + company: DF.Link | None indented_qty: DF.Float item_code: DF.Link ordered_qty: DF.Float