feat(stock): add company field to Bin with migration patch

This commit is contained in:
Praveenkumar26-S
2026-02-03 11:26:13 +05:30
parent dbbeca6308
commit d54259c99c
4 changed files with 28 additions and 2 deletions

View File

@@ -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

View File

@@ -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 = ''
"""
)

View File

@@ -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": []
}
}

View File

@@ -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