Merge branch 'develop' into migrate-to-vue3

This commit is contained in:
Shariq Ansari 2022-10-03 14:07:43 +05:30 committed by GitHub
commit 2197e9cacc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 50 additions and 45 deletions

View file

@ -452,7 +452,7 @@ def msgprint(
if as_list and type(msg) in (list, tuple):
out.as_list = 1
if sys.stdin.isatty():
if sys.stdin and sys.stdin.isatty():
msg = _strip_html_tags(out.message)
if flags.print_messages and out.message:

View file

@ -449,7 +449,7 @@ class ImportFile:
continue
if not header:
header = Header(i, row, self.doctype, self.raw_data, self.column_to_field_map)
header = Header(i, row, self.doctype, self.raw_data[1:], self.column_to_field_map)
else:
row_obj = Row(i, row, self.doctype, header, self.import_type)
data.append(row_obj)
@ -981,9 +981,12 @@ class Column:
if self.skip_import:
return
if not any(self.column_values):
return
if self.df.fieldtype == "Link":
# find all values that dont exist
values = list({cstr(v) for v in self.column_values[1:] if v})
values = list({cstr(v) for v in self.column_values if v})
exists = [
cstr(d.name) for d in frappe.get_all(self.df.options, filters={"name": ("in", values)})
]
@ -1022,7 +1025,7 @@ class Column:
elif self.df.fieldtype == "Select":
options = get_select_options(self.df)
if options:
values = {cstr(v) for v in self.column_values[1:] if v}
values = {cstr(v) for v in self.column_values if v}
invalid = values - set(options)
if invalid:
valid_values = ", ".join(frappe.bold(o) for o in options)

View file

@ -8,26 +8,29 @@ frappe.ui.form.on("Report", {
}
let doc = frm.doc;
frm.add_custom_button(
__("Show Report"),
function () {
switch (doc.report_type) {
case "Report Builder":
frappe.set_route("List", doc.ref_doctype, "Report", doc.name);
break;
case "Query Report":
frappe.set_route("query-report", doc.name);
break;
case "Script Report":
frappe.set_route("query-report", doc.name);
break;
case "Custom Report":
frappe.set_route("query-report", doc.name);
break;
}
},
"fa fa-table"
);
if (!doc.__islocal) {
frm.add_custom_button(
__("Show Report"),
function () {
switch (doc.report_type) {
case "Report Builder":
frappe.set_route("List", doc.ref_doctype, "Report", doc.name);
break;
case "Query Report":
frappe.set_route("query-report", doc.name);
break;
case "Script Report":
frappe.set_route("query-report", doc.name);
break;
case "Custom Report":
frappe.set_route("query-report", doc.name);
break;
}
},
"fa fa-table"
);
}
if (doc.is_standard === "Yes" && frm.perm[0].write) {
frm.add_custom_button(

View file

@ -215,7 +215,6 @@ def get_chart_config(chart, filters, timespan, timegrain, from_date, to_date):
group_by="_unit",
order_by="_unit asc",
as_list=True,
ignore_ifnull=True,
)
result = get_result(data, timegrain, from_date, to_date, chart.chart_type)

View file

@ -252,11 +252,10 @@ def run(
result = get_prepared_report_result(report, filters, dn, user)
else:
result = generate_report_result(report, filters, user, custom_columns, is_tree, parent_field)
add_data_to_monitor(report=report.reference_report or report.name)
result["add_total_row"] = report.add_total_row and not result.get("skip_total_row", False)
add_data_to_monitor(report=report)
return result

View file

@ -744,7 +744,7 @@ class BaseDocument:
# don't cache if fetching other values too
values = frappe.db.get_value(doctype, docname, values_to_fetch, as_dict=True)
if frappe.get_meta(doctype).issingle:
if getattr(frappe.get_meta(doctype), "issingle", 0):
values.name = doctype
if frappe.get_meta(doctype).get("is_virtual"):
@ -884,7 +884,7 @@ class BaseDocument:
if frappe.flags.in_install:
return
if self.meta.issingle:
if getattr(self.meta, "issingle", 0):
# single doctype value type is mediumtext
return

View file

@ -642,7 +642,7 @@ class DatabaseQuery:
f.value = date_range
fallback = f"'{FallBackDateTimeStr}'"
if f.operator in (">", "<") and (f.fieldname in ("creation", "modified")):
if f.operator in (">", "<", ">=", "<=") and (f.fieldname in ("creation", "modified")):
value = cstr(f.value)
fallback = f"'{FallBackDateTimeStr}'"

View file

@ -165,16 +165,7 @@ def set_new_name(doc):
if not doc.name and autoname:
set_name_from_naming_options(autoname, doc)
# if the autoname option is 'field:' and no name was derived, we need to
# notify
if not doc.name and autoname.startswith("field:"):
fieldname = autoname[6:]
frappe.throw(_("{0} is required").format(doc.meta.get_label(fieldname)))
# at this point, we fall back to name generation with the hash option
if not doc.name and autoname == "hash":
doc.name = make_autoname("hash", doc.doctype)
if not doc.name:
doc.name = make_autoname("hash", doc.doctype)
@ -220,6 +211,13 @@ def set_name_from_naming_options(autoname, doc):
if _autoname.startswith("field:"):
doc.name = _field_autoname(autoname, doc)
# if the autoname option is 'field:' and no name was derived, we need to
# notify
if not doc.name:
fieldname = autoname[6:]
frappe.throw(_("{0} is required").format(doc.meta.get_label(fieldname)))
elif _autoname.startswith("naming_series:"):
set_name_by_naming_series(doc)
elif _autoname.startswith("prompt"):

View file

@ -305,13 +305,16 @@ def make_boilerplate(
def db_update(self):
pass
def get_list(self, args):
@staticmethod
def get_list(args):
pass
def get_count(self, args):
@staticmethod
def get_count(args):
pass
def get_stats(self, args):
@staticmethod
def get_stats(args):
pass
"""
),

View file

@ -3429,7 +3429,7 @@ Mention,Mention,
Modules,Modules,
Monthly Long,Long mensuel,
Naming Series,Nom de série,
Navigate Home,Naviguer à la maison,
Navigate Home,Naviguer à l'accueil,
Navigate list down,Naviguer dans la liste,
Navigate list up,Naviguer dans la liste en haut,
New Notification,Nouvelle notification,
@ -3554,7 +3554,7 @@ Showing only first {0} rows out of {1},Afficher uniquement les {0} premières li
"Simple Python Expression, Example: Status in (""Invalid"")","Expression Python simple, Exemple: Statut dans (&quot;non valide&quot;)",
Skipping Untitled Column,Saut de colonne sans titre,
Skipping column {0},Colonne ignorée {0},
Social Home,Maison sociale,
Social Home,Accueil sociale,
Some columns might get cut off when printing to PDF. Try to keep number of columns under 10.,Certaines colonnes peuvent être coupées lors de l&#39;impression au format PDF. Essayez de garder le nombre de colonnes sous 10.,
Something went wrong during the token generation. Click on {0} to generate a new one.,Quelque chose s&#39;est mal passé pendant la génération de jetons. Cliquez sur {0} pour en générer un nouveau.,
Submit After Import,Validation après importation,

Can't render this file because it has a wrong number of fields in line 421.

View file

@ -557,7 +557,7 @@ def is_cli() -> bool:
try:
invoked_from_terminal = bool(os.get_terminal_size())
except Exception:
invoked_from_terminal = sys.stdin.isatty()
invoked_from_terminal = sys.stdin and sys.stdin.isatty()
return invoked_from_terminal