fix: Clean Serial No input on Server Side

This commit is contained in:
marination
2021-07-22 13:23:54 +05:30
parent 28d52c4a95
commit eecfc4c0ae
5 changed files with 18 additions and 3 deletions

View File

@@ -27,6 +27,7 @@ class StockController(AccountsController):
if not self.get('is_return'):
self.validate_inspection()
self.validate_serialized_batch()
self.clean_serial_nos()
self.validate_customer_provided_item()
self.set_rate_of_stock_uom()
self.validate_internal_transfer()
@@ -67,6 +68,12 @@ class StockController(AccountsController):
frappe.throw(_("Row #{0}: The batch {1} has already expired.")
.format(d.idx, get_link_to_form("Batch", d.get("batch_no"))))
def clean_serial_nos(self):
for row in self.get("items"):
if hasattr(row, "serial_no") and row.serial_no:
# replace commas by linefeed and remove all spaces in string
row.serial_no = row.serial_no.replace(",", "\n").replace(" ", "")
def get_gl_entries(self, warehouse_account=None, default_expense_account=None,
default_cost_center=None):