[minor] [fix] call company trigger in onload for a new selling/buying transaction

This commit is contained in:
Anand Doshi 2013-07-19 13:51:07 +05:30
parent 82e006917a
commit 535d833523
2 changed files with 7 additions and 6 deletions

View File

@ -103,7 +103,7 @@
<tr> <tr>
<td>Net Total</td> <td>Net Total</td>
<td width=40% style="text-align: right;">{{ <td width=40% style="text-align: right;">{{
utils.fmt_money(doc.net_total/doc.conversion_rate, currency=doc.currency) utils.fmt_money(doc.net_total_export, currency=doc.currency)
}}</td> }}</td>
</tr> </tr>
{%- for charge in doclist.get({"doctype":"Sales Taxes and Charges"}) -%} {%- for charge in doclist.get({"doctype":"Sales Taxes and Charges"}) -%}

View File

@ -39,6 +39,8 @@ erpnext.TransactionController = wn.ui.form.Controller.extend({
if(me.frm.fields_dict[fieldname] && !me.frm.doc[fieldname]) if(me.frm.fields_dict[fieldname] && !me.frm.doc[fieldname])
me.frm.set_value(fieldname, value); me.frm.set_value(fieldname, value);
}); });
me.frm.script_manager.trigger("company");
} }
}, },
@ -75,9 +77,9 @@ erpnext.TransactionController = wn.ui.form.Controller.extend({
var me = this; var me = this;
var company_currency = this.get_company_currency(); var company_currency = this.get_company_currency();
$.each(["currency", "price_list_currency"], function(i, fieldname) { $.each(["currency", "price_list_currency"], function(i, fieldname) {
if(!me.doc[fieldname]) { if(!me.frm.doc[fieldname]) {
me.frm.set_value(fieldname, company_currency); me.frm.set_value(fieldname, company_currency);
me[fieldname](); me.script_manager.trigger(fieldname);
} }
}); });
} }
@ -106,9 +108,8 @@ erpnext.TransactionController = wn.ui.form.Controller.extend({
}, },
conversion_rate: function() { conversion_rate: function() {
if(this.frm.doc.currency === this.get_company_currency() && if(this.frm.doc.currency === this.get_company_currency()) {
this.frm.doc.conversion_rate !== 1.0) { this.frm.set_value("conversion_rate", 1.0);
this.frm.set_value("conversion_rate", 1.0);
} else if(this.frm.doc.currency === this.frm.doc.price_list_currency && } else if(this.frm.doc.currency === this.frm.doc.price_list_currency &&
this.frm.doc.plc_conversion_rate !== this.frm.doc.conversion_rate) { this.frm.doc.plc_conversion_rate !== this.frm.doc.conversion_rate) {
this.frm.set_value("plc_conversion_rate", this.frm.doc.conversion_rate); this.frm.set_value("plc_conversion_rate", this.frm.doc.conversion_rate);