Skip to content

Commit

Permalink
Merge branch 'frappe:version-15' into version-15
Browse files Browse the repository at this point in the history
  • Loading branch information
metalmon authored Dec 18, 2024
2 parents 6676af7 + 93ee9ca commit a90d5da
Show file tree
Hide file tree
Showing 19 changed files with 78 additions and 53 deletions.
6 changes: 3 additions & 3 deletions .github/helper/install_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ echo "Setting Up System Dependencies..."
echo "::group::apt packages"
sudo apt update
sudo apt remove mysql-server mysql-client
sudo apt install libcups2-dev redis-server mariadb-client-10.6
sudo apt install libcups2-dev redis-server mariadb-client

install_wkhtmltopdf() {
wget -q https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.focal_amd64.deb
sudo apt install ./wkhtmltox_0.12.6-1.focal_amd64.deb
wget -q https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-2/wkhtmltox_0.12.6.1-2.jammy_amd64.deb
sudo apt install ./wkhtmltox_0.12.6.1-2.jammy_amd64.deb
}
install_wkhtmltopdf &
echo "::endgroup::"
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
exclude: 'node_modules|.git'
default_stages: [commit]
default_stages: [pre-commit]
fail_fast: false


Expand Down
7 changes: 4 additions & 3 deletions frappe/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
)
from .utils.lazy_loader import lazy_import

__version__ = "15.50.0"
__version__ = "15.50.1"
__title__ = "Frappe Framework"

# This if block is never executed when running the code. It is only used for
Expand Down Expand Up @@ -88,7 +88,7 @@
cache = None
STANDARD_USERS = ("Guest", "Administrator")

_qb_patched = {}
_one_time_setup = {}
_dev_server = int(sbool(os.environ.get("DEV_SERVER", False)))
_tune_gc = bool(sbool(os.environ.get("FRAPPE_TUNE_GC", True)))

Expand Down Expand Up @@ -249,10 +249,11 @@ def init(site: str, sites_path: str = ".", new_site: bool = False, force=False)
local.qb.get_query = get_query
setup_redis_cache_connection()

if not _qb_patched.get(local.conf.db_type):
if not _one_time_setup.get(local.conf.db_type):
patch_query_execute()
patch_query_aggregation()
_register_fault_handler()
_one_time_setup[local.conf.db_type] = True

setup_module_map(include_all_apps=not (frappe.request or frappe.job or frappe.flags.in_migrate))

Expand Down
5 changes: 5 additions & 0 deletions frappe/core/doctype/package/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# For license information, please see license.txt

import os
from string import ascii_letters, digits

import frappe
from frappe.model.document import Document
Expand Down Expand Up @@ -34,6 +35,10 @@ def validate(self):
if not self.package_name:
self.package_name = self.name.lower().replace(" ", "-")

allowed_characters = ascii_letters + digits + "-"
if not all(c in allowed_characters for c in self.package_name):
frappe.throw("Package name can only contain letters, digits and hyphens")


@frappe.whitelist()
def get_license_text(license_type: str) -> str | None:
Expand Down
11 changes: 8 additions & 3 deletions frappe/core/doctype/package_release/package_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import os
import subprocess
from pathlib import Path

import frappe
from frappe.model.document import Document
Expand Down Expand Up @@ -65,12 +66,16 @@ def autoname(self):
)

def validate(self):
package = frappe.get_doc("Package", self.package)
package_path = Path(frappe.get_site_path("packages", package.package_name))
if not package_path.resolve().is_relative_to(Path(frappe.get_site_path()).resolve()):
frappe.throw("Invalid package path: " + package_path.as_posix())

if self.publish:
self.export_files()
self.export_files(package)

def export_files(self):
def export_files(self, package):
"""Export all the documents in this package to site/packages folder"""
package = frappe.get_doc("Package", self.package)

self.export_modules()
self.export_package_files(package)
Expand Down
2 changes: 1 addition & 1 deletion frappe/email/receive.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ def retrieve_message(self, uid, msg_num):

def get_email_seen_status(self, uid, flag_string):
"""parse the email FLAGS response"""
if not flag_string:
if not flag_string or not isinstance(flag_string, str | bytes):
return None

flags = []
Expand Down
3 changes: 2 additions & 1 deletion frappe/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"text/plain",
"video/quicktime",
"video/mp4",
"text/csv",
)


