From 01ba11c9f69824ee3d4559d7a900d35774422d67 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Mon, 1 Jul 2013 09:36:01 +0530 Subject: [PATCH 1/7] [journal voucher] [added opening entry] [cleanups] --- core/doctype/doctype/doctype.py | 2 +- public/js/legacy/widgets/form/form.js | 2 +- public/js/wn/model/model.js | 10 +++++++++- public/js/wn/views/formview.js | 1 - 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/core/doctype/doctype/doctype.py b/core/doctype/doctype/doctype.py index ba41d0cfe2..b6158d4254 100644 --- a/core/doctype/doctype/doctype.py +++ b/core/doctype/doctype/doctype.py @@ -91,7 +91,7 @@ class DocType: updatedb(self.doc.name) # update index - bean = webnotes.bean({"doctype":"Stock Ledger Entry"}) + bean = webnotes.bean({"doctype": self.doc.name}) bean.make_controller() if hasattr(bean.obj, "on_doctype_update"): bean.controller.on_doctype_update() diff --git a/public/js/legacy/widgets/form/form.js b/public/js/legacy/widgets/form/form.js index d2865e1344..41003873c0 100644 --- a/public/js/legacy/widgets/form/form.js +++ b/public/js/legacy/widgets/form/form.js @@ -413,7 +413,7 @@ _f.Frm.prototype.refresh = function(docname) { if (!this.opendocs[this.docname]) { this.check_doctype_conflict(this.docname); } else { - if(this.doc && this.doc.__last_sync_on && + if(this.doc && (!this.doc.__unsaved) && this.doc.__last_sync_on && (new Date() - this.doc.__last_sync_on) > (this.refresh_if_stale_for * 1000)) { this.reload_doc(); return; diff --git a/public/js/wn/model/model.js b/public/js/wn/model/model.js index 439fea4a00..2da082cb3d 100644 --- a/public/js/wn/model/model.js +++ b/public/js/wn/model/model.js @@ -290,6 +290,14 @@ $.extend(wn.model, { if(d) wn.model.clear_doc(d.doctype, d.name); }); }, + + clear_table: function(doctype, parenttype, parent, parentfield) { + $.each(locals[doctype] || {}, function(i, d) { + if(d.parent===parent && d.parenttype===parenttype && d.parentfield===parentfield) { + delete locals[doctype][d.name]; + } + }) + }, remove_from_locals: function(doctype, name) { this.clear_doclist(doctype, name); @@ -297,7 +305,7 @@ $.extend(wn.model, { delete wn.views.formview[doctype].frm.opendocs[name]; } }, - + clear_doc: function(doctype, name) { var doc = locals[doctype][name]; diff --git a/public/js/wn/views/formview.js b/public/js/wn/views/formview.js index e641378e7c..f36efd3652 100644 --- a/public/js/wn/views/formview.js +++ b/public/js/wn/views/formview.js @@ -31,7 +31,6 @@ wn.views.FormFactory = wn.views.Factory.extend({ } wn.model.with_doc(dt, dn, function(dn, r) { - if(r && r['403']) return; // not permitted if(!(locals[dt] && locals[dt][dn])) { From 1a77174a2728283523fc8e90015886a9cb67b627 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Mon, 1 Jul 2013 11:46:05 +0530 Subject: [PATCH 2/7] [item] default warehouse is selected with item --- webnotes/db.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/webnotes/db.py b/webnotes/db.py index 7cf98de69c..ecf55c3c7f 100644 --- a/webnotes/db.py +++ b/webnotes/db.py @@ -329,10 +329,10 @@ class Database: try: return self.get_values_from_table(fields, filters, doctype, as_dict, debug) except Exception, e: - if e.args[0]!=1146: + if ignore and e.args[0] in (1146, 1054): + return None + else: raise e - - # not a table, try in singles return self.get_values_from_single(fields, filters, doctype, as_dict, debug) From 3dd62e7a3f32c99ee919c4ca8510bd276a8021b0 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Mon, 1 Jul 2013 12:59:20 +0530 Subject: [PATCH 3/7] [print] fix wnframework #192, fix in journal voucher --- public/js/legacy/widgets/form/form.js | 4 ++-- public/js/legacy/widgets/form/print_format.js | 4 +++- public/js/wn/form/script_manager.js | 6 +----- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/public/js/legacy/widgets/form/form.js b/public/js/legacy/widgets/form/form.js index 41003873c0..d502e3c9c1 100644 --- a/public/js/legacy/widgets/form/form.js +++ b/public/js/legacy/widgets/form/form.js @@ -212,8 +212,8 @@ _f.Frm.prototype.setup_std_layout = function() { _f.Frm.prototype.setup_print = function() { this.print_formats = wn.meta.get_print_formats(this.meta.name); - this.print_sel = $a(null, 'select', '', {width:'160px'}); - add_sel_options(this.print_sel, this.print_formats); + this.print_sel = $("