Fix route deferred insert

This commit is contained in:
Suraj Shetty 2018-10-08 20:47:43 +05:30
parent 4218b0f545
commit ee362fb36d
2 changed files with 9 additions and 5 deletions

View file

@ -1,5 +1,7 @@
import frappe
import json
import frappe
from frappe.utils import cstr
queue_prefix = 'insert_queue_for_'
@ -23,8 +25,10 @@ def save_to_db():
record_count += 1
insert_record(record, doctype)
frappe.db.commit()
def insert_record(record, doctype):
if not record['doctype']:
if not record.get('doctype'):
record['doctype'] = doctype
try:
doc = frappe.get_doc(record)
@ -33,10 +37,10 @@ def insert_record(record, doctype):
print(e, doctype)
def get_key_name(key):
return key.split('|')[1]
return cstr(key).split('|')[1]
def get_doctype_name(key):
return key.split(queue_prefix)[1]
return cstr(key).split(queue_prefix)[1]
# def save_to_db(doctype):

View file

@ -53,7 +53,7 @@ frappe.route = function() {
return;
}
if (route[1] && routes_to_skip.includes(route[0])) {
if (route[1] && !routes_to_skip.includes(route[0])) {
frappe.route_history_queue.push({
'user': frappe.session.user,
'creation': frappe.datetime.now_datetime(),