Expand Down Expand Up @@ -226,7 +227,7 @@ def upload_file():
if content is not None and (frappe.session.user == "Guest" or (user and not user.has_desk_access())):
filetype = guess_type(filename)[0]
if filetype not in ALLOWED_MIMETYPES:
frappe.throw(_("You can only upload JPG, PNG, PDF, TXT or Microsoft documents."))
frappe.throw(_("You can only upload JPG, PNG, PDF, TXT, CSV or Microsoft documents."))

if method:
method = frappe.get_attr(method)
Expand Down
4 changes: 2 additions & 2 deletions frappe/locale/es.po
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ msgstr ""
"Project-Id-Version: frappe\n"
"Report-Msgid-Bugs-To: [email protected]\n"
"POT-Creation-Date: 2024-12-01 17:58+0000\n"
"PO-Revision-Date: 2024-12-04 19:52\n"
"PO-Revision-Date: 2024-12-08 20:00\n"
"Last-Translator: [email protected]\n"
"Language-Team: Spanish\n"
"MIME-Version: 1.0\n"
Expand Down Expand Up @@ -24188,7 +24188,7 @@ msgstr "Hora de inicio"

#: frappe/templates/includes/comments/comments.html:8
msgid "Start a new discussion"
msgstr "Empezar un nuevo debate"
msgstr "Empezar una nueva conversación"

#: frappe/core/doctype/data_export/exporter.py:22
msgid "Start entering data below this line"
Expand Down
18 changes: 9 additions & 9 deletions frappe/locale/fa.po
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ msgstr ""
"Project-Id-Version: frappe\n"
"Report-Msgid-Bugs-To: [email protected]\n"
"POT-Creation-Date: 2024-12-01 17:58+0000\n"
"PO-Revision-Date: 2024-12-04 19:52\n"
"PO-Revision-Date: 2024-12-11 20:01\n"
"Last-Translator: [email protected]\n"
"Language-Team: Persian\n"
"MIME-Version: 1.0\n"
Expand Down Expand Up @@ -3562,7 +3562,7 @@ msgstr "ساخته شده در {0}"
#. Label of a Check field in DocType 'User'
#: frappe/core/doctype/user/user.json
msgid "Bulk Actions"
msgstr "اعمال توده"
msgstr "اعمال انبوه"

#: frappe/core/doctype/user_permission/user_permission_list.js:142
msgid "Bulk Delete"
Expand Down Expand Up @@ -12795,7 +12795,7 @@ msgstr "قالب CSV نامعتبر است"

#: frappe/integrations/frappe_providers/frappecloud_billing.py:121
msgid "Invalid Code. Please try again."
msgstr ""
msgstr "کد نامعتبر. لطفا دوباره امتحان کنید."

#: frappe/integrations/doctype/webhook/webhook.py:90
msgid "Invalid Condition: {}"
Expand Down Expand Up @@ -14841,7 +14841,7 @@ msgstr ""

#: frappe/public/js/frappe/data_import/import_preview.js:290
msgid "Map columns from {0} to fields in {1}"
msgstr "ستون‌های نقشه از {0} تا فیلدها در {1}"
msgstr "نگاشت ستون‌ها از {0} به فیلدها در {1}"

#. Description of the 'Dynamic Route' (Check) field in DocType 'Web Page'
#: frappe/website/doctype/web_page/web_page.json
Expand Down Expand Up @@ -15666,7 +15666,7 @@ msgstr "فیلد ضرب"
#. Import'
#: frappe/core/doctype/data_import/data_import.json
msgid "Must be a publicly accessible Google Sheets URL"
msgstr "باید یک URL برای عموم کاربرگ‌نگار باشد"
msgstr "باید یک URL کاربرگ‌نگار در دسترس عموم باشد"

#. Description of the 'LDAP Search String' (Data) field in DocType 'LDAP
#. Settings'
Expand Down Expand Up @@ -24497,7 +24497,7 @@ msgstr ""

#: frappe/core/doctype/data_import/data_import.js:151
msgid "Successfully {0} {1} records."
msgstr ""
msgstr "{1} رکورد با موفقیت {0} شد."

#: frappe/core/doctype/recorder/recorder.js:15
msgid "Suggest Optimizations"
Expand Down Expand Up @@ -29133,7 +29133,7 @@ msgstr "برای ارسال این فرم باید وارد شوید"

