Merge branch 'develop' into update-cypress

This commit is contained in:
Suraj Shetty 2020-04-25 09:23:10 +05:30 committed by GitHub
commit e08213e098
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 43 additions and 24 deletions

View file

@ -895,7 +895,7 @@ def validate_fields(meta):
field.fetch_from = field.fetch_from.strip('\n').strip()
def validate_data_field_type(docfield):
if docfield.fieldtype == "Data":
if docfield.fieldtype == "Data" and not (docfield.oldfieldtype and docfield.oldfieldtype != "Data"):
if docfield.options and (docfield.options not in data_field_options):
df_str = frappe.bold(_(docfield.label))
text_str = _("{0} is an invalid Data field.").format(df_str) + "<br>" * 2 + _("Only Options allowed for Data field are:") + "<br>"

View file

@ -551,6 +551,7 @@ def update_password(new_password, logout_all_sessions=0, key=None, old_password=
res = _get_user_for_update_password(key, old_password)
if res.get('message'):
frappe.local.response.http_status_code = 410
return res['message']
else:
user = res['user']
@ -718,7 +719,7 @@ def _get_user_for_update_password(key, old_password):
user = frappe.db.get_value("User", {"reset_password_key": key})
if not user:
return {
'message': _("Cannot Update: Incorrect / Expired Link.")
'message': _("The Link specified has either been used before or Invalid")
}
elif old_password:

View file

@ -268,8 +268,9 @@ def get_open_count(doctype, name, items=[]):
"count": out,
}
module = frappe.get_meta_module(doctype)
if hasattr(module, "get_timeline_data"):
out["timeline_data"] = module.get_timeline_data(doctype, name)
if not meta.custom:
module = frappe.get_meta_module(doctype)
if hasattr(module, "get_timeline_data"):
out["timeline_data"] = module.get_timeline_data(doctype, name)
return out

View file

@ -565,10 +565,14 @@ class BaseDocument(object):
for data_field in self.meta.get_data_fields():
data = self.get(data_field.fieldname)
data_field_options = data_field.get("options")
old_fieldtype = data_field.get("oldfieldtype")
if old_fieldtype and old_fieldtype != "Data":
continue
if data_field_options == "Email":
if (self.owner in STANDARD_USERS) and (data in STANDARD_USERS):
return
continue
for email_address in frappe.utils.split_emails(data):
frappe.utils.validate_email_address(email_address, throw=True)

View file

@ -329,6 +329,10 @@ class Document(BaseDocument):
self.update_children()
self.run_post_save_methods()
# clear unsaved flag
if hasattr(self, "__unsaved"):
delattr(self, "__unsaved")
return self
def copy_attachments_from_amended_from(self):

View file

@ -10,11 +10,11 @@ frappe.ui.form.ControlCode = frappe.ui.form.ControlText.extend({
.appendTo(this.input_area);
this.expanded = false;
this.$expand_button = $(`<button class="margin-top btn btn-xs btn-default">${__('Expand / Collapse')}</button>`).click(() => {
this.$expand_button = $(`<button class="btn btn-xs btn-default">${__('Expand')}</button>`).click(() => {
this.expanded = !this.expanded;
this.refresh_height();
}).insertAfter(this.ace_editor_target);
this.toggle_label();
}).appendTo(this.$input_wrapper);
// styling
this.ace_editor_target.addClass('border rounded');
this.ace_editor_target.css('height', 300);
@ -37,6 +37,11 @@ frappe.ui.form.ControlCode = frappe.ui.form.ControlText.extend({
this.editor.resize();
},
toggle_label() {
const button_label = this.expanded ? __('Collapse') : __('Expand');
this.$expand_button.text(button_label);
},
set_language() {
const language_map = {
'Javascript': 'ace/mode/javascript',

View file

@ -770,6 +770,7 @@ h6.uppercase, .h6.uppercase {
.help-box {
margin-top: 3px;
margin-bottom: 6px;
}
pre {

View file

@ -9,7 +9,7 @@
<span class='indicator blue password-box'>{{ _("Reset Password") if frappe.db.get_default('company') else _("Set Password")}}</span>
</div>
<form id="reset-password">
<div class="form-group">
<div class="form-group" style="display: none;">
<input id="old_password" type="password"
class="form-control" placeholder="{{ _("Old Password") }}">
</div>
@ -32,8 +32,8 @@
<script>
frappe.ready(function() {
if(frappe.utils.get_url_arg("key")) {
$("#old_password").parent().toggle(false);
if(!frappe.utils.get_url_arg("key")) {
$("#old_password").parent().toggle();
}
if(frappe.utils.get_url_arg("password_expired")) {
@ -57,12 +57,10 @@ frappe.ready(function() {
}
if(!args.old_password && !args.key) {
frappe.msgprint("{{ _("Old Password Required.") }}");
return;
frappe.msgprint(__("Old Password Required."));
}
if(!args.new_password) {
frappe.msgprint("{{ _("New Password Required.") }}");
return;
frappe.msgprint(__("New Password Required."));
}
frappe.call({
type: "POST",
@ -71,19 +69,24 @@ frappe.ready(function() {
args: args,
statusCode: {
401: function() {
$('.page-card-head .indicator').removeClass().addClass('indicator red')
.text("{{ _('Invalid Password') }}");
$(".page-card-head .indicator").removeClass().addClass("indicator red").text(__("Invalid Password"));
},
410: function({ responseJSON }) {
const title = __("Invalid Link");
const message = responseJSON.message;
$(".page-card-head .indicator").removeClass().addClass("indicator grey").text(title);
frappe.msgprint({ title: title, message: message, clear: true });
},
200: function(r) {
$("input").val("");
strength_indicator.addClass('hidden');
strength_message.addClass('hidden');
$('.page-card-head .indicator')
.removeClass().addClass('indicator green')
.html("{{ _('Password Updated') }}");
strength_indicator.addClass("hidden");
strength_message.addClass("hidden");
$(".page-card-head .indicator")
.removeClass().addClass("indicator blue")
.html(__("Status Updated"));
if(r.message) {
frappe.msgprint({
message: "{{ _("Password Updated") }}",
message: __("Password Updated"),
// password is updated successfully
// clear any server message
clear: true