[fix] web form and ctrl+enter in quick entry

This commit is contained in:
Rushabh Mehta 2016-10-04 12:21:46 +05:30
parent 7801912638
commit 796f7b0214
2 changed files with 9 additions and 7 deletions

View file

@ -102,10 +102,12 @@ frappe.ui.form.quick_entry = function(doctype, success) {
});
// ctrl+enter to save
dialog.wrapper.keydown("meta+return ctrl+return", function(e) {
if(!frappe.request.ajax_count) {
// not already working -- double entry
dialog.get_primary_btn().trigger("click");
dialog.wrapper.keydown(function(e) {
if((e.ctrlKey || e.metaKey) && e.which==13) {
if(!frappe.request.ajax_count) {
// not already working -- double entry
dialog.get_primary_btn().trigger("click");
}
}
});

View file

@ -65,7 +65,7 @@
{%- macro value(field, _doc) -%}
{%- if _doc -%}
{%- set _value = _doc.get(field.fieldname) -%}
{%- set _value = _doc.get(field.fieldname) or frappe.form_dict.get(field.fieldname) -%}
{%- else -%}
{%- set _value = frappe.form_dict.get(field.fieldname) or field.default -%}
{%- endif -%}
@ -85,8 +85,8 @@
{% macro render_field(field, _doc=None, with_label=True) %}
{% if field.hidden %}
<input type="hidden"
name="{{ field.fieldname }}" {% if field.default -%} value="{{ field.default }}" {%- endif %}>
<input type="hidden" data-doctype="{{ field.parent }}"
name="{{ field.fieldname }}" value="{{ value(field, _doc) }}">
{% elif field.fieldtype == "HTML" and field.options %}
<div class="form-group">
{{ field.options }}