Pārlūkot izejas kodu

[doc] [minor] add # to autoname if not specified

version-14
Rushabh Mehta pirms 11 gadiem
vecāks
revīzija
0a4e0a6f88
4 mainītis faili ar 30 papildinājumiem un 13 dzēšanām
  1. +23
    -12
      public/js/wn/form/control.js
  2. +1
    -0
      public/js/wn/form/grid.js
  3. +3
    -1
      webnotes/__init__.py
  4. +3
    -0
      webnotes/model/doc.py

+ 23
- 12
public/js/wn/form/control.js Parādīt failu

@@ -706,20 +706,31 @@ wn.ui.form.ControlLink = wn.ui.form.ControlData.extend({
this.$wrapper.find(".ui-helper-hidden-accessible").remove();
},
set_custom_query: function(args) {
var set_nulls = function(obj) {
$.each(obj, function(key, value) {
if(value!==undefined) {
obj[key] = value || null;
}
});
return obj;
}
if(this.get_query || this.df.get_query) {
var q = (this.get_query || this.df.get_query)(this.frm && this.frm.doc, this.doctype, this.docname);

if (typeof(q)==="string") {
args.query = q;
} else if($.isPlainObject(q)) {
if(q.filters) {
$.each(q.filters, function(key, value) {
if(value!==undefined) {
q.filters[key] = value || null;
}
});
var get_query = this.get_query || this.df.get_query;
if($.isPlainObject(get_query)) {
$.extend(args, set_nulls(get_query));
} else if(typeof(get_query)==="string") {
args.query = get_query;
} else {
var q = (get_query)(this.frm && this.frm.doc, this.doctype, this.docname);

if (typeof(q)==="string") {
args.query = q;
} else if($.isPlainObject(q)) {
if(q.filters) {
set_nulls(q.filters);
}
$.extend(args, q);
}
$.extend(args, q);
}
}
},


+ 1
- 0
public/js/wn/form/grid.js Parādīt failu

@@ -423,6 +423,7 @@ wn.ui.form.GridRow = Class.extend({
this.toggle_add_delete_button_display(this.wrapper.find(".panel:first"));
this.grid.open_grid_row = this;
this.frm.script_manager.trigger(this.doc.parentfield + "_on_form_rendered", this);
},
make_form: function() {
if(!this.form_area) {


+ 3
- 1
webnotes/__init__.py Parādīt failu

@@ -68,6 +68,7 @@ user_lang = False
lang = 'en'
in_import = False
in_test = False
rollback_on_exception = False

# memcache

@@ -113,7 +114,8 @@ def log(msg):
def msgprint(msg, small=0, raise_exception=0, as_table=False):
def _raise_exception():
if raise_exception:
conn.rollback()
if rollback_on_exception:
conn.rollback()
import inspect
if inspect.isclass(raise_exception) and issubclass(raise_exception, Exception):
raise raise_exception, msg


+ 3
- 0
webnotes/model/doc.py Parādīt failu

@@ -524,6 +524,9 @@ def make_autoname(key, doctype=''):
* DE/./.YY./.MM./.##### will create a series like
DE/09/01/0001 where 09 is the year, 01 is the month and 0001 is the series
"""
if not "#" in key:
key = key + ".#####"
n = ''
l = key.split('.')
series_set = False


Notiek ielāde…
Atcelt
Saglabāt