[minor] [fix] bring back onload_post_render in transaction.js - ref: a9b1c091665bc35bdc516d9556e859de3b472bd5

This commit is contained in:
Anand Doshi 2013-08-06 17:23:44 +05:30
parent cf8e2cbde0
commit 5e4e5d78df
2 changed files with 27 additions and 0 deletions

View File

@ -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():

View File

@ -32,6 +32,21 @@ erpnext.TransactionController = erpnext.stock.StockController.extend({
}
},
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 @@ erpnext.TransactionController = erpnext.stock.StockController.extend({
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) {