Skip to content

Commit 498e8f7

Browse files
committed
Merge branch 'v12-pre-release' into version-12
2 parents efe89f2 + 42a0d29 commit 498e8f7

File tree

15 files changed

+122
-50
lines changed

15 files changed

+122
-50
lines changed

.travis.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,7 @@ install:
5252
- cd ~
5353
- source ./.nvm/nvm.sh
5454
- nvm install v8.10.0
55-
56-
- git clone https://github.com/frappe/bench --depth 1
57-
- pip install -e ./bench
55+
- pip install -U frappe-bench --only-binary='all'
5856

5957
- bench init frappe-bench --skip-assets --python $(which python) --frappe-path $TRAVIS_BUILD_DIR
6058

frappe/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
reload(sys)
2424
sys.setdefaultencoding("utf-8")
2525

26-
__version__ = '12.18.1'
26+
__version__ = '12.19.0'
2727
__title__ = "Frappe Framework"
2828

2929
local = Local()

frappe/app.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,20 @@ def handle_exception(e):
185185
response = None
186186
http_status_code = getattr(e, "http_status_code", 500)
187187
return_as_message = False
188-
189-
if frappe.get_request_header('Accept') and (frappe.local.is_ajax or 'application/json' in frappe.get_request_header('Accept')):
188+
accept_header = frappe.get_request_header("Accept") or ""
189+
respond_as_json = (
190+
frappe.get_request_header('Accept')
191+
and (frappe.local.is_ajax or 'application/json' in accept_header)
192+
or (
193+
frappe.local.request.path.startswith("/api/") and not accept_header.startswith("text")
194+
)
195+
)
196+
197+
if frappe.conf.get('developer_mode'):
198+
# don't fail silently
199+
print(frappe.get_traceback())
200+
201+
if respond_as_json:
190202
# handle ajax responses first
191203
# if the request is ajax, send back the trace or error message
192204
response = frappe.utils.response.report_error(http_status_code)

frappe/auth.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,10 @@ def authenticate(self, user = None, pwd = None):
209209
self.fail(_('Incomplete login details'), user=user)
210210

211211
# Ignore password check if tmp_id is set, 2FA takes care of authentication.
212-
validate_password = not bool(frappe.form_dict.get('tmp_id'))
212+
tmp_id = bool(frappe.form_dict.tmp_id)
213+
enabled = cint(frappe.db.get_single_value('System Settings', 'enable_two_factor_auth', cache=True))
214+
# if tmp_id is set and 2FA is enabled, skip validation by password
215+
validate_password = not (tmp_id and enabled)
213216
user = User.find_by_credentials(user, pwd, validate_password=validate_password)
214217

215218
if not user:

