[minor] [fix] bring back onload_post_render in transaction.js - ref: a9b1c091665bc35bdc516d9556e859de3b472bd5
diff --git a/patches/august_2013/p01_hr_settings.py b/patches/august_2013/p01_hr_settings.py
index 302611b..d34ef52 100644
--- a/patches/august_2013/p01_hr_settings.py
+++ b/patches/august_2013/p01_hr_settings.py
@@ -1,6 +1,7 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
+from __future__ import unicode_literals
import webnotes
def execute():
diff --git a/public/js/transaction.js b/public/js/transaction.js
index 7a1dc0c..67204f3 100644
--- a/public/js/transaction.js
+++ b/public/js/transaction.js
@@ -32,6 +32,21 @@
}
},
+ onload_post_render: function() {
+ if(this.frm.doc.__islocal && this.frm.doc.company && !this.frm.doc.customer) {
+ var me = this;
+ return this.frm.call({
+ doc: this.frm.doc,
+ method: "onload_post_render",
+ freeze: true,
+ callback: function(r) {
+ // remove this call when using client side mapper
+ me.set_default_values();
+ }
+ });
+ }
+ },
+
refresh: function() {
this.frm.clear_custom_buttons();
erpnext.hide_naming_series();
@@ -44,6 +59,17 @@
this.calculate_taxes_and_totals();
},
+ set_default_values: function() {
+ $.each(wn.model.get_doclist(this.frm.doctype, this.frm.docname), function(i, doc) {
+ var updated = wn.model.set_default_values(doc);
+ if(doc.parentfield) {
+ refresh_field(doc.parentfield);
+ } else {
+ refresh_field(updated);
+ }
+ });
+ },
+
company: function() {
if(this.frm.doc.company && this.frm.fields_dict.currency) {
if(!this.frm.doc.currency) {