#: frappe/model/document.py:238
msgid "You need the '{0}' permission on {1} {2} to perform this action."
msgstr ""
msgstr "برای انجام این عمل به مجوز \"{0}\" در {1} {2} نیاز دارید."

#: frappe/desk/doctype/workspace/workspace.py:113
msgid "You need to be Workspace Manager to delete a public workspace."
Expand Down Expand Up @@ -29185,11 +29185,11 @@ msgstr "باید یک پوشه IMAP برای {0} تنظیم کنید"

#: frappe/model/rename_doc.py:388
msgid "You need write permission on {0} {1} to merge"
msgstr ""
msgstr "برای ادغام به اجازه نوشتن در {0} {1} نیاز دارید"

#: frappe/model/rename_doc.py:383
msgid "You need write permission on {0} {1} to rename"
msgstr ""
msgstr "برای تغییر نام به اجازه نوشتن در {0} {1} نیاز دارید"

#: frappe/client.py:458
msgid "You need {0} permission to fetch values from {1} {2}"
Expand Down
16 changes: 8 additions & 8 deletions frappe/locale/sv.po
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ msgstr ""
"Project-Id-Version: frappe\n"
"Report-Msgid-Bugs-To: [email protected]\n"
"POT-Creation-Date: 2024-12-01 17:58+0000\n"
"PO-Revision-Date: 2024-12-04 19:52\n"
"PO-Revision-Date: 2024-12-09 20:00\n"
"Last-Translator: [email protected]\n"
"Language-Team: Swedish\n"
"MIME-Version: 1.0\n"
Expand Down Expand Up @@ -4418,12 +4418,12 @@ msgstr "Kedjehash"
#: frappe/public/js/frappe/form/templates/form_sidebar.html:11
#: frappe/tests/test_translate.py:98
msgid "Change"
msgstr "Växel"
msgstr "Ändra"

#: frappe/tests/test_translate.py:99
msgctxt "Coins"
msgid "Change"
msgstr "Växel"
msgstr "Ändra"

#: frappe/public/js/print_format_builder/LetterHeadEditor.vue:38
msgid "Change Image"
Expand Down Expand Up @@ -8741,7 +8741,7 @@ msgstr "E-post "

#: frappe/email/queue.py:137
msgid "Emails are muted"
msgstr "E-post är Dämpad"
msgstr "E-post är dämpad"

#. Description of the 'Send Email Alert' (Check) field in DocType 'Workflow'
#: frappe/workflow/doctype/workflow/workflow.json
Expand Down Expand Up @@ -11017,7 +11017,7 @@ msgstr "Hämta Fält"

#: frappe/printing/doctype/letter_head/letter_head.js:32
msgid "Get Header and Footer wkhtmltopdf variables"
msgstr "Hämta wkhtmltopdf variabler för sidhuvud och sidfot"
msgstr "Hämta Sidhuvud och Sidfot wkhtmltopdf variabler"

#: frappe/public/js/frappe/form/multi_select_dialog.js:87
msgid "Get Items"
Expand Down Expand Up @@ -11572,7 +11572,7 @@ msgstr "Sidhuvud, Robotar"

#: frappe/printing/doctype/letter_head/letter_head.js:30
msgid "Header/Footer scripts can be used to add dynamic behaviours."
msgstr "Skript för Brevhuvud/Sidfot kan användas för att lägga till dynamisk beteende."
msgstr "Skript för Sidhuvud/Sidfot kan användas för att lägga till dynamisk beteende."

#. Label of a Table field in DocType 'Webhook'
#. Label of a Code field in DocType 'Webhook Request Log'
Expand Down Expand Up @@ -24775,7 +24775,7 @@ msgstr "Ändra Tema"

#: frappe/templates/includes/navbar/navbar_login.html:17
msgid "Switch To Desk"
msgstr "Ändra till Skrivbord"
msgstr "Växla till Skrivbord"

#: frappe/public/js/frappe/ui/capture.js:273
msgid "Switching Camera"
Expand Down Expand Up @@ -31359,7 +31359,7 @@ msgstr "{0} är inte Direkt Utskrift Mall."

#: frappe/public/js/frappe/views/calendar/calendar.js:82
msgid "{0} is not a valid Calendar. Redirecting to default Calendar."
msgstr "{0} är inte en giltig kalender. Omdirigerar till standardkalendern."
msgstr "{0} är inte giltig Kalender. Omdirigerar till standard Kalender."

