From 08e5aa6afea01472c8709cb738516cdbbd2e8dc8 Mon Sep 17 00:00:00 2001 From: Suraj Shetty Date: Thu, 14 Oct 2021 09:55:14 +0530 Subject: [PATCH 1/4] revert: Override app link click to avoid page reload This PR reverts unnecessary change made in https://github.com/frappe/frappe/pull/14394 --- frappe/public/js/frappe/router.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/frappe/public/js/frappe/router.js b/frappe/public/js/frappe/router.js index 349eadffb0..cf132c82ea 100644 --- a/frappe/public/js/frappe/router.js +++ b/frappe/public/js/frappe/router.js @@ -56,6 +56,11 @@ $('body').on('click', 'a', function(e) { return override(e.currentTarget.hash); } + if (frappe.router.is_app_route(e.currentTarget.pathname)) { + // target has "/app, this is a v2 style route. + return override(e.currentTarget.pathname + e.currentTarget.hash); + } + }); frappe.router = { From 22ffe27217d25a7392cc9cfd0f1517719c048112 Mon Sep 17 00:00:00 2001 From: Suraj Shetty Date: Thu, 14 Oct 2021 11:00:46 +0530 Subject: [PATCH 2/4] fix: Permission check for default print format --- frappe/printing/doctype/print_format/print_format.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frappe/printing/doctype/print_format/print_format.js b/frappe/printing/doctype/print_format/print_format.js index adc5e2363c..7b7009dbaf 100644 --- a/frappe/printing/doctype/print_format/print_format.js +++ b/frappe/printing/doctype/print_format/print_format.js @@ -36,7 +36,7 @@ frappe.ui.form.on("Print Format", { else if (frm.doc.custom_format && !frm.doc.raw_printing) { frm.set_df_property("html", "reqd", 1); } - if (frappe.perm.has_perm('DocType', 0, 'read', frm.doc.doc_type)) { + if (frappe.model.can_read(frm.doc.doc_type)) { frappe.db.get_value('DocType', frm.doc.doc_type, 'default_print_format', (r) => { if (r.default_print_format != frm.doc.name) { frm.add_custom_button(__("Set as Default"), function () { From c6542749cdfc715d70785dfc0631566b60caf218 Mon Sep 17 00:00:00 2001 From: Aradhya-Tripathi Date: Thu, 14 Oct 2021 14:55:16 +0530 Subject: [PATCH 3/4] feat: prepending tab to table name for UPDATE and INSERT --- frappe/query_builder/builder.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/frappe/query_builder/builder.py b/frappe/query_builder/builder.py index 5060331914..630cfea222 100644 --- a/frappe/query_builder/builder.py +++ b/frappe/query_builder/builder.py @@ -28,6 +28,17 @@ class MariaDB(Base, MySQLQuery): table = cls.DocType(table) return super().from_(table, *args, **kwargs) + @classmethod + def into(cls, table, *args, **kwargs): + if isinstance(table, str): + table = cls.DocType(table) + return super().into(table, *args, **kwargs) + + @classmethod + def update(cls, table, *args, **kwargs): + if isinstance(table, str): + table = cls.DocType(table) + return super().update(table, *args, **kwargs) class Postgres(Base, PostgreSQLQuery): field_translation = {"table_name": "relname", "table_rows": "n_tup_ins"} @@ -58,3 +69,15 @@ class Postgres(Base, PostgreSQLQuery): table = cls.DocType(table) return super().from_(table, *args, **kwargs) + + @classmethod + def into(cls, table, *args, **kwargs): + if isinstance(table, str): + table = cls.DocType(table) + return super().into(table, *args, **kwargs) + + @classmethod + def update(cls, table, *args, **kwargs): + if isinstance(table, str): + table = cls.DocType(table) + return super().update(table, *args, **kwargs) \ No newline at end of file From ac5bf003cc80354e378872894532d96dfa7b371f Mon Sep 17 00:00:00 2001 From: gavin Date: Thu, 14 Oct 2021 16:05:18 +0530 Subject: [PATCH 4/4] chore: Update CODEOWNERS --- CODEOWNERS | 1 + 1 file changed, 1 insertion(+) diff --git a/CODEOWNERS b/CODEOWNERS index 30cdb4d64d..69ca578b6c 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -15,5 +15,6 @@ core/ @surajshetty3416 database @gavindsouza model @gavindsouza requirements.txt @gavindsouza +query_builder/ @gavindsouza commands/ @gavindsouza workspace @shariquerik