[fix] [minor] show stock ledger, general ledger, fixes post changes in script manager trigger [issue] webnotes/wnframework#228

This commit is contained in:
Anand Doshi
2013-07-30 14:42:15 +05:30
parent 7180eb6f20
commit a648f46d4e
16 changed files with 106 additions and 103 deletions

View File

@@ -18,10 +18,20 @@ wn.provide("erpnext.accounts");
erpnext.accounts.JournalVoucher = wn.ui.form.Controller.extend({
onload: function() {
this.load_defaults(this.frm.doc);
this.load_defaults();
this.setup_queries();
},
load_defaults: function() {
if(this.frm.doc.__islocal && this.frm.doc.company) {
wn.model.set_default_values(this.frm.doc);
$.each(wn.model.get_doclist(this.frm.doc.doctype, this.frm.doc.name, {parentfield: "entries"}),
function(i, jvd) { wn.model.set_default_values(jvd); });
this.frm.doc.posting_date = get_today();
}
},
setup_queries: function() {
var me = this;
@@ -82,23 +92,6 @@ cur_frm.cscript.refresh = function(doc) {
}
}
cur_frm.cscript.load_defaults = function(doc) {
if(!cur_frm.doc.__islocal || !cur_frm.doc.company) { return; }
doc = locals[doc.doctype][doc.name];
var fields_to_refresh = wn.model.set_default_values(doc);
if(fields_to_refresh) { refresh_many(fields_to_refresh); }
fields_to_refresh = null;
var children = getchildren('Journal Voucher Detail', doc.name, 'entries');
if(!children) { return; }
for(var i=0; i<children.length; i++) {
wn.model.set_default_values(children[i]);
}
refresh_field('entries');
}
cur_frm.cscript.is_opening = function(doc, cdt, cdn) {
hide_field('aging_date');
if (doc.is_opening == 'Yes') unhide_field('aging_date');

View File

@@ -133,6 +133,8 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
},
is_pos: function() {
cur_frm.cscript.hide_fields(this.frm.doc);
if(cint(this.frm.doc.is_pos)) {
if(!this.frm.doc.company) {
this.frm.set_value("is_pos", 0);
@@ -145,9 +147,6 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
});
}
}
// TODO toggle display of fields
cur_frm.cscript.hide_fields(this.frm.doc);
},
debit_to: function() {
@@ -191,8 +190,7 @@ $.extend(cur_frm.cscript, new erpnext.accounts.SalesInvoiceController({frm: cur_
// Hide Fields
// ------------
cur_frm.cscript.hide_fields = function(doc) {
par_flds = ['project_name', 'due_date', 'is_opening', 'conversion_rate',
'source', 'total_advance', 'gross_profit',
par_flds = ['project_name', 'due_date', 'is_opening', 'source', 'total_advance', 'gross_profit',
'gross_profit_percent', 'get_advances_received',
'advance_adjustment_details', 'sales_partner', 'commission_rate',
'total_commission', 'advances'];