fix(ux): keep stock entry title & purpose in sync (#27043)

Co-authored-by: rohitwaghchaure <rohitw1991@gmail.com>
This commit is contained in:
Ankush Menat 2021-08-24 12:20:34 +05:30 committed by GitHub
parent 6de7b8ea93
commit c09d8a2809
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 3 deletions

View File

@ -84,8 +84,6 @@
"oldfieldtype": "Section Break" "oldfieldtype": "Section Break"
}, },
{ {
"allow_on_submit": 1,
"default": "{purpose}",
"fieldname": "title", "fieldname": "title",
"fieldtype": "Data", "fieldtype": "Data",
"hidden": 1, "hidden": 1,
@ -630,7 +628,7 @@
"index_web_pages_for_search": 1, "index_web_pages_for_search": 1,
"is_submittable": 1, "is_submittable": 1,
"links": [], "links": [],
"modified": "2021-08-17 20:16:12.737743", "modified": "2021-08-20 19:19:31.514846",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Stock", "module": "Stock",
"name": "Stock Entry", "name": "Stock Entry",

View File

@ -58,6 +58,7 @@ class StockEntry(StockController):
self.validate_posting_time() self.validate_posting_time()
self.validate_purpose() self.validate_purpose()
self.set_title()
self.validate_item() self.validate_item()
self.validate_customer_provided_item() self.validate_customer_provided_item()
self.validate_qty() self.validate_qty()
@ -1608,6 +1609,14 @@ class StockEntry(StockController):
return sorted(list(set(get_serial_nos(self.pro_doc.serial_no)) - set(used_serial_nos))) return sorted(list(set(get_serial_nos(self.pro_doc.serial_no)) - set(used_serial_nos)))
def set_title(self):
if frappe.flags.in_import and self.title:
# Allow updating title during data import/update
return
self.title = self.purpose
@frappe.whitelist() @frappe.whitelist()
def move_sample_to_retention_warehouse(company, items): def move_sample_to_retention_warehouse(company, items):
if isinstance(items, string_types): if isinstance(items, string_types):