Merge branch 'develop' into re-delete-after-deleting-dependent-doc
This commit is contained in:
commit
51fe34006b
19 changed files with 82 additions and 104 deletions
|
|
@ -42,14 +42,14 @@ context("Control Icon", () => {
|
|||
|
||||
it("search for icon and clear search input", () => {
|
||||
let search_text = "ed";
|
||||
cy.get(".icon-picker").findByRole("searchbox").click().type(search_text);
|
||||
cy.get(".icon-picker").get(".search-icons > input").click().type(search_text);
|
||||
cy.get(".icon-section .icon-wrapper:not(.hidden)").then((i) => {
|
||||
cy.get(`.icon-section .icon-wrapper[id*='${search_text}']`).then((icons) => {
|
||||
expect(i.length).to.equal(icons.length);
|
||||
});
|
||||
});
|
||||
|
||||
cy.get(".icon-picker").findByRole("searchbox").clear().blur();
|
||||
cy.get(".icon-picker").get(".search-icons > input").clear().blur();
|
||||
cy.get(".icon-section .icon-wrapper").should("not.have.class", "hidden");
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -133,8 +133,7 @@ context("Control Link", () => {
|
|||
true
|
||||
);
|
||||
|
||||
cy.clear_cache();
|
||||
cy.wait(500);
|
||||
cy.reload();
|
||||
|
||||
get_dialog_with_link().as("dialog");
|
||||
cy.window()
|
||||
|
|
@ -177,7 +176,7 @@ context("Control Link", () => {
|
|||
cy.intercept("POST", "/api/method/frappe.client.validate_link").as("validate_link");
|
||||
|
||||
cy.get(".frappe-control[data-fieldname=assigned_by] input").focus().as("input");
|
||||
cy.get("@input").type(cy.config("testUser"), { delay: 100 }).blur();
|
||||
cy.get("@input").clear().type(cy.config("testUser"), { delay: 300 }).blur();
|
||||
cy.wait("@validate_link");
|
||||
cy.get(".frappe-control[data-fieldname=assigned_by_full_name] .control-value").should(
|
||||
"contain",
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ context("Control Phone", () => {
|
|||
it("case insensitive search for country and clear search", () => {
|
||||
let search_text = "india";
|
||||
cy.get(".selected-phone").click().first();
|
||||
cy.get(".phone-picker").findByRole("searchbox").click().type(search_text);
|
||||
cy.get(".phone-picker").get(".search-phones").click().type(search_text);
|
||||
cy.get(".phone-section .phone-wrapper:not(.hidden)").then((i) => {
|
||||
cy.get(`.phone-section .phone-wrapper[id*="${search_text.toLowerCase()}"]`).then(
|
||||
(countries) => {
|
||||
|
|
@ -56,7 +56,7 @@ context("Control Phone", () => {
|
|||
);
|
||||
});
|
||||
|
||||
cy.get(".phone-picker").findByRole("searchbox").clear().blur();
|
||||
cy.get(".phone-picker").get(".search-phones").clear();
|
||||
cy.get(".phone-section .phone-wrapper").should("not.have.class", "hidden");
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -11,9 +11,9 @@ context("Folder Navigation", () => {
|
|||
cy.click_filter_button();
|
||||
cy.get(".filter-action-buttons > .text-muted").findByText("+ Add a Filter").click();
|
||||
cy.get(".fieldname-select-area > .awesomplete > .form-control:last").type("Fol{enter}");
|
||||
cy.get(
|
||||
".filter-field > .form-group > .link-field > .awesomplete > .input-with-feedback"
|
||||
).type("Home{enter}");
|
||||
cy.get(".filter-field > .form-group > .link-field > .awesomplete > .input-with-feedback")
|
||||
.first()
|
||||
.type("Home{enter}");
|
||||
cy.get(".filter-action-buttons > div > .btn-primary").findByText("Apply Filters").click();
|
||||
|
||||
//Adding folder (Test Folder)
|
||||
|
|
@ -24,6 +24,7 @@ context("Folder Navigation", () => {
|
|||
|
||||
it("Navigating the nested folders, checking if the URL formed is correct, checking if the added content in the child folder is correct", () => {
|
||||
//Navigating inside the Attachments folder
|
||||
cy.clear_filters();
|
||||
cy.wait(500);
|
||||
cy.get('[title="Attachments"] > span').click();
|
||||
|
||||
|
|
|
|||
|
|
@ -100,15 +100,15 @@ context("Kanban Board", () => {
|
|||
it("Checks if Kanban Board edits are blocked for non-System Manager and non-owner of the Board", () => {
|
||||
cy.switch_to_user("Administrator");
|
||||
|
||||
const noSystemManager = "nosysmanager@example.com";
|
||||
const not_system_manager = "nosysmanager@example.com";
|
||||
cy.call("frappe.tests.ui_test_helpers.create_test_user", {
|
||||
username: noSystemManager,
|
||||
username: not_system_manager,
|
||||
});
|
||||
cy.remove_role(noSystemManager, "System Manager");
|
||||
cy.remove_role(not_system_manager, "System Manager");
|
||||
cy.call("frappe.tests.ui_test_helpers.create_todo", { description: "Frappe User ToDo" });
|
||||
cy.call("frappe.tests.ui_test_helpers.create_admin_kanban");
|
||||
|
||||
cy.switch_to_user(noSystemManager);
|
||||
cy.switch_to_user(not_system_manager);
|
||||
|
||||
cy.visit("/app/todo/view/kanban/Admin Kanban");
|
||||
|
||||
|
|
@ -125,7 +125,7 @@ context("Kanban Board", () => {
|
|||
cy.get(".kanban .column-options").should("have.length", 0);
|
||||
|
||||
cy.switch_to_user("Administrator");
|
||||
cy.call("frappe.client.delete", { doctype: "User", name: noSystemManager });
|
||||
cy.call("frappe.client.delete", { doctype: "User", name: not_system_manager });
|
||||
});
|
||||
|
||||
after(() => {
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ Cypress.Commands.add("login", (email, password) => {
|
|||
if (!password) {
|
||||
password = Cypress.env("adminPassword");
|
||||
}
|
||||
cy.request({
|
||||
return cy.request({
|
||||
url: "/api/method/login",
|
||||
method: "POST",
|
||||
body: {
|
||||
|
|
@ -373,7 +373,9 @@ Cypress.Commands.add("update_doc", (doctype, docname, args) => {
|
|||
|
||||
Cypress.Commands.add("switch_to_user", (user) => {
|
||||
cy.call("logout");
|
||||
cy.wait(200);
|
||||
cy.login(user);
|
||||
cy.reload();
|
||||
});
|
||||
|
||||
Cypress.Commands.add("add_role", (user, role) => {
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ execute()
|
|||
.then(() => RUN_BUILD_COMMAND && run_build_command_for_apps(APPS))
|
||||
.catch((e) => {
|
||||
console.error(e);
|
||||
throw e;
|
||||
process.exit(1);
|
||||
});
|
||||
|
||||
if (WATCH_MODE) {
|
||||
|
|
|
|||
|
|
@ -67,7 +67,8 @@
|
|||
"default": "0",
|
||||
"fieldname": "everyone",
|
||||
"fieldtype": "Check",
|
||||
"label": "Everyone"
|
||||
"label": "Everyone",
|
||||
"search_index": 1
|
||||
},
|
||||
{
|
||||
"default": "1",
|
||||
|
|
@ -85,10 +86,11 @@
|
|||
],
|
||||
"in_create": 1,
|
||||
"links": [],
|
||||
"modified": "2021-04-04 11:38:50.813312",
|
||||
"modified": "2023-06-15 18:02:51.877533",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Core",
|
||||
"name": "DocShare",
|
||||
"naming_rule": "Random",
|
||||
"owner": "Administrator",
|
||||
"permissions": [
|
||||
{
|
||||
|
|
@ -106,5 +108,6 @@
|
|||
"read_only": 1,
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
"states": [],
|
||||
"track_changes": 1
|
||||
}
|
||||
|
|
@ -23,70 +23,6 @@ class Translation(Document):
|
|||
def on_trash(self):
|
||||
clear_user_translation_cache(self.language)
|
||||
|
||||
def contribute(self):
|
||||
pass
|
||||
|
||||
def get_contribution_status(self):
|
||||
pass
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def create_translations(translation_map, language):
|
||||
from frappe.frappeclient import FrappeClient
|
||||
|
||||
translation_map = json.loads(translation_map)
|
||||
translation_map_to_send = frappe._dict({})
|
||||
# first create / update local user translations
|
||||
for source_id, translation_dict in translation_map.items():
|
||||
translation_dict = frappe._dict(translation_dict)
|
||||
existing_doc_name = frappe.get_all(
|
||||
"Translation",
|
||||
{
|
||||
"source_text": translation_dict.source_text,
|
||||
"context": translation_dict.context or "",
|
||||
"language": language,
|
||||
},
|
||||
)
|
||||
translation_map_to_send[source_id] = translation_dict
|
||||
if existing_doc_name:
|
||||
frappe.db.set_value(
|
||||
"Translation",
|
||||
existing_doc_name[0].name,
|
||||
{
|
||||
"translated_text": translation_dict.translated_text,
|
||||
"contributed": 1,
|
||||
"contribution_status": "Pending",
|
||||
},
|
||||
)
|
||||
translation_map_to_send[source_id].name = existing_doc_name[0].name
|
||||
else:
|
||||
doc = frappe.get_doc(
|
||||
{
|
||||
"doctype": "Translation",
|
||||
"source_text": translation_dict.source_text,
|
||||
"contributed": 1,
|
||||
"contribution_status": "Pending",
|
||||
"translated_text": translation_dict.translated_text,
|
||||
"context": translation_dict.context,
|
||||
"language": language,
|
||||
}
|
||||
)
|
||||
doc.insert()
|
||||
translation_map_to_send[source_id].name = doc.name
|
||||
|
||||
params = {
|
||||
"language": language,
|
||||
"contributor_email": frappe.session.user,
|
||||
"contributor_name": frappe.utils.get_fullname(frappe.session.user),
|
||||
"translation_map": json.dumps(translation_map_to_send),
|
||||
}
|
||||
|
||||
translator = FrappeClient(get_translator_url())
|
||||
added_translations = translator.post_api("translator.api.add_translations", params=params)
|
||||
|
||||
for local_docname, remote_docname in added_translations.items():
|
||||
frappe.db.set_value("Translation", local_docname, "contribution_docname", remote_docname)
|
||||
|
||||
|
||||
def clear_user_translation_cache(lang):
|
||||
frappe.cache.hdel(USER_TRANSLATION_KEY, lang)
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ from frappe.query_builder.functions import Count
|
|||
from frappe.utils import CallbackManager
|
||||
from frappe.utils import cast as cast_fieldtype
|
||||
from frappe.utils import cint, get_datetime, get_table_name, getdate, now, sbool
|
||||
from frappe.utils.deprecations import deprecation_warning
|
||||
|
||||
IFNULL_PATTERN = re.compile(r"ifnull\(", flags=re.IGNORECASE)
|
||||
INDEX_PATTERN = re.compile(r"\s*\([^)]+\)\s*")
|
||||
|
|
@ -888,6 +889,22 @@ class Database:
|
|||
:param update_modified: default True. Set as false, if you don't want to update the timestamp.
|
||||
:param debug: Print the query in the developer / js console.
|
||||
"""
|
||||
from frappe.model.utils import is_single_doctype
|
||||
|
||||
if (dn is None or dt == dn) and is_single_doctype(dt):
|
||||
deprecation_warning(
|
||||
"Calling db.set_value on single doctype is deprecated. This behaviour will be removed in future. Use db.set_single_value instead."
|
||||
)
|
||||
self.set_single_value(
|
||||
doctype=dt,
|
||||
fieldname=field,
|
||||
value=val,
|
||||
debug=debug,
|
||||
update_modified=update_modified,
|
||||
modified=modified,
|
||||
modified_by=modified_by,
|
||||
)
|
||||
return
|
||||
|
||||
to_update = self._get_update_dict(
|
||||
field, val, modified=modified, modified_by=modified_by, update_modified=update_modified
|
||||
|
|
|
|||
|
|
@ -29,7 +29,8 @@
|
|||
"fieldtype": "Link",
|
||||
"hidden": 1,
|
||||
"label": "For User",
|
||||
"options": "User"
|
||||
"options": "User",
|
||||
"search_index": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "type",
|
||||
|
|
@ -64,8 +65,7 @@
|
|||
"fieldtype": "Link",
|
||||
"hidden": 1,
|
||||
"label": "From User",
|
||||
"options": "User",
|
||||
"search_index": 1
|
||||
"options": "User"
|
||||
},
|
||||
{
|
||||
"default": "0",
|
||||
|
|
@ -96,7 +96,7 @@
|
|||
"hide_toolbar": 1,
|
||||
"in_create": 1,
|
||||
"links": [],
|
||||
"modified": "2022-09-13 16:08:48.153934",
|
||||
"modified": "2023-06-14 21:20:51.197943",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Desk",
|
||||
"name": "Notification Log",
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ ASSET_KEYS = (
|
|||
|
||||
def get_meta(doctype, cached=True) -> "FormMeta":
|
||||
# don't cache for developer mode as js files, templates may be edited
|
||||
cached = cached and not frappe._dev_server
|
||||
cached = cached and not frappe.conf.developer_mode
|
||||
if cached:
|
||||
meta = frappe.cache.hget("doctype_form_meta", doctype)
|
||||
if not meta:
|
||||
|
|
|
|||
|
|
@ -133,3 +133,13 @@ def is_virtual_doctype(doctype: str):
|
|||
if frappe.db.has_column("DocType", "is_virtual"):
|
||||
return frappe.db.get_value("DocType", doctype, "is_virtual")
|
||||
return False
|
||||
|
||||
|
||||
@site_cache()
|
||||
def is_single_doctype(doctype: str) -> bool:
|
||||
from frappe.model.base_document import DOCTYPES_FOR_DOCTYPE
|
||||
|
||||
if doctype in DOCTYPES_FOR_DOCTYPE:
|
||||
return False
|
||||
|
||||
return frappe.db.get_value("DocType", doctype, "issingle")
|
||||
|
|
|
|||
|
|
@ -84,13 +84,15 @@
|
|||
</symbol>
|
||||
|
||||
<symbol viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg" id="icon-arrow-up-right">
|
||||
<path d="M2.5 9.5L9.5 2.5" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<path d="M9.50002 8V2.5H4.00002" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<path d="M2.5 9.5L9.5 2.5M9.50002 8V2.5H4.00002" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
</symbol>
|
||||
|
||||
<symbol viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg" id="icon-arrow-down-left">
|
||||
<path d="M9.5 2.5L2.5 9.5" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<path d="M2.49999 4L2.49998 9.5L7.99998 9.5" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<path d="M9.5 2.5L2.5 9.5M2.49999 4L2.49998 9.5L7.99998 9.5" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
</symbol>
|
||||
|
||||
<symbol viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg" id="icon-arrow-down-right">
|
||||
<path d="M2.5 2.5L9.5 9.5M4 9.5h5.5v-5.5" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
</symbol>
|
||||
|
||||
<symbol viewBox="0 0 12 12" xmlns="http://www.w3.org/2000/svg" id="icon-expand">
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 113 KiB After Width: | Height: | Size: 113 KiB |
|
|
@ -267,15 +267,17 @@ frappe.ui.form.ControlLink = class ControlLink extends frappe.ui.form.ControlDat
|
|||
r.results = me.merge_duplicates(r.results);
|
||||
|
||||
// show filter description in awesomplete
|
||||
if (args.filters) {
|
||||
let filter_string = me.get_filter_description(args.filters);
|
||||
if (filter_string) {
|
||||
r.results.push({
|
||||
html: `<span class="text-muted" style="line-height: 1.5">${filter_string}</span>`,
|
||||
value: "",
|
||||
action: () => {},
|
||||
});
|
||||
}
|
||||
let filter_string = me.df.filter_description
|
||||
? me.df.filter_description
|
||||
: args.filters
|
||||
? me.get_filter_description(args.filters)
|
||||
: null;
|
||||
if (filter_string) {
|
||||
r.results.push({
|
||||
html: `<span class="text-muted" style="line-height: 1.5">${filter_string}</span>`,
|
||||
value: "",
|
||||
action: () => {},
|
||||
});
|
||||
}
|
||||
|
||||
if (!me.df.only_select) {
|
||||
|
|
|
|||
|
|
@ -163,7 +163,8 @@ $.extend(frappe.model, {
|
|||
|
||||
if (!user_default) {
|
||||
user_default = frappe.defaults.get_user_default(df.fieldname);
|
||||
} else if (
|
||||
}
|
||||
if (
|
||||
!user_default &&
|
||||
df.remember_last_selected_value &&
|
||||
frappe.boot.user.last_selected_values
|
||||
|
|
|
|||
|
|
@ -238,7 +238,7 @@ export default class NumberCardWidget extends Widget {
|
|||
color_class = "green-stat";
|
||||
} else {
|
||||
caret_html = `<span class="indicator-pill-round red">
|
||||
${frappe.utils.icon("arrow-down-left", "xs")}
|
||||
${frappe.utils.icon("arrow-down-right", "xs")}
|
||||
</span>`;
|
||||
color_class = "red-stat";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -161,7 +161,7 @@ def get_shared(doctype, user=None, rights=None):
|
|||
or_filters += [["everyone", "=", 1]]
|
||||
|
||||
shared_docs = frappe.get_all(
|
||||
"DocShare", fields=["share_name"], filters=filters, or_filters=or_filters
|
||||
"DocShare", fields=["share_name"], filters=filters, or_filters=or_filters, order_by=None
|
||||
)
|
||||
|
||||
return [doc.share_name for doc in shared_docs]
|
||||
|
|
|
|||
|
|
@ -718,6 +718,11 @@ class TestDBSetValue(FrappeTestCase):
|
|||
updated_value = frappe.db.get_value("ToDo", self.todo1.name, "description")
|
||||
self.assertEqual(updated_value, "test_set_value change 1")
|
||||
|
||||
@patch("frappe.db.set_single_value")
|
||||
def test_set_single_value_with_set_value(self, single_set):
|
||||
frappe.db.set_value("Contact Us Settings", None, "country", "India")
|
||||
single_set.assert_called_once()
|
||||
|
||||
def test_update_single_row_multiple_columns(self):
|
||||
description, status = "Upated by test_update_single_row_multiple_columns", "Closed"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue