From 54b3a32968b8ab9a41fcdc1aa7d9c0aa937bd4c4 Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Tue, 25 Jan 2022 16:19:49 +0530 Subject: [PATCH 1/4] fix: get timezone in user_info --- cypress/integration/datetime.js | 1 + frappe/utils/__init__.py | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/cypress/integration/datetime.js b/cypress/integration/datetime.js index ef1952dc94..4a24faf40b 100644 --- a/cypress/integration/datetime.js +++ b/cypress/integration/datetime.js @@ -103,6 +103,7 @@ context('Control Date, Time and DateTime', () => { input_value: '12-02-2019 11:00' // admin timezone (Asia/Kolkata) } ]; + datetime_formats.forEach(d => { it(`test datetime format ${d.date_format} ${d.time_format}`, () => { cy.set_value('System Settings', 'System Settings', { diff --git a/frappe/utils/__init__.py b/frappe/utils/__init__.py index 351c0413ce..9deec0a77c 100644 --- a/frappe/utils/__init__.py +++ b/frappe/utils/__init__.py @@ -901,10 +901,11 @@ def dictify(arg): def add_user_info(user, user_info): if user not in user_info: info = frappe.db.get_value("User", - user, ["full_name", "user_image", "name", 'email'], as_dict=True) or frappe._dict() + user, ["full_name", "user_image", "name", 'email', 'time_zone'], as_dict=True) or frappe._dict() user_info[user] = frappe._dict( fullname = info.full_name or user, image = info.user_image, name = user, - email = info.email + email = info.email, + time_zone = info.time_zone ) From d78b49620863dec0975212f0d3e57fdd1698a96c Mon Sep 17 00:00:00 2001 From: gavin Date: Tue, 25 Jan 2022 16:44:34 +0530 Subject: [PATCH 2/4] fix(Custom DocPerm): Use Link type instead of Data for parent (#15715) * fix: Use Link type instead of Data for parent This makes sure frappe.rename_doc updates linked doctype records * Revert "fix: Use Link type instead of Data for parent" This reverts commit 93b37351069df9a79f04bfa326378f09bf97700f. * fix(rename_doc): Handle re-linking Custom DocPerm records --- frappe/model/rename_doc.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/frappe/model/rename_doc.py b/frappe/model/rename_doc.py index 2cc5818414..6ffaadc5eb 100644 --- a/frappe/model/rename_doc.py +++ b/frappe/model/rename_doc.py @@ -80,6 +80,7 @@ def rename_doc( if doctype=='DocType': rename_doctype(doctype, old, new, force) + update_customizations(old, new) update_attachments(doctype, old, new) @@ -174,6 +175,8 @@ def update_user_settings(old, new, link_fields): else: continue +def update_customizations(old: str, new: str) -> None: + frappe.db.set_value("Custom DocPerm", {"parent": old}, "parent", new, update_modified=False) def update_attachments(doctype, old, new): try: From 8ff0a3029dde273f29685ba845b761c39fcbec9f Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Tue, 25 Jan 2022 17:01:38 +0530 Subject: [PATCH 3/4] test: flaky timeline_email fix --- cypress/integration/timeline_email.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cypress/integration/timeline_email.js b/cypress/integration/timeline_email.js index 1b7634d211..5808bd52ef 100644 --- a/cypress/integration/timeline_email.js +++ b/cypress/integration/timeline_email.js @@ -14,7 +14,7 @@ context('Timeline Email', () => { cy.wait(700); }); - it('Adding email and verifying timeline content for email attachment, deleting attachment and ToDo', () => { + it('Adding email and verifying timeline content for email attachment', () => { cy.visit('/app/todo'); cy.get('.list-row > .level-left > .list-subject').eq(0).click(); @@ -43,7 +43,9 @@ context('Timeline Email', () => { cy.get('#page-Communication > .page-head > .container > .row > .col > .standard-actions > .menu-btn-group > .btn').click(); cy.get('#page-Communication > .page-head > .container > .row > .col > .standard-actions > .menu-btn-group > .dropdown-menu > li > .grey-link').eq(9).click(); cy.get('.modal.show > .modal-dialog > .modal-content > .modal-footer > .standard-actions > .btn-primary').click(); + }); + it('Deleting attachment and ToDo', () => { cy.visit('/app/todo'); cy.get('.list-row > .level-left > .list-subject > .level-item.ellipsis > .ellipsis').eq(0).click(); From 7eaeaab8d2dfbac07b68fa99870bda133d60ddfb Mon Sep 17 00:00:00 2001 From: Suraj Shetty Date: Tue, 25 Jan 2022 18:25:03 +0530 Subject: [PATCH 4/4] test: Remove focus to avoid double focus - Due to double focus barcode tests fails randomly ref: https://dashboard.cypress.io/projects/92odwv/runs/25831/overview/067a8ebf-eed7-4caa-9719-59cc1b7ce5bf/video --- cypress/integration/control_barcode.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/cypress/integration/control_barcode.js b/cypress/integration/control_barcode.js index 5f1ab86d41..03ab61fac4 100644 --- a/cypress/integration/control_barcode.js +++ b/cypress/integration/control_barcode.js @@ -21,7 +21,6 @@ context('Control Barcode', () => { get_dialog_with_barcode().as('dialog'); cy.get('.frappe-control[data-fieldname=barcode]').findByRole('textbox') - .focus() .type('123456789') .blur(); cy.get('.frappe-control[data-fieldname=barcode] svg[data-barcode-value="123456789"]') @@ -38,7 +37,6 @@ context('Control Barcode', () => { get_dialog_with_barcode().as('dialog'); cy.get('.frappe-control[data-fieldname=barcode]').findByRole('textbox') - .focus() .type('123456789') .blur(); cy.get('.frappe-control[data-fieldname=barcode]').findByRole('textbox')