fix: Data too long for column 'serial_no' at row 1 (#40098)
diff --git a/erpnext/accounts/doctype/pos_invoice_item/pos_invoice_item.json b/erpnext/accounts/doctype/pos_invoice_item/pos_invoice_item.json
index ad2889d..b92579e 100644
--- a/erpnext/accounts/doctype/pos_invoice_item/pos_invoice_item.json
+++ b/erpnext/accounts/doctype/pos_invoice_item/pos_invoice_item.json
@@ -654,7 +654,7 @@
{
"depends_on": "eval:doc.use_serial_batch_fields === 1",
"fieldname": "serial_no",
- "fieldtype": "Small Text",
+ "fieldtype": "Text",
"hidden": 1,
"in_list_view": 1,
"label": "Serial No",
@@ -853,7 +853,7 @@
],
"istable": 1,
"links": [],
- "modified": "2024-02-04 16:36:25.665743",
+ "modified": "2024-02-25 15:50:17.140269",
"modified_by": "Administrator",
"module": "Accounts",
"name": "POS Invoice Item",
diff --git a/erpnext/accounts/doctype/pos_invoice_item/pos_invoice_item.py b/erpnext/accounts/doctype/pos_invoice_item/pos_invoice_item.py
index 55a577b..c24db1d 100644
--- a/erpnext/accounts/doctype/pos_invoice_item/pos_invoice_item.py
+++ b/erpnext/accounts/doctype/pos_invoice_item/pos_invoice_item.py
@@ -72,7 +72,7 @@
rate_with_margin: DF.Currency
sales_order: DF.Link | None
serial_and_batch_bundle: DF.Link | None
- serial_no: DF.SmallText | None
+ serial_no: DF.Text | None
service_end_date: DF.Date | None
service_start_date: DF.Date | None
service_stop_date: DF.Date | None
diff --git a/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json b/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json
index d06c786..e7536e9 100644
--- a/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json
+++ b/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json
@@ -625,7 +625,7 @@
{
"depends_on": "eval: doc.use_serial_batch_fields === 1 && parent.update_stock === 1",
"fieldname": "serial_no",
- "fieldtype": "Small Text",
+ "fieldtype": "Text",
"label": "Serial No",
"oldfieldname": "serial_no",
"oldfieldtype": "Small Text"
@@ -926,7 +926,7 @@
"idx": 1,
"istable": 1,
"links": [],
- "modified": "2024-02-04 11:52:16.106541",
+ "modified": "2024-02-25 15:56:44.828634",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Sales Invoice Item",
diff --git a/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.py b/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.py
index c71d08e..9be1b42 100644
--- a/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.py
+++ b/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.py
@@ -75,7 +75,7 @@
sales_invoice_item: DF.Data | None
sales_order: DF.Link | None
serial_and_batch_bundle: DF.Link | None
- serial_no: DF.SmallText | None
+ serial_no: DF.Text | None
service_end_date: DF.Date | None
service_start_date: DF.Date | None
service_stop_date: DF.Date | None
diff --git a/erpnext/assets/doctype/asset_capitalization_stock_item/asset_capitalization_stock_item.json b/erpnext/assets/doctype/asset_capitalization_stock_item/asset_capitalization_stock_item.json
index 8eda441..f79a848 100644
--- a/erpnext/assets/doctype/asset_capitalization_stock_item/asset_capitalization_stock_item.json
+++ b/erpnext/assets/doctype/asset_capitalization_stock_item/asset_capitalization_stock_item.json
@@ -107,7 +107,7 @@
{
"depends_on": "eval:doc.use_serial_batch_fields === 1",
"fieldname": "serial_no",
- "fieldtype": "Small Text",
+ "fieldtype": "Text",
"hidden": 1,
"label": "Serial No",
"print_hide": 1
@@ -178,7 +178,7 @@
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
- "modified": "2024-02-04 16:41:09.239762",
+ "modified": "2024-02-25 15:57:35.007501",
"modified_by": "Administrator",
"module": "Assets",
"name": "Asset Capitalization Stock Item",
diff --git a/erpnext/assets/doctype/asset_capitalization_stock_item/asset_capitalization_stock_item.py b/erpnext/assets/doctype/asset_capitalization_stock_item/asset_capitalization_stock_item.py
index d2b075c..0f06cc7 100644
--- a/erpnext/assets/doctype/asset_capitalization_stock_item/asset_capitalization_stock_item.py
+++ b/erpnext/assets/doctype/asset_capitalization_stock_item/asset_capitalization_stock_item.py
@@ -24,7 +24,7 @@
parentfield: DF.Data
parenttype: DF.Data
serial_and_batch_bundle: DF.Link | None
- serial_no: DF.SmallText | None
+ serial_no: DF.Text | None
stock_qty: DF.Float
stock_uom: DF.Link
use_serial_batch_fields: DF.Check
diff --git a/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py
index daa0166..d542601 100644
--- a/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py
+++ b/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py
@@ -2237,6 +2237,10 @@
create_stock_reconciliation,
)
+ frappe.db.set_single_value(
+ "Stock Settings", "do_not_update_serial_batch_on_creation_of_auto_bundle", 0
+ )
+
item_code = make_item(
"_Test Use Serial Fields Item Serial Item",
properties={"has_serial_no": 1, "serial_no_series": "SNU-TSFISI-.#####"},
@@ -2317,6 +2321,10 @@
serial_no_status = frappe.db.get_value("Serial No", sn, "status")
self.assertTrue(serial_no_status != "Active")
+ frappe.db.set_single_value(
+ "Stock Settings", "do_not_update_serial_batch_on_creation_of_auto_bundle", 1
+ )
+
def test_sle_qty_after_transaction(self):
item = make_item(
"_Test Item Qty After Transaction",
@@ -2416,7 +2424,9 @@
},
).name
- frappe.db.set_single_value("Stock Settings", "use_serial_batch_fields", 1)
+ frappe.db.set_single_value(
+ "Stock Settings", "do_not_update_serial_batch_on_creation_of_auto_bundle", 0
+ )
pr = make_purchase_receipt(
item_code=item_code,
@@ -2428,7 +2438,9 @@
batch_no = get_batch_from_bundle(pr.items[0].serial_and_batch_bundle)
self.assertEqual(pr.items[0].batch_no, batch_no)
- frappe.db.set_single_value("Stock Settings", "use_serial_batch_fields", 0)
+ frappe.db.set_single_value(
+ "Stock Settings", "do_not_update_serial_batch_on_creation_of_auto_bundle", 1
+ )
def prepare_data_for_internal_transfer():
diff --git a/erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.json b/erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.json
index c7b3daa..48fc31a 100644
--- a/erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.json
+++ b/erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.json
@@ -294,7 +294,7 @@
{
"depends_on": "eval:doc.use_serial_batch_fields === 1",
"fieldname": "serial_no",
- "fieldtype": "Small Text",
+ "fieldtype": "Text",
"label": "Serial No",
"no_copy": 1,
"oldfieldname": "serial_no",
@@ -610,7 +610,7 @@
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
- "modified": "2024-02-04 16:16:47.606270",
+ "modified": "2024-02-25 15:58:40.982582",
"modified_by": "Administrator",
"module": "Stock",
"name": "Stock Entry Detail",
diff --git a/erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.py b/erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.py
index 47c443c..bd3dda1 100644
--- a/erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.py
+++ b/erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.py
@@ -54,7 +54,7 @@
sample_quantity: DF.Int
sco_rm_detail: DF.Data | None
serial_and_batch_bundle: DF.Link | None
- serial_no: DF.SmallText | None
+ serial_no: DF.Text | None
set_basic_rate_manually: DF.Check
ste_detail: DF.Data | None
stock_uom: DF.Link
diff --git a/erpnext/stock/doctype/stock_settings/stock_settings.json b/erpnext/stock/doctype/stock_settings/stock_settings.json
index fb8089e..51036ad 100644
--- a/erpnext/stock/doctype/stock_settings/stock_settings.json
+++ b/erpnext/stock/doctype/stock_settings/stock_settings.json
@@ -51,6 +51,7 @@
"use_naming_series",
"naming_series_prefix",
"use_serial_batch_fields",
+ "do_not_update_serial_batch_on_creation_of_auto_bundle",
"stock_planning_tab",
"auto_material_request",
"auto_indent",
@@ -428,6 +429,14 @@
"fieldname": "use_serial_batch_fields",
"fieldtype": "Check",
"label": "Use Serial / Batch Fields"
+ },
+ {
+ "default": "1",
+ "depends_on": "use_serial_batch_fields",
+ "description": "If enabled, do not update serial / batch values in the stock transactions on creation of auto Serial \n / Batch Bundle. ",
+ "fieldname": "do_not_update_serial_batch_on_creation_of_auto_bundle",
+ "fieldtype": "Check",
+ "label": "Do Not Update Serial / Batch on Creation of Auto Bundle"
}
],
"icon": "icon-cog",
@@ -435,7 +444,7 @@
"index_web_pages_for_search": 1,
"issingle": 1,
"links": [],
- "modified": "2024-02-24 12:50:51.740097",
+ "modified": "2024-02-25 16:32:01.084453",
"modified_by": "Administrator",
"module": "Stock",
"name": "Stock Settings",
diff --git a/erpnext/stock/doctype/stock_settings/stock_settings.py b/erpnext/stock/doctype/stock_settings/stock_settings.py
index c4960aa..d975c29 100644
--- a/erpnext/stock/doctype/stock_settings/stock_settings.py
+++ b/erpnext/stock/doctype/stock_settings/stock_settings.py
@@ -39,6 +39,7 @@
clean_description_html: DF.Check
default_warehouse: DF.Link | None
disable_serial_no_and_batch_selector: DF.Check
+ do_not_update_serial_batch_on_creation_of_auto_bundle: DF.Check
enable_stock_reservation: DF.Check
item_group: DF.Link | None
item_naming_by: DF.Literal["Item Code", "Naming Series"]
diff --git a/erpnext/stock/serial_batch_bundle.py b/erpnext/stock/serial_batch_bundle.py
index 52c5b00..24dd9d1 100644
--- a/erpnext/stock/serial_batch_bundle.py
+++ b/erpnext/stock/serial_batch_bundle.py
@@ -142,7 +142,9 @@
"serial_and_batch_bundle": sn_doc.name,
}
- if frappe.db.get_single_value("Stock Settings", "use_serial_batch_fields"):
+ if not frappe.db.get_single_value(
+ "Stock Settings", "do_not_update_serial_batch_on_creation_of_auto_bundle"
+ ):
if sn_doc.has_serial_no:
values_to_update["serial_no"] = ",".join(cstr(d.serial_no) for d in sn_doc.entries)
elif sn_doc.has_batch_no and len(sn_doc.entries) == 1: