Kaynağa Gözat

listview new doc bugfix

version-14
Rushabh Mehta 12 yıl önce
ebeveyn
işleme
c665a99a86
2 değiştirilmiş dosya ile 25 ekleme ve 21 silme
  1. +18
    -17
      public/js/wn/views/doclistview.js
  2. +7
    -4
      webnotes/widgets/reportview.py

+ 18
- 17
public/js/wn/views/doclistview.js Dosyayı Görüntüle

@@ -160,7 +160,7 @@ wn.views.DocListView = wn.ui.Listing.extend({
// make_new_doc can be overridden so that default values can be prefilled
// 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);
});
@@ -174,7 +174,7 @@ wn.views.DocListView = wn.ui.Listing.extend({
<p><button class="btn btn-info btn-small" list_view_doc="%(doctype)s">\
Make a new %(doctype_label)s</button>\
</p></div>', {
doctype_label: get_doctype_label(this.doctype),
doctype_label: wn._(this.doctype),
doctype: this.doctype
});
@@ -230,22 +230,23 @@ wn.views.DocListView = wn.ui.Listing.extend({
});
if(!dl.length)
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() {
var me = this


+ 7
- 4
webnotes/widgets/reportview.py Dosyayı Görüntüle

@@ -304,10 +304,13 @@ def delete_items():
doctype = webnotes.form_dict.get('doctype')
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()
def get_stats():


Yükleniyor…
İptal
Kaydet