mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-02 11:49:10 +00:00
[Fix] POS customer field is hang while searching customer, make error log if sync has failed (#10607)
This commit is contained in:
committed by
Makarand Bauskar
parent
3c635e219e
commit
56e31d05e9
@@ -320,8 +320,7 @@ def make_invoice(doc_list={}, email_queue_list={}, customers_list={}):
|
|||||||
si_doc.set_posting_time = 1
|
si_doc.set_posting_time = 1
|
||||||
si_doc.customer = get_customer_id(doc)
|
si_doc.customer = get_customer_id(doc)
|
||||||
si_doc.due_date = doc.get('posting_date')
|
si_doc.due_date = doc.get('posting_date')
|
||||||
submit_invoice(si_doc, name, doc)
|
name_list = submit_invoice(si_doc, name, doc, name_list)
|
||||||
name_list.append(name)
|
|
||||||
else:
|
else:
|
||||||
name_list.append(name)
|
name_list.append(name)
|
||||||
|
|
||||||
@@ -475,19 +474,29 @@ def validate_item(doc):
|
|||||||
frappe.db.commit()
|
frappe.db.commit()
|
||||||
|
|
||||||
|
|
||||||
def submit_invoice(si_doc, name, doc):
|
def submit_invoice(si_doc, name, doc, name_list):
|
||||||
try:
|
try:
|
||||||
si_doc.insert()
|
si_doc.insert()
|
||||||
si_doc.submit()
|
si_doc.submit()
|
||||||
frappe.db.commit()
|
frappe.db.commit()
|
||||||
|
name_list.append(name)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
if frappe.message_log: frappe.message_log.pop()
|
if frappe.message_log: frappe.message_log.pop()
|
||||||
frappe.db.rollback()
|
frappe.db.rollback()
|
||||||
save_invoice(e, si_doc, name)
|
frappe.log_error(frappe.get_traceback())
|
||||||
|
name_list = save_invoice(e, si_doc, name, name_list)
|
||||||
|
|
||||||
def save_invoice(e, si_doc, name):
|
return name_list
|
||||||
if not frappe.db.exists('Sales Invoice', {'offline_pos_name': name}):
|
|
||||||
si_doc.docstatus = 0
|
def save_invoice(e, si_doc, name, name_list):
|
||||||
si_doc.flags.ignore_mandatory = True
|
try:
|
||||||
si_doc.due_date = si_doc.posting_date
|
if not frappe.db.exists('Sales Invoice', {'offline_pos_name': name}):
|
||||||
si_doc.insert()
|
si_doc.docstatus = 0
|
||||||
|
si_doc.flags.ignore_mandatory = True
|
||||||
|
si_doc.due_date = si_doc.posting_date
|
||||||
|
si_doc.insert()
|
||||||
|
name_list.append(name)
|
||||||
|
except Exception:
|
||||||
|
frappe.log_error(frappe.get_traceback())
|
||||||
|
|
||||||
|
return name_list
|
||||||
|
|||||||
@@ -732,14 +732,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
|||||||
|
|
||||||
input = input.toLowerCase();
|
input = input.toLowerCase();
|
||||||
item = this.get_item(item.value);
|
item = this.get_item(item.value);
|
||||||
var searchtext =
|
return item.searchtext.includes(input)
|
||||||
Object.keys(item)
|
|
||||||
.filter(key => ['customer_name', 'customer_group', 'value', 'label', 'email_id', 'phone', 'mobile_no'].includes(key))
|
|
||||||
.map(key => item[key])
|
|
||||||
.join(" ")
|
|
||||||
.toLowerCase();
|
|
||||||
|
|
||||||
return searchtext.includes(input)
|
|
||||||
},
|
},
|
||||||
item: function (item, input) {
|
item: function (item, input) {
|
||||||
var d = this.get_item(item.value);
|
var d = this.get_item(item.value);
|
||||||
@@ -813,7 +806,11 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
|||||||
territory: c.territory,
|
territory: c.territory,
|
||||||
phone: contact ? contact["phone"] : '',
|
phone: contact ? contact["phone"] : '',
|
||||||
mobile_no: contact ? contact["mobile_no"] : '',
|
mobile_no: contact ? contact["mobile_no"] : '',
|
||||||
email_id: contact ? contact["email_id"] : ''
|
email_id: contact ? contact["email_id"] : '',
|
||||||
|
searchtext: ['customer_name', 'customer_group', 'value',
|
||||||
|
'label', 'email_id', 'phone', 'mobile_no']
|
||||||
|
.map(key => c[key]).join(' ')
|
||||||
|
.toLowerCase()
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user