#: frappe/core/doctype/scheduled_job_type/scheduled_job_type.py:65
msgid "{0} is not a valid Cron expression."
Expand Down
4 changes: 2 additions & 2 deletions frappe/locale/tr.po
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ msgstr ""
"Project-Id-Version: frappe\n"
"Report-Msgid-Bugs-To: [email protected]\n"
"POT-Creation-Date: 2024-12-01 17:58+0000\n"
"PO-Revision-Date: 2024-12-05 19:58\n"
"PO-Revision-Date: 2024-12-10 20:05\n"
"Last-Translator: [email protected]\n"
"Language-Team: Turkish\n"
"MIME-Version: 1.0\n"
Expand Down Expand Up @@ -23337,7 +23337,7 @@ msgstr "Paylaş"

#: frappe/public/js/frappe/form/templates/set_sharing.html:49
msgid "Share this document with"
msgstr "Dökümanı Şu Kişiyle Paylaş"
msgstr "Dökümanı Paylaş"

#: frappe/public/js/frappe/form/sidebar/share.js:45
msgid "Share {0} with"
Expand Down
10 changes: 9 additions & 1 deletion frappe/model/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -1603,8 +1603,16 @@ def validate_from_to_dates(self, from_date_field: str, to_date_field: str) -> No
return

if date_diff(to_date, from_date) < 0:
table_row = ""
if self.meta.istable:
table_row = _("{0} row #{1}: ").format(
_(frappe.unscrub(self.parentfield)),
self.idx,
)

frappe.throw(
_("{0} must be after {1}").format(
table_row
+ _("{0} must be after {1}").format(
frappe.bold(_(self.meta.get_label(to_date_field))),
frappe.bold(_(self.meta.get_label(from_date_field))),
),
Expand Down
31 changes: 18 additions & 13 deletions frappe/public/js/frappe/form/grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -881,20 +881,25 @@ export default class Grid {
}

duplicate_row(d, copy_doc) {
const noCopyFields = new Set([
"creation",
"modified",
"modified_by",
"idx",
"owner",
"parent",
"doctype",
"name",
"parentfield",
]);

const docfields = frappe.get_meta(this.doctype).fields || [];
$.each(docfields, function (_index, df) {
if (cint(df.no_copy)) noCopyFields.add(df.fieldname);
});

$.each(copy_doc, function (key, value) {
if (
![
"creation",
"modified",
"modified_by",
"idx",
"owner",
"parent",
"doctype",
"name",
"parentfield",
].includes(key)
) {
if (!noCopyFields.has(key)) {
d[key] = value;
}
});
Expand Down
2 changes: 1 addition & 1 deletion frappe/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
{% block base_scripts %}
<!-- js should be loaded in body! -->
<script>
frappe.boot = {{ boot }}
frappe.boot = {{ boot | json }}
// for backward compatibility of some libs
frappe.sys_defaults = frappe.boot.sysdefaults;
</script>
Expand Down
2 changes: 1 addition & 1 deletion frappe/website/doctype/web_form/templates/web_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ <h2 class="success-title">{{ _(success_title) or _("Submitted") }}</h2>

{% block script %}
<script>
frappe.boot = {{ boot }};
frappe.boot = {{ boot | json }};
frappe._messages = {{ translated_messages }};
frappe.web_form_doc = {{ web_form_doc | json }};
frappe.reference_doc = {{ reference_doc | json }};
Expand Down
2 changes: 1 addition & 1 deletion frappe/website/doctype/web_form/templates/web_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ <h1 class="ellipsis">{{ _(list_title or title) }}</h1>

{% block script %}
<script>
frappe.boot = {{ boot }};
frappe.boot = {{ boot | json }};
frappe._messages = {{ translated_messages }};
frappe.web_form_doc = {{ web_form_doc | json }};
</script>
Expand Down
1 change: 1 addition & 0 deletions frappe/website/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ def get_boot_data():
"time_format": frappe.get_system_settings("time_format") or "HH:mm:ss",
"first_day_of_the_week": frappe.get_system_settings("first_day_of_the_week") or "Sunday",
"number_format": frappe.get_system_settings("number_format") or "#,###.##",
"currency": frappe.get_system_settings("currency"),
},
"time_zone": {
"system": get_system_timezone(),
Expand Down
Loading

0 comments on commit a90d5da

Please sign in to comment.