Quellcode durchsuchen

listview new doc bugfix

version-14
Rushabh Mehta vor 12 Jahren
Ursprung
Commit
c665a99a86
2 geänderte Dateien mit 25 neuen und 21 gelöschten Zeilen
  1. +18
    -17
      public/js/wn/views/doclistview.js
  2. +7
    -4
      webnotes/widgets/reportview.py

+ 18
- 17
public/js/wn/views/doclistview.js Datei anzeigen

@@ -160,7 +160,7 @@ wn.views.DocListView = wn.ui.Listing.extend({
// make_new_doc can be overridden so that default values can be prefilled // make_new_doc can be overridden so that default values can be prefilled
// for example - communication list in customer // for example - communication list in customer
$(this.wrapper).find('button[list_view_doc="'+me.doctype+'"]').click(function(){
$(this.wrapper).on("click", 'button[list_view_doc="'+me.doctype+'"]', function(){
(me.listview.make_new_doc || me.make_new_doc)(me.doctype); (me.listview.make_new_doc || me.make_new_doc)(me.doctype);
}); });
@@ -174,7 +174,7 @@ wn.views.DocListView = wn.ui.Listing.extend({
<p><button class="btn btn-info btn-small" list_view_doc="%(doctype)s">\ <p><button class="btn btn-info btn-small" list_view_doc="%(doctype)s">\
Make a new %(doctype_label)s</button>\ Make a new %(doctype_label)s</button>\
</p></div>', { </p></div>', {
doctype_label: get_doctype_label(this.doctype),
doctype_label: wn._(this.doctype),
doctype: this.doctype doctype: this.doctype
}); });
@@ -230,22 +230,23 @@ wn.views.DocListView = wn.ui.Listing.extend({
}); });
if(!dl.length) if(!dl.length)
return; return;
if(!confirm('This is PERMANENT action and you cannot undo. Continue?')) {
return;
}
me.set_working(true);
wn.call({
method: 'webnotes.widgets.reportview.delete_items',
args: {
items: dl,
doctype: me.doctype
},
callback: function() {
me.set_working(false);
me.refresh();
wn.confirm('This is permanent action and you cannot undo. Continue?',
function() {
me.set_working(true);
wn.call({
method: 'webnotes.widgets.reportview.delete_items',
args: {
items: dl,
doctype: me.doctype
},
callback: function() {
me.set_working(false);
me.refresh();
}
})
} }
})
);
}, },
init_stats: function() { init_stats: function() {
var me = this var me = this


+ 7
- 4
webnotes/widgets/reportview.py Datei anzeigen

@@ -304,10 +304,13 @@ def delete_items():
doctype = webnotes.form_dict.get('doctype') doctype = webnotes.form_dict.get('doctype')
for d in il: for d in il:
dt_obj = get_obj(doctype, d)
if hasattr(dt_obj, 'on_trash'):
dt_obj.on_trash()
delete_doc(doctype, d)
try:
dt_obj = get_obj(doctype, d)
if hasattr(dt_obj, 'on_trash'):
dt_obj.on_trash()
delete_doc(doctype, d)
except Exception, e:
pass
@webnotes.whitelist() @webnotes.whitelist()
def get_stats(): def get_stats():


Laden…
Abbrechen
Speichern