[hotfix] filter doctype if the doctype has subscription field (#11038)
This commit is contained in:
parent
5049edb494
commit
eaec4695f7
@ -3,6 +3,12 @@
|
|||||||
|
|
||||||
frappe.ui.form.on('Subscription', {
|
frappe.ui.form.on('Subscription', {
|
||||||
setup: function(frm) {
|
setup: function(frm) {
|
||||||
|
frm.fields_dict['reference_doctype'].get_query = function(doc) {
|
||||||
|
return {
|
||||||
|
query: "erpnext.accounts.doctype.subscription.subscription.subscription_doctype_query"
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
frm.fields_dict['reference_document'].get_query = function() {
|
frm.fields_dict['reference_document'].get_query = function() {
|
||||||
return {
|
return {
|
||||||
filters: {
|
filters: {
|
||||||
|
@ -276,4 +276,20 @@ def stop_resume_subscription(subscription, status):
|
|||||||
doc.update_status(status)
|
doc.update_status(status)
|
||||||
doc.save()
|
doc.save()
|
||||||
|
|
||||||
return doc.status
|
return doc.status
|
||||||
|
|
||||||
|
def subscription_doctype_query(doctype, txt, searchfield, start, page_len, filters):
|
||||||
|
return frappe.db.sql("""select parent from `tabDocField`
|
||||||
|
where fieldname = 'subscription'
|
||||||
|
and parent like %(txt)s
|
||||||
|
order by
|
||||||
|
if(locate(%(_txt)s, parent), locate(%(_txt)s, parent), 99999),
|
||||||
|
parent
|
||||||
|
limit %(start)s, %(page_len)s""".format(**{
|
||||||
|
'key': searchfield,
|
||||||
|
}), {
|
||||||
|
'txt': "%%%s%%" % txt,
|
||||||
|
'_txt': txt.replace("%", ""),
|
||||||
|
'start': start,
|
||||||
|
'page_len': page_len
|
||||||
|
})
|
Loading…
Reference in New Issue
Block a user