frappe/change_log/v12/v12_19_0.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
## Version 12.19.0 Release Notes
2+
3+
### Fixes & Enhancements
4+
5+
- Refresh form section while refreshing the field ([#13355](https://github.com/frappe/frappe/pull/13355))
6+
- Check for 2FA is enabled or not ([#13455](https://github.com/frappe/frappe/pull/13455))
7+
- Tooltip displays correct title (backport #13346) ([#13354](https://github.com/frappe/frappe/pull/13354))
8+
- Expose limited methods of json module ([#13253](https://github.com/frappe/frappe/pull/13253))
9+
- ci: Update Sider config ([#13332](https://github.com/frappe/frappe/pull/13332))
10+
- auto_repeat field check while loading customize form ([#13350](https://github.com/frappe/frappe/pull/13350))
11+
- Restrict access to python's internal attributes ([#13383](https://github.com/frappe/frappe/pull/13383))
12+
- Respond to /api requests as JSON by default (backport #13028) ([#13408](https://github.com/frappe/frappe/pull/13408))
13+
- CSS bug on print format rtl layout ([#13299](https://github.com/frappe/frappe/pull/13299))
14+
- Check if salutation already exists in email body ([#13196](https://github.com/frappe/frappe/pull/13196))

frappe/custom/doctype/customize_form/customize_form.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -115,12 +115,22 @@ def fetch_to_customize(self):
115115

116116
#If allow_auto_repeat is set, add auto_repeat custom field.
117117
if self.allow_auto_repeat:
118-
if not frappe.db.exists('Custom Field', {'fieldname': 'auto_repeat', 'dt': self.doc_type}):
119-
insert_after = self.fields[len(self.fields) - 1].fieldname
120-
df = dict(fieldname='auto_repeat', label='Auto Repeat', fieldtype='Link', options='Auto Repeat', insert_after=insert_after, read_only=1, no_copy=1, print_hide=1)
121-
create_custom_field(self.doc_type, df)
118+
all_fields = [df.fieldname for df in meta.fields]
119+
if "auto_repeat" in all_fields:
120+
return
121+
122+
insert_after = self.fields[len(self.fields) - 1].fieldname
123+
create_custom_field(self.doc_type, dict(
124+
fieldname='auto_repeat',
125+
label='Auto Repeat',
126+
fieldtype='Link',
127+
options='Auto Repeat',
128+
insert_after=insert_after,
129+
read_only=1,
130+
no_copy=1,
131+
print_hide=1
132+
))
122133

123-
# NOTE doc is sent to clientside by run_method
124134

125135
def get_name_translation(self):
126136
'''Get translation object if exists of current doctype name in the default language'''

frappe/public/css/desk-rtl.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,3 +148,8 @@ body[data-route^=Form] .page-title .indicator {
148148
transform: translateX(0%) !important;
149149
}
150150
}
151+
152+
.print-format-builder-main {
153+
margin-left: 0px;
154+
margin-right: 160px;
155+
}

frappe/public/js/frappe/form/controls/link.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,10 +191,11 @@ frappe.ui.form.ControlLink = frappe.ui.form.ControlData.extend({
191191
if(frappe.model.can_create(doctype)) {
192192
// new item
193193
r.results.push({
194-
label: "<span class='text-primary link-option'>"
194+
html: "<span class='text-primary link-option'>"
195195
+ "<i class='fa fa-plus' style='margin-right: 5px;'></i> "
196196
+ __("Create a new {0}", [__(me.get_options())])
197197
+ "</span>",
198+
label: __("Create a new {0}", [__(me.get_options())]),
198199
value: "create_new__link_option",
199200
action: me.new_doc
200201
});
@@ -204,10 +205,11 @@ frappe.ui.form.ControlLink = frappe.ui.form.ControlData.extend({
204205
if (locals && locals['DocType']) {
205206
// not applicable in web forms
206207
r.results.push({
207-
label: "<span class='text-primary link-option'>"
208+
html: "<span class='text-primary link-option'>"
208209
+ "<i class='fa fa-search' style='margin-right: 5px;'></i> "
209210
+ __("Advanced Search")
210211
+ "</span>",
212+
label: __("Advanced Search"),
211213
value: "advanced_search__link_option",
212214
action: me.open_advanced_search
213215
});

frappe/public/js/frappe/form/form.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ frappe.ui.form.Form = class FrappeForm {
198198
field && ["Link", "Dynamic Link"].includes(field.df.fieldtype) && field.validate && field.validate(value);
199199

200200
me.layout.refresh_dependency();
201+
me.layout.refresh_sections();
201202
let object = me.script_manager.trigger(fieldname, doc.doctype, doc.name);
202203
return object;
203204
}
@@ -913,6 +914,7 @@ frappe.ui.form.Form = class FrappeForm {
913914
if(this.fields_dict[fname] && this.fields_dict[fname].refresh) {
914915
this.fields_dict[fname].refresh();
915916
this.layout.refresh_dependency();
917+
this.layout.refresh_sections();
916918
}
917919
}
918920

frappe/public/js/frappe/views/communication.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -640,10 +640,14 @@ frappe.views.CommunicationComposer = Class.extend({
640640
this.message = localStorage.getItem(doctype + docname) || '';
641641
}
642642
}
643-
644-
if(this.real_name) {
645-
this.message = '<p>'+__('Dear') +' '
646-
+ this.real_name + ",</p><!-- salutation-ends --><br>" + (this.message || "");
643+
644+
const SALUTATION_END_COMMENT = "<!-- salutation-ends -->";
645+
if (this.real_name && !message.includes(SALUTATION_END_COMMENT)) {
646+
this.message = `
647+
<p>${__('Dear')} ${this.real_name},</p>
648+
${SALUTATION_END_COMMENT}<br>
649+
${message}
650+
`;
647651
}
648652

649653
if(this.message && signature && this.message.includes(signature)) {

0 commit comments

Comments
 (0)