Merge branch 'master' of github.com:webnotes/erpnext
This commit is contained in:
commit
e3742322fb
@ -104,7 +104,7 @@ cur_frm.cscript.add_toolbar_buttons = function(doc) {
|
|||||||
// Convert group to ledger
|
// Convert group to ledger
|
||||||
// -----------------------------------------
|
// -----------------------------------------
|
||||||
cur_frm.cscript.convert_to_ledger = function(doc, cdt, cdn) {
|
cur_frm.cscript.convert_to_ledger = function(doc, cdt, cdn) {
|
||||||
$c_obj(cur_frm.get_doclist(),'convert_group_to_ledger','',function(r,rt) {
|
return $c_obj(cur_frm.get_doclist(),'convert_group_to_ledger','',function(r,rt) {
|
||||||
if(r.message == 1) {
|
if(r.message == 1) {
|
||||||
cur_frm.refresh();
|
cur_frm.refresh();
|
||||||
}
|
}
|
||||||
@ -114,7 +114,7 @@ cur_frm.cscript.convert_to_ledger = function(doc, cdt, cdn) {
|
|||||||
// Convert ledger to group
|
// Convert ledger to group
|
||||||
// -----------------------------------------
|
// -----------------------------------------
|
||||||
cur_frm.cscript.convert_to_group = function(doc, cdt, cdn) {
|
cur_frm.cscript.convert_to_group = function(doc, cdt, cdn) {
|
||||||
$c_obj(cur_frm.get_doclist(),'convert_ledger_to_group','',function(r,rt) {
|
return $c_obj(cur_frm.get_doclist(),'convert_ledger_to_group','',function(r,rt) {
|
||||||
if(r.message == 1) {
|
if(r.message == 1) {
|
||||||
cur_frm.refresh();
|
cur_frm.refresh();
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ cur_frm.cscript.onload = function(doc,cdt,cdn){
|
|||||||
refresh_field('budget_distribution_details');
|
refresh_field('budget_distribution_details');
|
||||||
}
|
}
|
||||||
|
|
||||||
$c('runserverobj',args={'method' : 'get_months', 'docs' :
|
return $c('runserverobj',args={'method' : 'get_months', 'docs' :
|
||||||
wn.model.compress(make_doclist(doc.doctype, doc.name))},callback1);
|
wn.model.compress(make_doclist(doc.doctype, doc.name))},callback1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,5 +34,5 @@ cur_frm.fields_dict.state.get_query = function(doc) {
|
|||||||
|
|
||||||
cur_frm.cscript.invoice_no = function(doc, cdt, cdn) {
|
cur_frm.cscript.invoice_no = function(doc, cdt, cdn) {
|
||||||
var d = locals[cdt][cdn];
|
var d = locals[cdt][cdn];
|
||||||
get_server_fields('get_invoice_details', d.invoice_no, 'invoice_details', doc, cdt, cdn, 1);
|
return get_server_fields('get_invoice_details', d.invoice_no, 'invoice_details', doc, cdt, cdn, 1);
|
||||||
}
|
}
|
@ -84,7 +84,7 @@ cur_frm.cscript.hide_unhide_group_ledger = function(doc) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.convert_to_ledger = function(doc, cdt, cdn) {
|
cur_frm.cscript.convert_to_ledger = function(doc, cdt, cdn) {
|
||||||
$c_obj(cur_frm.get_doclist(),'convert_group_to_ledger','',function(r,rt) {
|
return $c_obj(cur_frm.get_doclist(),'convert_group_to_ledger','',function(r,rt) {
|
||||||
if(r.message == 1) {
|
if(r.message == 1) {
|
||||||
cur_frm.refresh();
|
cur_frm.refresh();
|
||||||
}
|
}
|
||||||
@ -92,7 +92,7 @@ cur_frm.cscript.convert_to_ledger = function(doc, cdt, cdn) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.convert_to_group = function(doc, cdt, cdn) {
|
cur_frm.cscript.convert_to_group = function(doc, cdt, cdn) {
|
||||||
$c_obj(cur_frm.get_doclist(),'convert_ledger_to_group','',function(r,rt) {
|
return $c_obj(cur_frm.get_doclist(),'convert_ledger_to_group','',function(r,rt) {
|
||||||
if(r.message == 1) {
|
if(r.message == 1) {
|
||||||
cur_frm.refresh();
|
cur_frm.refresh();
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@ cur_frm.cscript.refresh = function(doc, dt, dn) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.set_as_default = function() {
|
cur_frm.cscript.set_as_default = function() {
|
||||||
wn.call({
|
return wn.call({
|
||||||
doc: cur_frm.doc,
|
doc: cur_frm.doc,
|
||||||
method: "set_as_default"
|
method: "set_as_default"
|
||||||
});
|
});
|
||||||
|
@ -151,7 +151,7 @@ class DocType:
|
|||||||
balance = webnotes.conn.sql("""select sum(debit) - sum(credit) from `tabGL Entry`
|
balance = webnotes.conn.sql("""select sum(debit) - sum(credit) from `tabGL Entry`
|
||||||
where account = %s and ifnull(is_cancelled, 'No') = 'No'""", self.doc.account)
|
where account = %s and ifnull(is_cancelled, 'No') = 'No'""", self.doc.account)
|
||||||
balance = account["debit_or_credit"] == "Debit" and \
|
balance = account["debit_or_credit"] == "Debit" and \
|
||||||
balance[0][0] or -1*balance[0][0]
|
flt(balance[0][0]) or -1*flt(balance[0][0])
|
||||||
|
|
||||||
if flt(balance) < 0:
|
if flt(balance) < 0:
|
||||||
msgprint(_("Negative balance is not allowed for account ") + self.doc.account,
|
msgprint(_("Negative balance is not allowed for account ") + self.doc.account,
|
||||||
|
@ -18,10 +18,20 @@ wn.provide("erpnext.accounts");
|
|||||||
|
|
||||||
erpnext.accounts.JournalVoucher = wn.ui.form.Controller.extend({
|
erpnext.accounts.JournalVoucher = wn.ui.form.Controller.extend({
|
||||||
onload: function() {
|
onload: function() {
|
||||||
this.load_defaults(this.frm.doc);
|
this.load_defaults();
|
||||||
this.setup_queries();
|
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() {
|
setup_queries: function() {
|
||||||
var me = this;
|
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) {
|
cur_frm.cscript.is_opening = function(doc, cdt, cdn) {
|
||||||
hide_field('aging_date');
|
hide_field('aging_date');
|
||||||
if (doc.is_opening == 'Yes') unhide_field('aging_date');
|
if (doc.is_opening == 'Yes') unhide_field('aging_date');
|
||||||
@ -108,7 +101,7 @@ cur_frm.cscript.against_voucher = function(doc,cdt,cdn) {
|
|||||||
var d = locals[cdt][cdn];
|
var d = locals[cdt][cdn];
|
||||||
if (d.against_voucher && !flt(d.debit)) {
|
if (d.against_voucher && !flt(d.debit)) {
|
||||||
args = {'doctype': 'Purchase Invoice', 'docname': d.against_voucher }
|
args = {'doctype': 'Purchase Invoice', 'docname': d.against_voucher }
|
||||||
get_server_fields('get_outstanding',docstring(args),'entries',doc,cdt,cdn,1,function(r,rt) { cur_frm.cscript.update_totals(doc); });
|
return get_server_fields('get_outstanding',docstring(args),'entries',doc,cdt,cdn,1,function(r,rt) { cur_frm.cscript.update_totals(doc); });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -116,7 +109,7 @@ cur_frm.cscript.against_invoice = function(doc,cdt,cdn) {
|
|||||||
var d = locals[cdt][cdn];
|
var d = locals[cdt][cdn];
|
||||||
if (d.against_invoice && !flt(d.credit)) {
|
if (d.against_invoice && !flt(d.credit)) {
|
||||||
args = {'doctype': 'Sales Invoice', 'docname': d.against_invoice }
|
args = {'doctype': 'Sales Invoice', 'docname': d.against_invoice }
|
||||||
get_server_fields('get_outstanding',docstring(args),'entries',doc,cdt,cdn,1,function(r,rt) { cur_frm.cscript.update_totals(doc); });
|
return get_server_fields('get_outstanding',docstring(args),'entries',doc,cdt,cdn,1,function(r,rt) { cur_frm.cscript.update_totals(doc); });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -141,7 +134,7 @@ cur_frm.cscript.credit = function(doc,dt,dn) { cur_frm.cscript.update_totals(doc
|
|||||||
|
|
||||||
cur_frm.cscript.get_balance = function(doc,dt,dn) {
|
cur_frm.cscript.get_balance = function(doc,dt,dn) {
|
||||||
cur_frm.cscript.update_totals(doc);
|
cur_frm.cscript.update_totals(doc);
|
||||||
$c_obj(make_doclist(dt,dn), 'get_balance', '', function(r, rt){
|
return $c_obj(make_doclist(dt,dn), 'get_balance', '', function(r, rt){
|
||||||
cur_frm.refresh();
|
cur_frm.refresh();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -151,7 +144,7 @@ cur_frm.cscript.get_balance = function(doc,dt,dn) {
|
|||||||
cur_frm.cscript.account = function(doc,dt,dn) {
|
cur_frm.cscript.account = function(doc,dt,dn) {
|
||||||
var d = locals[dt][dn];
|
var d = locals[dt][dn];
|
||||||
if(d.account) {
|
if(d.account) {
|
||||||
wn.call({
|
return wn.call({
|
||||||
method: "accounts.utils.get_balance_on",
|
method: "accounts.utils.get_balance_on",
|
||||||
args: {account: d.account, date: doc.posting_date},
|
args: {account: d.account, date: doc.posting_date},
|
||||||
callback: function(r) {
|
callback: function(r) {
|
||||||
@ -193,7 +186,7 @@ cur_frm.cscript.voucher_type = function(doc, cdt, cdn) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(in_list(["Bank Voucher", "Cash Voucher"], doc.voucher_type)) {
|
if(in_list(["Bank Voucher", "Cash Voucher"], doc.voucher_type)) {
|
||||||
wn.call({
|
return wn.call({
|
||||||
type: "GET",
|
type: "GET",
|
||||||
method: "accounts.doctype.journal_voucher.journal_voucher.get_default_bank_cash_account",
|
method: "accounts.doctype.journal_voucher.journal_voucher.get_default_bank_cash_account",
|
||||||
args: {
|
args: {
|
||||||
@ -207,7 +200,7 @@ cur_frm.cscript.voucher_type = function(doc, cdt, cdn) {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
} else if(doc.voucher_type=="Opening Entry") {
|
} else if(doc.voucher_type=="Opening Entry") {
|
||||||
wn.call({
|
return wn.call({
|
||||||
type:"GET",
|
type:"GET",
|
||||||
method: "accounts.doctype.journal_voucher.journal_voucher.get_opening_accounts",
|
method: "accounts.doctype.journal_voucher.journal_voucher.get_opening_accounts",
|
||||||
args: {
|
args: {
|
||||||
|
@ -49,11 +49,11 @@ cur_frm.fields_dict.voucher_no.get_query = function(doc) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.voucher_no =function(doc, cdt, cdn) {
|
cur_frm.cscript.voucher_no =function(doc, cdt, cdn) {
|
||||||
get_server_fields('get_voucher_details', '', '', doc, cdt, cdn, 1)
|
return get_server_fields('get_voucher_details', '', '', doc, cdt, cdn, 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.account = function(doc, cdt, cdn) {
|
cur_frm.cscript.account = function(doc, cdt, cdn) {
|
||||||
wn.call({
|
return wn.call({
|
||||||
doc: this.frm.doc,
|
doc: this.frm.doc,
|
||||||
method: "set_account_type",
|
method: "set_account_type",
|
||||||
callback: function(r) {
|
callback: function(r) {
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
cur_frm.cscript.onload = function(doc,cdt,cdn){
|
cur_frm.cscript.onload = function(doc,cdt,cdn){
|
||||||
$c_obj(make_doclist(cdt,cdn),'get_series','',function(r,rt){
|
return $c_obj(make_doclist(cdt,cdn),'get_series','',function(r,rt){
|
||||||
if(r.message) set_field_options('naming_series', r.message);
|
if(r.message) set_field_options('naming_series', r.message);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -118,7 +118,7 @@ cur_frm.cscript.is_opening = function(doc, dt, dn) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.make_bank_voucher = function() {
|
cur_frm.cscript.make_bank_voucher = function() {
|
||||||
wn.call({
|
return wn.call({
|
||||||
method: "accounts.doctype.journal_voucher.journal_voucher.get_default_bank_cash_account",
|
method: "accounts.doctype.journal_voucher.journal_voucher.get_default_bank_cash_account",
|
||||||
args: {
|
args: {
|
||||||
"company": cur_frm.doc.company,
|
"company": cur_frm.doc.company,
|
||||||
|
@ -156,7 +156,7 @@ cur_frm.cscript.account_head = function(doc, cdt, cdn) {
|
|||||||
}
|
}
|
||||||
else if(d.account_head && d.charge_type) {
|
else if(d.account_head && d.charge_type) {
|
||||||
arg = "{'charge_type' : '" + d.charge_type + "', 'account_head' : '" + d.account_head + "'}";
|
arg = "{'charge_type' : '" + d.charge_type + "', 'account_head' : '" + d.account_head + "'}";
|
||||||
get_server_fields('get_rate', arg, 'purchase_tax_details', doc, cdt, cdn, 1);
|
return get_server_fields('get_rate', arg, 'purchase_tax_details', doc, cdt, cdn, 1);
|
||||||
}
|
}
|
||||||
refresh_field('account_head',d.name,'purchase_tax_details');
|
refresh_field('account_head',d.name,'purchase_tax_details');
|
||||||
}
|
}
|
||||||
|
@ -133,21 +133,25 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
|
|||||||
},
|
},
|
||||||
|
|
||||||
is_pos: function() {
|
is_pos: function() {
|
||||||
|
cur_frm.cscript.hide_fields(this.frm.doc);
|
||||||
|
|
||||||
if(cint(this.frm.doc.is_pos)) {
|
if(cint(this.frm.doc.is_pos)) {
|
||||||
if(!this.frm.doc.company) {
|
if(!this.frm.doc.company) {
|
||||||
this.frm.set_value("is_pos", 0);
|
this.frm.set_value("is_pos", 0);
|
||||||
msgprint(wn._("Please specify Company to proceed"));
|
msgprint(wn._("Please specify Company to proceed"));
|
||||||
} else {
|
} else {
|
||||||
var me = this;
|
var me = this;
|
||||||
this.frm.call({
|
return this.frm.call({
|
||||||
doc: me.frm.doc,
|
doc: me.frm.doc,
|
||||||
method: "set_missing_values",
|
method: "set_missing_values",
|
||||||
|
callback: function(r) {
|
||||||
|
if(!r.exc) {
|
||||||
|
me.frm.script_manager.trigger("update_stock");
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO toggle display of fields
|
|
||||||
cur_frm.cscript.hide_fields(this.frm.doc);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
debit_to: function() {
|
debit_to: function() {
|
||||||
@ -191,8 +195,7 @@ $.extend(cur_frm.cscript, new erpnext.accounts.SalesInvoiceController({frm: cur_
|
|||||||
// Hide Fields
|
// Hide Fields
|
||||||
// ------------
|
// ------------
|
||||||
cur_frm.cscript.hide_fields = function(doc) {
|
cur_frm.cscript.hide_fields = function(doc) {
|
||||||
par_flds = ['project_name', 'due_date', 'is_opening', 'conversion_rate',
|
par_flds = ['project_name', 'due_date', 'is_opening', 'source', 'total_advance', 'gross_profit',
|
||||||
'source', 'total_advance', 'gross_profit',
|
|
||||||
'gross_profit_percent', 'get_advances_received',
|
'gross_profit_percent', 'get_advances_received',
|
||||||
'advance_adjustment_details', 'sales_partner', 'commission_rate',
|
'advance_adjustment_details', 'sales_partner', 'commission_rate',
|
||||||
'total_commission', 'advances'];
|
'total_commission', 'advances'];
|
||||||
@ -222,7 +225,7 @@ cur_frm.cscript.hide_fields = function(doc) {
|
|||||||
|
|
||||||
|
|
||||||
cur_frm.cscript.mode_of_payment = function(doc) {
|
cur_frm.cscript.mode_of_payment = function(doc) {
|
||||||
cur_frm.call({
|
return cur_frm.call({
|
||||||
method: "get_bank_cash_account",
|
method: "get_bank_cash_account",
|
||||||
args: { mode_of_payment: doc.mode_of_payment }
|
args: { mode_of_payment: doc.mode_of_payment }
|
||||||
});
|
});
|
||||||
@ -248,7 +251,7 @@ cur_frm.cscript['Make Delivery Note'] = function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.make_bank_voucher = function() {
|
cur_frm.cscript.make_bank_voucher = function() {
|
||||||
wn.call({
|
return wn.call({
|
||||||
method: "accounts.doctype.journal_voucher.journal_voucher.get_default_bank_cash_account",
|
method: "accounts.doctype.journal_voucher.journal_voucher.get_default_bank_cash_account",
|
||||||
args: {
|
args: {
|
||||||
"company": cur_frm.doc.company,
|
"company": cur_frm.doc.company,
|
||||||
|
@ -165,7 +165,7 @@ cur_frm.cscript.account_head = function(doc, cdt, cdn) {
|
|||||||
}
|
}
|
||||||
else if(d.account_head && d.charge_type) {
|
else if(d.account_head && d.charge_type) {
|
||||||
arg = "{'charge_type' : '" + d.charge_type +"', 'account_head' : '" + d.account_head + "'}";
|
arg = "{'charge_type' : '" + d.charge_type +"', 'account_head' : '" + d.account_head + "'}";
|
||||||
get_server_fields('get_rate', arg, 'other_charges', doc, cdt, cdn, 1);
|
return get_server_fields('get_rate', arg, 'other_charges', doc, cdt, cdn, 1);
|
||||||
}
|
}
|
||||||
refresh_field('account_head',d.name,'other_charges');
|
refresh_field('account_head',d.name,'other_charges');
|
||||||
}
|
}
|
||||||
|
@ -73,7 +73,7 @@ pscript['onload_Accounts Browser'] = function(wrapper){
|
|||||||
})
|
})
|
||||||
|
|
||||||
// load up companies
|
// load up companies
|
||||||
wn.call({
|
return wn.call({
|
||||||
method:'accounts.page.accounts_browser.accounts_browser.get_companies',
|
method:'accounts.page.accounts_browser.accounts_browser.get_companies',
|
||||||
callback: function(r) {
|
callback: function(r) {
|
||||||
wrapper.$company_select.empty();
|
wrapper.$company_select.empty();
|
||||||
@ -265,7 +265,7 @@ erpnext.AccountsChart = Class.extend({
|
|||||||
v.master_type = '';
|
v.master_type = '';
|
||||||
v.company = me.company;
|
v.company = me.company;
|
||||||
|
|
||||||
wn.call({
|
return wn.call({
|
||||||
args: v,
|
args: v,
|
||||||
method:'accounts.utils.add_ac',
|
method:'accounts.utils.add_ac',
|
||||||
callback: function(r) {
|
callback: function(r) {
|
||||||
@ -312,7 +312,7 @@ erpnext.AccountsChart = Class.extend({
|
|||||||
v.parent_cost_center = node.data('label');
|
v.parent_cost_center = node.data('label');
|
||||||
v.company = me.company;
|
v.company = me.company;
|
||||||
|
|
||||||
wn.call({
|
return wn.call({
|
||||||
args: v,
|
args: v,
|
||||||
method:'accounts.utils.add_cc',
|
method:'accounts.utils.add_cc',
|
||||||
callback: function(r) {
|
callback: function(r) {
|
||||||
|
@ -62,7 +62,7 @@ pscript['onload_Financial Statements'] = function(wrapper) {
|
|||||||
</div>').css({"min-height": "400px"});
|
</div>').css({"min-height": "400px"});
|
||||||
|
|
||||||
// load companies
|
// load companies
|
||||||
$c_obj('MIS Control','get_comp','', function(r,rt) {
|
return $c_obj('MIS Control','get_comp','', function(r,rt) {
|
||||||
// company
|
// company
|
||||||
erpnext.fs.stmt_company.$input.empty()
|
erpnext.fs.stmt_company.$input.empty()
|
||||||
.add_options(['Select Company...'].concat(r.message.company));
|
.add_options(['Select Company...'].concat(r.message.company));
|
||||||
@ -86,7 +86,7 @@ pscript.stmt_new = function(stmt,company_name,level,period,year) {
|
|||||||
year: erpnext.fs.stmt_fiscal_year.get_value()
|
year: erpnext.fs.stmt_fiscal_year.get_value()
|
||||||
}
|
}
|
||||||
|
|
||||||
$c_obj('MIS Control', 'get_statement', docstring(arg), function(r,rt) {
|
return $c_obj('MIS Control', 'get_statement', docstring(arg), function(r,rt) {
|
||||||
var nl = r.message;
|
var nl = r.message;
|
||||||
var t = $i('stmt_tree');
|
var t = $i('stmt_tree');
|
||||||
var stmt_type = erpnext.fs.stmt_type.get_value();
|
var stmt_type = erpnext.fs.stmt_type.get_value();
|
||||||
|
@ -92,7 +92,7 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
|
|||||||
var me = this;
|
var me = this;
|
||||||
var price_list_name = this.frm.doc.price_list_name;
|
var price_list_name = this.frm.doc.price_list_name;
|
||||||
|
|
||||||
this.frm.call({
|
return this.frm.call({
|
||||||
doc: this.frm.doc,
|
doc: this.frm.doc,
|
||||||
method: "set_supplier_defaults",
|
method: "set_supplier_defaults",
|
||||||
freeze: true,
|
freeze: true,
|
||||||
@ -109,7 +109,7 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
|
|||||||
supplier_address: function() {
|
supplier_address: function() {
|
||||||
var me = this;
|
var me = this;
|
||||||
if (this.frm.doc.supplier) {
|
if (this.frm.doc.supplier) {
|
||||||
wn.call({
|
return wn.call({
|
||||||
doc: this.frm.doc,
|
doc: this.frm.doc,
|
||||||
method: "set_supplier_address",
|
method: "set_supplier_address",
|
||||||
freeze: true,
|
freeze: true,
|
||||||
@ -134,7 +134,7 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
|
|||||||
item.item_code = null;
|
item.item_code = null;
|
||||||
refresh_field("item_code", item.name, item.parentfield);
|
refresh_field("item_code", item.name, item.parentfield);
|
||||||
} else {
|
} else {
|
||||||
this.frm.call({
|
return this.frm.call({
|
||||||
method: "buying.utils.get_item_details",
|
method: "buying.utils.get_item_details",
|
||||||
child: item,
|
child: item,
|
||||||
args: {
|
args: {
|
||||||
@ -200,7 +200,7 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
|
|||||||
var me = this;
|
var me = this;
|
||||||
var item = wn.model.get_doc(cdt, cdn);
|
var item = wn.model.get_doc(cdt, cdn);
|
||||||
if(item.item_code && item.uom) {
|
if(item.item_code && item.uom) {
|
||||||
this.frm.call({
|
return this.frm.call({
|
||||||
method: "buying.utils.get_conversion_factor",
|
method: "buying.utils.get_conversion_factor",
|
||||||
child: item,
|
child: item,
|
||||||
args: {
|
args: {
|
||||||
@ -233,7 +233,7 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
|
|||||||
warehouse: function(doc, cdt, cdn) {
|
warehouse: function(doc, cdt, cdn) {
|
||||||
var item = wn.model.get_doc(cdt, cdn);
|
var item = wn.model.get_doc(cdt, cdn);
|
||||||
if(item.item_code && item.warehouse) {
|
if(item.item_code && item.warehouse) {
|
||||||
this.frm.call({
|
return this.frm.call({
|
||||||
method: "buying.utils.get_projected_qty",
|
method: "buying.utils.get_projected_qty",
|
||||||
child: item,
|
child: item,
|
||||||
args: {
|
args: {
|
||||||
@ -267,7 +267,7 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
|
|||||||
purchase_other_charges: function() {
|
purchase_other_charges: function() {
|
||||||
var me = this;
|
var me = this;
|
||||||
if(this.frm.doc.purchase_other_charges) {
|
if(this.frm.doc.purchase_other_charges) {
|
||||||
this.frm.call({
|
return this.frm.call({
|
||||||
doc: this.frm.doc,
|
doc: this.frm.doc,
|
||||||
method: "get_purchase_tax_details",
|
method: "get_purchase_tax_details",
|
||||||
callback: function(r) {
|
callback: function(r) {
|
||||||
|
@ -76,7 +76,11 @@ class DocType(BuyingController):
|
|||||||
elif is_submit == 1:
|
elif is_submit == 1:
|
||||||
# even if this transaction is the latest one, it should be submitted
|
# even if this transaction is the latest one, it should be submitted
|
||||||
# for it to be considered for latest purchase rate
|
# for it to be considered for latest purchase rate
|
||||||
last_purchase_rate = flt(d.purchase_rate) / flt(d.conversion_factor)
|
if flt(d.conversion_factor):
|
||||||
|
last_purchase_rate = flt(d.purchase_rate) / flt(d.conversion_factor)
|
||||||
|
else:
|
||||||
|
msgprint(_("Row ") + cstr(d.idx) + ": " +
|
||||||
|
_("UOM Conversion Factor is mandatory"), raise_exception=1)
|
||||||
|
|
||||||
# update last purchsae rate
|
# update last purchsae rate
|
||||||
if last_purchase_rate:
|
if last_purchase_rate:
|
||||||
|
@ -140,7 +140,7 @@ cur_frm.fields_dict['po_details'].grid.get_field('project_name').get_query = fun
|
|||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.get_last_purchase_rate = function(doc, cdt, cdn){
|
cur_frm.cscript.get_last_purchase_rate = function(doc, cdt, cdn){
|
||||||
$c_obj(make_doclist(doc.doctype, doc.name), 'get_last_purchase_rate', '', function(r, rt) {
|
return $c_obj(make_doclist(doc.doctype, doc.name), 'get_last_purchase_rate', '', function(r, rt) {
|
||||||
refresh_field(cur_frm.cscript.fname);
|
refresh_field(cur_frm.cscript.fname);
|
||||||
var doc = locals[cdt][cdn];
|
var doc = locals[cdt][cdn];
|
||||||
cur_frm.cscript.calc_amount( doc, 2);
|
cur_frm.cscript.calc_amount( doc, 2);
|
||||||
@ -152,7 +152,7 @@ cur_frm.cscript['Stop Purchase Order'] = function() {
|
|||||||
var check = confirm("Do you really want to STOP " + doc.name);
|
var check = confirm("Do you really want to STOP " + doc.name);
|
||||||
|
|
||||||
if (check) {
|
if (check) {
|
||||||
$c('runserverobj', args={'method':'update_status', 'arg': 'Stopped', 'docs': wn.model.compress(make_doclist(doc.doctype, doc.name))}, function(r,rt) {
|
return $c('runserverobj', args={'method':'update_status', 'arg': 'Stopped', 'docs': wn.model.compress(make_doclist(doc.doctype, doc.name))}, function(r,rt) {
|
||||||
cur_frm.refresh();
|
cur_frm.refresh();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -163,7 +163,7 @@ cur_frm.cscript['Unstop Purchase Order'] = function() {
|
|||||||
var check = confirm("Do you really want to UNSTOP " + doc.name);
|
var check = confirm("Do you really want to UNSTOP " + doc.name);
|
||||||
|
|
||||||
if (check) {
|
if (check) {
|
||||||
$c('runserverobj', args={'method':'update_status', 'arg': 'Submitted', 'docs': wn.model.compress(make_doclist(doc.doctype, doc.name))}, function(r,rt) {
|
return $c('runserverobj', args={'method':'update_status', 'arg': 'Submitted', 'docs': wn.model.compress(make_doclist(doc.doctype, doc.name))}, function(r,rt) {
|
||||||
cur_frm.refresh();
|
cur_frm.refresh();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
cur_frm.cscript.item_code = function(doc, cdt, cdn) {
|
cur_frm.cscript.item_code = function(doc, cdt, cdn) {
|
||||||
if (doc.item_code)
|
if (doc.item_code)
|
||||||
get_server_fields('get_purchase_receipt_item_details','','',doc,cdt,cdn,1);
|
return get_server_fields('get_purchase_receipt_item_details','','',doc,cdt,cdn,1);
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.inspection_type = function(doc, cdt, cdn) {
|
cur_frm.cscript.inspection_type = function(doc, cdt, cdn) {
|
||||||
|
@ -55,7 +55,7 @@ cur_frm.cscript.make_dashboard = function(doc) {
|
|||||||
cur_frm.dashboard.add_doctype_badge("Purchase Receipt", "supplier");
|
cur_frm.dashboard.add_doctype_badge("Purchase Receipt", "supplier");
|
||||||
cur_frm.dashboard.add_doctype_badge("Purchase Invoice", "supplier");
|
cur_frm.dashboard.add_doctype_badge("Purchase Invoice", "supplier");
|
||||||
|
|
||||||
wn.call({
|
return wn.call({
|
||||||
type: "GET",
|
type: "GET",
|
||||||
method:"buying.doctype.supplier.supplier.get_dashboard_info",
|
method:"buying.doctype.supplier.supplier.get_dashboard_info",
|
||||||
args: {
|
args: {
|
||||||
|
@ -36,12 +36,8 @@ def get_filters_cond(doctype, filters, conditions):
|
|||||||
return cond
|
return cond
|
||||||
|
|
||||||
def get_match_cond(doctype, searchfield = 'name'):
|
def get_match_cond(doctype, searchfield = 'name'):
|
||||||
meta = webnotes.get_doctype(doctype)
|
|
||||||
from webnotes.widgets.search import get_std_fields_list
|
|
||||||
fields = get_std_fields_list(meta, searchfield)
|
|
||||||
|
|
||||||
from webnotes.widgets.reportview import build_match_conditions
|
from webnotes.widgets.reportview import build_match_conditions
|
||||||
cond = build_match_conditions(doctype, fields)
|
cond = build_match_conditions(doctype)
|
||||||
|
|
||||||
if cond:
|
if cond:
|
||||||
cond = ' and ' + cond
|
cond = ' and ' + cond
|
||||||
|
@ -9,7 +9,7 @@ wn.pages['latest-updates'].onload = function(wrapper) {
|
|||||||
parent.html('<div class="progress progress-striped active">\
|
parent.html('<div class="progress progress-striped active">\
|
||||||
<div class="progress-bar" style="width: 100%;"></div></div>')
|
<div class="progress-bar" style="width: 100%;"></div></div>')
|
||||||
|
|
||||||
wn.call({
|
return wn.call({
|
||||||
method:"home.page.latest_updates.latest_updates.get",
|
method:"home.page.latest_updates.latest_updates.get",
|
||||||
callback: function(r) {
|
callback: function(r) {
|
||||||
parent.empty();
|
parent.empty();
|
||||||
|
@ -44,7 +44,7 @@ cur_frm.cscript.kra_template = function(doc, dt, dn) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.calculate_total_score = function(doc,cdt,cdn){
|
cur_frm.cscript.calculate_total_score = function(doc,cdt,cdn){
|
||||||
//get_server_fields('calculate_total','','',doc,cdt,cdn,1);
|
//return get_server_fields('calculate_total','','',doc,cdt,cdn,1);
|
||||||
var val = getchildren('Appraisal Goal', doc.name, 'appraisal_details', doc.doctype);
|
var val = getchildren('Appraisal Goal', doc.name, 'appraisal_details', doc.doctype);
|
||||||
var total =0;
|
var total =0;
|
||||||
for(var i = 0; i<val.length; i++){
|
for(var i = 0; i<val.length; i++){
|
||||||
|
@ -40,7 +40,7 @@ erpnext.hr.EmployeeController = wn.ui.form.Controller.extend({
|
|||||||
|
|
||||||
setup_leave_approver_select: function() {
|
setup_leave_approver_select: function() {
|
||||||
var me = this;
|
var me = this;
|
||||||
this.frm.call({
|
return this.frm.call({
|
||||||
method:"hr.utils.get_leave_approver_list",
|
method:"hr.utils.get_leave_approver_list",
|
||||||
callback: function(r) {
|
callback: function(r) {
|
||||||
me.frm.fields_dict.employee_leave_approvers.grid
|
me.frm.fields_dict.employee_leave_approvers.grid
|
||||||
@ -53,7 +53,7 @@ erpnext.hr.EmployeeController = wn.ui.form.Controller.extend({
|
|||||||
},
|
},
|
||||||
|
|
||||||
date_of_birth: function() {
|
date_of_birth: function() {
|
||||||
cur_frm.call({
|
return cur_frm.call({
|
||||||
method: "get_retirement_date",
|
method: "get_retirement_date",
|
||||||
args: {date_of_birth: this.frm.doc.date_of_birth}
|
args: {date_of_birth: this.frm.doc.date_of_birth}
|
||||||
});
|
});
|
||||||
@ -88,7 +88,7 @@ erpnext.hr.EmployeeController = wn.ui.form.Controller.extend({
|
|||||||
|
|
||||||
validate_salary_structure: function(btn, callback) {
|
validate_salary_structure: function(btn, callback) {
|
||||||
var me = this;
|
var me = this;
|
||||||
this.frm.call({
|
return this.frm.call({
|
||||||
btn: btn,
|
btn: btn,
|
||||||
method: "webnotes.client.get_value",
|
method: "webnotes.client.get_value",
|
||||||
args: {
|
args: {
|
||||||
|
@ -19,7 +19,7 @@ wn.provide("erpnext.hr");
|
|||||||
erpnext.hr.ExpenseClaimController = wn.ui.form.Controller.extend({
|
erpnext.hr.ExpenseClaimController = wn.ui.form.Controller.extend({
|
||||||
make_bank_voucher: function() {
|
make_bank_voucher: function() {
|
||||||
var me = this;
|
var me = this;
|
||||||
wn.call({
|
return wn.call({
|
||||||
method: "accounts.doctype.journal_voucher.journal_voucher.get_default_bank_cash_account",
|
method: "accounts.doctype.journal_voucher.journal_voucher.get_default_bank_cash_account",
|
||||||
args: {
|
args: {
|
||||||
"company": cur_frm.doc.company,
|
"company": cur_frm.doc.company,
|
||||||
@ -64,18 +64,18 @@ cur_frm.cscript.onload = function(doc,cdt,cdn) {
|
|||||||
cur_frm.cscript.clear_sanctioned(doc);
|
cur_frm.cscript.clear_sanctioned(doc);
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.call({
|
|
||||||
method:"hr.utils.get_expense_approver_list",
|
|
||||||
callback: function(r) {
|
|
||||||
cur_frm.set_df_property("exp_approver", "options", r.message);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
cur_frm.fields_dict.employee.get_query = function(doc,cdt,cdn) {
|
cur_frm.fields_dict.employee.get_query = function(doc,cdt,cdn) {
|
||||||
return{
|
return{
|
||||||
query:"controllers.queries.employee_query"
|
query:"controllers.queries.employee_query"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return cur_frm.call({
|
||||||
|
method:"hr.utils.get_expense_approver_list",
|
||||||
|
callback: function(r) {
|
||||||
|
cur_frm.set_df_property("exp_approver", "options", r.message);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.clear_sanctioned = function(doc) {
|
cur_frm.cscript.clear_sanctioned = function(doc) {
|
||||||
|
@ -72,7 +72,7 @@ cur_frm.cscript.new_leaves_allocated = function(doc, dt, dn) {
|
|||||||
// ---------------------------------
|
// ---------------------------------
|
||||||
calculate_total_leaves_allocated = function(doc, dt, dn) {
|
calculate_total_leaves_allocated = function(doc, dt, dn) {
|
||||||
if(cint(doc.carry_forward) == 1 && doc.leave_type && doc.fiscal_year && doc.employee){
|
if(cint(doc.carry_forward) == 1 && doc.leave_type && doc.fiscal_year && doc.employee){
|
||||||
get_server_fields('get_carry_forwarded_leaves','','', doc, dt, dn, 1);
|
return get_server_fields('get_carry_forwarded_leaves','','', doc, dt, dn, 1);
|
||||||
}
|
}
|
||||||
else if(cint(doc.carry_forward) == 0){
|
else if(cint(doc.carry_forward) == 0){
|
||||||
set_multiple(dt,dn,{carry_forwarded_leaves : 0,total_leaves_allocated : flt(doc.new_leaves_allocated)});
|
set_multiple(dt,dn,{carry_forwarded_leaves : 0,total_leaves_allocated : flt(doc.new_leaves_allocated)});
|
||||||
|
@ -24,7 +24,7 @@ cur_frm.cscript.onload = function(doc, dt, dn) {
|
|||||||
cur_frm.cscript.calculate_total_days(doc, dt, dn);
|
cur_frm.cscript.calculate_total_days(doc, dt, dn);
|
||||||
}
|
}
|
||||||
cur_frm.set_df_property("leave_approver", "options", "");
|
cur_frm.set_df_property("leave_approver", "options", "");
|
||||||
cur_frm.call({
|
return cur_frm.call({
|
||||||
method:"hr.utils.get_leave_approver_list",
|
method:"hr.utils.get_leave_approver_list",
|
||||||
callback: function(r) {
|
callback: function(r) {
|
||||||
cur_frm.set_df_property("leave_approver", "options", $.map(r.message,
|
cur_frm.set_df_property("leave_approver", "options", $.map(r.message,
|
||||||
@ -105,7 +105,7 @@ cur_frm.cscript.to_date = function(doc, dt, dn) {
|
|||||||
|
|
||||||
cur_frm.cscript.get_leave_balance = function(doc, dt, dn) {
|
cur_frm.cscript.get_leave_balance = function(doc, dt, dn) {
|
||||||
if(doc.docstatus==0 && doc.employee && doc.leave_type && doc.fiscal_year) {
|
if(doc.docstatus==0 && doc.employee && doc.leave_type && doc.fiscal_year) {
|
||||||
cur_frm.call({
|
return cur_frm.call({
|
||||||
method: "get_leave_balance",
|
method: "get_leave_balance",
|
||||||
args: {
|
args: {
|
||||||
employee: doc.employee,
|
employee: doc.employee,
|
||||||
@ -121,7 +121,7 @@ cur_frm.cscript.calculate_total_days = function(doc, dt, dn) {
|
|||||||
if(cint(doc.half_day) == 1) set_multiple(dt,dn,{total_leave_days:0.5});
|
if(cint(doc.half_day) == 1) set_multiple(dt,dn,{total_leave_days:0.5});
|
||||||
else{
|
else{
|
||||||
// server call is done to include holidays in leave days calculations
|
// server call is done to include holidays in leave days calculations
|
||||||
get_server_fields('get_total_leave_days', '', '', doc, dt, dn, 1);
|
return get_server_fields('get_total_leave_days', '', '', doc, dt, dn, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@ cur_frm.cscript.onload = function(doc,dt,dn){
|
|||||||
// Validation For To Date
|
// Validation For To Date
|
||||||
// ================================================================================================
|
// ================================================================================================
|
||||||
cur_frm.cscript.to_date = function(doc, cdt, cdn) {
|
cur_frm.cscript.to_date = function(doc, cdt, cdn) {
|
||||||
$c('runserverobj', args={'method':'to_date_validation','docs':wn.model.compress(make_doclist(doc.doctype, doc.name))},
|
return $c('runserverobj', args={'method':'to_date_validation','docs':wn.model.compress(make_doclist(doc.doctype, doc.name))},
|
||||||
function(r, rt) {
|
function(r, rt) {
|
||||||
var doc = locals[cdt][cdn];
|
var doc = locals[cdt][cdn];
|
||||||
if (r.message) {
|
if (r.message) {
|
||||||
|
@ -28,7 +28,7 @@ cur_frm.cscript.create_salary_slip = function(doc, cdt, cdn) {
|
|||||||
if (r.message)
|
if (r.message)
|
||||||
display_activity_log(r.message);
|
display_activity_log(r.message);
|
||||||
}
|
}
|
||||||
$c('runserverobj', args={'method':'create_sal_slip','docs':wn.model.compress(make_doclist (cdt, cdn))},callback);
|
return $c('runserverobj', args={'method':'create_sal_slip','docs':wn.model.compress(make_doclist (cdt, cdn))},callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -42,7 +42,7 @@ cur_frm.cscript.submit_salary_slip = function(doc, cdt, cdn) {
|
|||||||
if (r.message)
|
if (r.message)
|
||||||
display_activity_log(r.message);
|
display_activity_log(r.message);
|
||||||
}
|
}
|
||||||
$c('runserverobj', args={'method':'submit_salary_slip','docs':wn.model.compress(make_doclist (cdt, cdn))},callback);
|
return $c('runserverobj', args={'method':'submit_salary_slip','docs':wn.model.compress(make_doclist (cdt, cdn))},callback);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,5 +79,5 @@ cur_frm.cscript.make_jv = function(doc, dt, dn) {
|
|||||||
|
|
||||||
loaddoc('Journal Voucher', jv.name);
|
loaddoc('Journal Voucher', jv.name);
|
||||||
}
|
}
|
||||||
$c_obj(make_doclist(dt,dn),'get_acc_details','',call_back);
|
return $c_obj(make_doclist(dt,dn),'get_acc_details','',call_back);
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ cur_frm.cscript.onload = function(doc,dt,dn){
|
|||||||
// Get leave details
|
// Get leave details
|
||||||
//---------------------------------------------------------------------
|
//---------------------------------------------------------------------
|
||||||
cur_frm.cscript.fiscal_year = function(doc,dt,dn){
|
cur_frm.cscript.fiscal_year = function(doc,dt,dn){
|
||||||
$c_obj(make_doclist(doc.doctype,doc.name), 'get_emp_and_leave_details','',function(r, rt) {
|
return $c_obj(make_doclist(doc.doctype,doc.name), 'get_emp_and_leave_details','',function(r, rt) {
|
||||||
var doc = locals[dt][dn];
|
var doc = locals[dt][dn];
|
||||||
cur_frm.refresh();
|
cur_frm.refresh();
|
||||||
calculate_all(doc, dt, dn);
|
calculate_all(doc, dt, dn);
|
||||||
@ -45,7 +45,7 @@ cur_frm.cscript.month = cur_frm.cscript.employee = cur_frm.cscript.fiscal_year;
|
|||||||
|
|
||||||
cur_frm.cscript.leave_without_pay = function(doc,dt,dn){
|
cur_frm.cscript.leave_without_pay = function(doc,dt,dn){
|
||||||
if (doc.employee && doc.fiscal_year && doc.month) {
|
if (doc.employee && doc.fiscal_year && doc.month) {
|
||||||
$c_obj(make_doclist(doc.doctype,doc.name), 'get_leave_details',doc.leave_without_pay,function(r, rt) {
|
return $c_obj(make_doclist(doc.doctype,doc.name), 'get_leave_details',doc.leave_without_pay,function(r, rt) {
|
||||||
var doc = locals[dt][dn];
|
var doc = locals[dt][dn];
|
||||||
cur_frm.refresh();
|
cur_frm.refresh();
|
||||||
calculate_all(doc, dt, dn);
|
calculate_all(doc, dt, dn);
|
||||||
|
@ -20,7 +20,7 @@ cur_frm.cscript.onload = function(doc, dt, dn){
|
|||||||
e_tbl = getchildren('Salary Structure Earning', doc.name, 'earning_details', doc.doctype);
|
e_tbl = getchildren('Salary Structure Earning', doc.name, 'earning_details', doc.doctype);
|
||||||
d_tbl = getchildren('Salary Structure Deduction', doc.name, 'deduction_details', doc.doctype);
|
d_tbl = getchildren('Salary Structure Deduction', doc.name, 'deduction_details', doc.doctype);
|
||||||
if (e_tbl.length == 0 && d_tbl.length == 0)
|
if (e_tbl.length == 0 && d_tbl.length == 0)
|
||||||
$c_obj(make_doclist(doc.doctype,doc.name),'make_earn_ded_table','', function(r, rt) { refresh_many(['earning_details', 'deduction_details']);});
|
return $c_obj(make_doclist(doc.doctype,doc.name),'make_earn_ded_table','', function(r, rt) { refresh_many(['earning_details', 'deduction_details']);});
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.refresh = function(doc, dt, dn){
|
cur_frm.cscript.refresh = function(doc, dt, dn){
|
||||||
@ -40,7 +40,7 @@ cur_frm.cscript['Make Salary Slip'] = function() {
|
|||||||
|
|
||||||
cur_frm.cscript.employee = function(doc, dt, dn){
|
cur_frm.cscript.employee = function(doc, dt, dn){
|
||||||
if (doc.employee)
|
if (doc.employee)
|
||||||
get_server_fields('get_employee_details','','',doc,dt,dn);
|
return get_server_fields('get_employee_details','','',doc,dt,dn);
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.modified_value = function(doc, cdt, cdn){
|
cur_frm.cscript.modified_value = function(doc, cdt, cdn){
|
||||||
|
@ -27,7 +27,7 @@ cur_frm.cscript.refresh = function(doc,dt,dn){
|
|||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.update_cost = function() {
|
cur_frm.cscript.update_cost = function() {
|
||||||
wn.call({
|
return wn.call({
|
||||||
doc: cur_frm.doc,
|
doc: cur_frm.doc,
|
||||||
method: "update_cost",
|
method: "update_cost",
|
||||||
callback: function(r) {
|
callback: function(r) {
|
||||||
@ -106,7 +106,7 @@ cur_frm.cscript.is_default = function(doc) {
|
|||||||
var get_bom_material_detail= function(doc, cdt, cdn) {
|
var get_bom_material_detail= function(doc, cdt, cdn) {
|
||||||
var d = locals[cdt][cdn];
|
var d = locals[cdt][cdn];
|
||||||
if (d.item_code) {
|
if (d.item_code) {
|
||||||
wn.call({
|
return wn.call({
|
||||||
doc: cur_frm.doc,
|
doc: cur_frm.doc,
|
||||||
method: "get_bom_material_detail",
|
method: "get_bom_material_detail",
|
||||||
args: {
|
args: {
|
||||||
|
@ -52,7 +52,7 @@ var cfn_set_fields = function(doc, dt, dn) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.production_item = function(doc) {
|
cur_frm.cscript.production_item = function(doc) {
|
||||||
cur_frm.call({
|
return cur_frm.call({
|
||||||
method: "get_item_details",
|
method: "get_item_details",
|
||||||
args: { item: doc.production_item }
|
args: { item: doc.production_item }
|
||||||
});
|
});
|
||||||
@ -62,7 +62,7 @@ cur_frm.cscript['Stop Production Order'] = function() {
|
|||||||
var doc = cur_frm.doc;
|
var doc = cur_frm.doc;
|
||||||
var check = confirm("Do you really want to stop production order: " + doc.name);
|
var check = confirm("Do you really want to stop production order: " + doc.name);
|
||||||
if (check) {
|
if (check) {
|
||||||
$c_obj(make_doclist(doc.doctype, doc.name), 'stop_unstop', 'Stopped', function(r, rt) {cur_frm.refresh();});
|
return $c_obj(make_doclist(doc.doctype, doc.name), 'stop_unstop', 'Stopped', function(r, rt) {cur_frm.refresh();});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,7 +70,7 @@ cur_frm.cscript['Unstop Production Order'] = function() {
|
|||||||
var doc = cur_frm.doc;
|
var doc = cur_frm.doc;
|
||||||
var check = confirm("Do really want to unstop production order: " + doc.name);
|
var check = confirm("Do really want to unstop production order: " + doc.name);
|
||||||
if (check)
|
if (check)
|
||||||
$c_obj(make_doclist(doc.doctype, doc.name), 'stop_unstop', 'Unstopped', function(r, rt) {cur_frm.refresh();});
|
return $c_obj(make_doclist(doc.doctype, doc.name), 'stop_unstop', 'Unstopped', function(r, rt) {cur_frm.refresh();});
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript['Transfer Raw Materials'] = function() {
|
cur_frm.cscript['Transfer Raw Materials'] = function() {
|
||||||
|
@ -26,19 +26,19 @@ cur_frm.cscript.refresh = function(doc) {
|
|||||||
cur_frm.cscript.sales_order = function(doc,cdt,cdn) {
|
cur_frm.cscript.sales_order = function(doc,cdt,cdn) {
|
||||||
var d = locals[cdt][cdn];
|
var d = locals[cdt][cdn];
|
||||||
if (d.sales_order) {
|
if (d.sales_order) {
|
||||||
get_server_fields('get_so_details', d.sales_order, 'pp_so_details', doc, cdt, cdn, 1);
|
return get_server_fields('get_so_details', d.sales_order, 'pp_so_details', doc, cdt, cdn, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.item_code = function(doc,cdt,cdn) {
|
cur_frm.cscript.item_code = function(doc,cdt,cdn) {
|
||||||
var d = locals[cdt][cdn];
|
var d = locals[cdt][cdn];
|
||||||
if (d.item_code) {
|
if (d.item_code) {
|
||||||
get_server_fields('get_item_details', d.item_code, 'pp_details', doc, cdt, cdn, 1);
|
return get_server_fields('get_item_details', d.item_code, 'pp_details', doc, cdt, cdn, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.download_materials_required = function(doc, cdt, cdn) {
|
cur_frm.cscript.download_materials_required = function(doc, cdt, cdn) {
|
||||||
$c_obj(make_doclist(cdt, cdn), 'validate_data', '', function(r, rt) {
|
return $c_obj(make_doclist(cdt, cdn), 'validate_data', '', function(r, rt) {
|
||||||
if (!r['exc'])
|
if (!r['exc'])
|
||||||
$c_obj_csv(make_doclist(cdt, cdn), 'download_raw_materials', '', '');
|
$c_obj_csv(make_doclist(cdt, cdn), 'download_raw_materials', '', '');
|
||||||
});
|
});
|
||||||
|
@ -29,7 +29,7 @@ erpnext.projects.Task = wn.ui.form.Controller.extend({
|
|||||||
|
|
||||||
project: function() {
|
project: function() {
|
||||||
if(this.frm.doc.project) {
|
if(this.frm.doc.project) {
|
||||||
get_server_fields('get_project_details', '','', this.frm.doc, this.frm.doc.doctype,
|
return get_server_fields('get_project_details', '','', this.frm.doc, this.frm.doc.doctype,
|
||||||
this.frm.doc.name, 1);
|
this.frm.doc.name, 1);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -74,7 +74,7 @@ $.extend(erpnext.complete_setup, {
|
|||||||
var data = d.get_values();
|
var data = d.get_values();
|
||||||
if(!data) return;
|
if(!data) return;
|
||||||
$(this).set_working();
|
$(this).set_working();
|
||||||
$c_obj('Setup Control','setup_account',data,function(r, rt){
|
return $c_obj('Setup Control','setup_account',data,function(r, rt){
|
||||||
$(this).done_working();
|
$(this).done_working();
|
||||||
if(!r.exc) {
|
if(!r.exc) {
|
||||||
sys_defaults = r.message;
|
sys_defaults = r.message;
|
||||||
|
@ -19,22 +19,26 @@ wn.provide("erpnext.stock");
|
|||||||
erpnext.stock.StockController = wn.ui.form.Controller.extend({
|
erpnext.stock.StockController = wn.ui.form.Controller.extend({
|
||||||
show_stock_ledger: function() {
|
show_stock_ledger: function() {
|
||||||
var me = this;
|
var me = this;
|
||||||
this.frm.add_custom_button("Stock Ledger", function() {
|
if(this.frm.doc.docstatus===1) {
|
||||||
wn.route_options = {
|
this.frm.add_custom_button("Stock Ledger", function() {
|
||||||
voucher_no: me.frm.doc.name,
|
wn.route_options = {
|
||||||
from_date: cur_frm.doc.posting_date,
|
voucher_no: me.frm.doc.name,
|
||||||
to_date: cur_frm.doc.posting_date
|
from_date: me.frm.doc.posting_date,
|
||||||
};
|
to_date: me.frm.doc.posting_date
|
||||||
wn.set_route('stock-ledger');
|
};
|
||||||
}, "icon-bar-chart");
|
wn.set_route('stock-ledger');
|
||||||
|
}, "icon-bar-chart");
|
||||||
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
show_general_ledger: function() {
|
show_general_ledger: function() {
|
||||||
if(doc.docstatus==1) {
|
var me = this;
|
||||||
|
if(this.frm.doc.docstatus===1 && cint(wn.defaults.get_default("auto_inventory_accounting"))) {
|
||||||
cur_frm.add_custom_button('Accounting Ledger', function() {
|
cur_frm.add_custom_button('Accounting Ledger', function() {
|
||||||
wn.route_options = {
|
wn.route_options = {
|
||||||
"voucher_no": doc.name,
|
"voucher_no": me.frm.doc.name,
|
||||||
"from_date": doc.posting_date,
|
"from_date": me.frm.doc.posting_date,
|
||||||
"to_date": doc.posting_date,
|
"to_date": me.frm.doc.posting_date,
|
||||||
};
|
};
|
||||||
wn.set_route("general-ledger");
|
wn.set_route("general-ledger");
|
||||||
});
|
});
|
||||||
|
@ -15,8 +15,9 @@
|
|||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
wn.provide("erpnext");
|
wn.provide("erpnext");
|
||||||
|
wn.require("app/js/controllers/stock_controller.js");
|
||||||
|
|
||||||
erpnext.TransactionController = wn.ui.form.Controller.extend({
|
erpnext.TransactionController = erpnext.stock.StockController.extend({
|
||||||
onload: function() {
|
onload: function() {
|
||||||
if(this.frm.doc.__islocal) {
|
if(this.frm.doc.__islocal) {
|
||||||
var me = this,
|
var me = this,
|
||||||
@ -55,7 +56,7 @@ erpnext.TransactionController = wn.ui.form.Controller.extend({
|
|||||||
onload_post_render: function() {
|
onload_post_render: function() {
|
||||||
if(this.frm.doc.__islocal && this.frm.doc.company) {
|
if(this.frm.doc.__islocal && this.frm.doc.company) {
|
||||||
var me = this;
|
var me = this;
|
||||||
this.frm.call({
|
return this.frm.call({
|
||||||
doc: this.frm.doc,
|
doc: this.frm.doc,
|
||||||
method: "onload_post_render",
|
method: "onload_post_render",
|
||||||
freeze: true,
|
freeze: true,
|
||||||
@ -116,7 +117,7 @@ erpnext.TransactionController = wn.ui.form.Controller.extend({
|
|||||||
price_list_name: function(buying_or_selling) {
|
price_list_name: function(buying_or_selling) {
|
||||||
var me = this;
|
var me = this;
|
||||||
if(this.frm.doc.price_list_name) {
|
if(this.frm.doc.price_list_name) {
|
||||||
this.frm.call({
|
return this.frm.call({
|
||||||
method: "setup.utils.get_price_list_currency",
|
method: "setup.utils.get_price_list_currency",
|
||||||
args: {
|
args: {
|
||||||
price_list_name: this.frm.doc.price_list_name,
|
price_list_name: this.frm.doc.price_list_name,
|
||||||
@ -557,7 +558,7 @@ erpnext.TransactionController = wn.ui.form.Controller.extend({
|
|||||||
get_terms: function() {
|
get_terms: function() {
|
||||||
var me = this;
|
var me = this;
|
||||||
if(this.frm.doc.tc_name) {
|
if(this.frm.doc.tc_name) {
|
||||||
this.frm.call({
|
return this.frm.call({
|
||||||
method: "webnotes.client.get_value",
|
method: "webnotes.client.get_value",
|
||||||
args: {
|
args: {
|
||||||
doctype: "Terms and Conditions",
|
doctype: "Terms and Conditions",
|
||||||
|
@ -5,7 +5,7 @@ var wn = {};
|
|||||||
// Add / update a new Lead / Communication
|
// Add / update a new Lead / Communication
|
||||||
// subject, sender, description
|
// subject, sender, description
|
||||||
erpnext.send_message = function(opts) {
|
erpnext.send_message = function(opts) {
|
||||||
wn.call({
|
return wn.call({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
method: "website.helpers.contact.send_message",
|
method: "website.helpers.contact.send_message",
|
||||||
args: opts,
|
args: opts,
|
||||||
@ -202,7 +202,7 @@ $.extend(wn.cart, {
|
|||||||
}
|
}
|
||||||
window.location.href = "login";
|
window.location.href = "login";
|
||||||
} else {
|
} else {
|
||||||
wn.call({
|
return wn.call({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
method: "website.helpers.cart.update_cart",
|
method: "website.helpers.cart.update_cart",
|
||||||
args: {
|
args: {
|
||||||
|
@ -66,7 +66,7 @@ cur_frm.cscript.setup_dashboard = function(doc) {
|
|||||||
cur_frm.dashboard.add_doctype_badge("Delivery Note", "customer");
|
cur_frm.dashboard.add_doctype_badge("Delivery Note", "customer");
|
||||||
cur_frm.dashboard.add_doctype_badge("Sales Invoice", "customer");
|
cur_frm.dashboard.add_doctype_badge("Sales Invoice", "customer");
|
||||||
|
|
||||||
wn.call({
|
return wn.call({
|
||||||
type: "GET",
|
type: "GET",
|
||||||
method:"selling.doctype.customer.customer.get_dashboard_info",
|
method:"selling.doctype.customer.customer.get_dashboard_info",
|
||||||
args: {
|
args: {
|
||||||
|
@ -78,7 +78,7 @@ erpnext.selling.InstallationNote = wn.ui.form.Controller.extend({
|
|||||||
customer: function() {
|
customer: function() {
|
||||||
var me = this;
|
var me = this;
|
||||||
if(this.frm.doc.customer) {
|
if(this.frm.doc.customer) {
|
||||||
this.frm.call({
|
return this.frm.call({
|
||||||
doc: this.frm.doc,
|
doc: this.frm.doc,
|
||||||
method: "set_customer_defaults",
|
method: "set_customer_defaults",
|
||||||
});
|
});
|
||||||
@ -93,7 +93,7 @@ erpnext.selling.InstallationNote = wn.ui.form.Controller.extend({
|
|||||||
customer_address: function() {
|
customer_address: function() {
|
||||||
var me = this;
|
var me = this;
|
||||||
if(this.frm.doc.customer) {
|
if(this.frm.doc.customer) {
|
||||||
this.frm.call({
|
return this.frm.call({
|
||||||
doc: this.frm.doc,
|
doc: this.frm.doc,
|
||||||
args: {
|
args: {
|
||||||
customer: this.frm.doc.customer,
|
customer: this.frm.doc.customer,
|
||||||
|
@ -86,15 +86,15 @@ erpnext.selling.Opportunity = wn.ui.form.Controller.extend({
|
|||||||
customer: function() {
|
customer: function() {
|
||||||
var me = this;
|
var me = this;
|
||||||
if(this.frm.doc.customer) {
|
if(this.frm.doc.customer) {
|
||||||
this.frm.call({
|
|
||||||
doc: this.frm.doc,
|
|
||||||
method: "set_customer_defaults",
|
|
||||||
});
|
|
||||||
|
|
||||||
// TODO shift this to depends_on
|
// TODO shift this to depends_on
|
||||||
unhide_field(['customer_address', 'contact_person', 'customer_name',
|
unhide_field(['customer_address', 'contact_person', 'customer_name',
|
||||||
'address_display', 'contact_display', 'contact_mobile', 'contact_email',
|
'address_display', 'contact_display', 'contact_mobile', 'contact_email',
|
||||||
'territory', 'customer_group']);
|
'territory', 'customer_group']);
|
||||||
|
|
||||||
|
return this.frm.call({
|
||||||
|
doc: this.frm.doc,
|
||||||
|
method: "set_customer_defaults",
|
||||||
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -140,7 +140,7 @@ cur_frm.cscript.onload_post_render = function(doc, cdt, cdn) {
|
|||||||
cur_frm.cscript.item_code = function(doc, cdt, cdn) {
|
cur_frm.cscript.item_code = function(doc, cdt, cdn) {
|
||||||
var d = locals[cdt][cdn];
|
var d = locals[cdt][cdn];
|
||||||
if (d.item_code) {
|
if (d.item_code) {
|
||||||
get_server_fields('get_item_details',d.item_code, 'enquiry_details',doc, cdt,cdn,1);
|
return get_server_fields('get_item_details',d.item_code, 'enquiry_details',doc, cdt,cdn,1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -165,7 +165,7 @@ cur_frm.cscript.lead_cust_show = function(doc,cdt,cdn){
|
|||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.customer_address = cur_frm.cscript.contact_person = function(doc,dt,dn) {
|
cur_frm.cscript.customer_address = cur_frm.cscript.contact_person = function(doc,dt,dn) {
|
||||||
if(doc.customer) get_server_fields('get_customer_address', JSON.stringify({customer: doc.customer, address: doc.customer_address, contact: doc.contact_person}),'', doc, dt, dn, 1);
|
if(doc.customer) return get_server_fields('get_customer_address', JSON.stringify({customer: doc.customer, address: doc.customer_address, contact: doc.contact_person}),'', doc, dt, dn, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.lead = function(doc, cdt, cdn) {
|
cur_frm.cscript.lead = function(doc, cdt, cdn) {
|
||||||
@ -195,7 +195,7 @@ cur_frm.cscript['Declare Opportunity Lost'] = function(){
|
|||||||
dialog.fields_dict.update.$input.click(function() {
|
dialog.fields_dict.update.$input.click(function() {
|
||||||
args = dialog.get_values();
|
args = dialog.get_values();
|
||||||
if(!args) return;
|
if(!args) return;
|
||||||
cur_frm.call({
|
return cur_frm.call({
|
||||||
doc: cur_frm.doc,
|
doc: cur_frm.doc,
|
||||||
method: "declare_enquiry_lost",
|
method: "declare_enquiry_lost",
|
||||||
args: args.reason,
|
args: args.reason,
|
||||||
|
@ -114,7 +114,8 @@ cur_frm.fields_dict.lead.get_query = function(doc,cdt,cdn) {
|
|||||||
|
|
||||||
cur_frm.cscript.lead = function(doc, cdt, cdn) {
|
cur_frm.cscript.lead = function(doc, cdt, cdn) {
|
||||||
if(doc.lead) {
|
if(doc.lead) {
|
||||||
cur_frm.call({
|
unhide_field('territory');
|
||||||
|
return cur_frm.call({
|
||||||
doc: cur_frm.doc,
|
doc: cur_frm.doc,
|
||||||
method: "set_lead_defaults",
|
method: "set_lead_defaults",
|
||||||
callback: function(r) {
|
callback: function(r) {
|
||||||
@ -123,7 +124,6 @@ cur_frm.cscript.lead = function(doc, cdt, cdn) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
unhide_field('territory');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -152,7 +152,7 @@ cur_frm.cscript['Declare Order Lost'] = function(){
|
|||||||
dialog.fields_dict.update.$input.click(function() {
|
dialog.fields_dict.update.$input.click(function() {
|
||||||
args = dialog.get_values();
|
args = dialog.get_values();
|
||||||
if(!args) return;
|
if(!args) return;
|
||||||
cur_frm.call({
|
return cur_frm.call({
|
||||||
method: "declare_order_lost",
|
method: "declare_order_lost",
|
||||||
doc: cur_frm.doc,
|
doc: cur_frm.doc,
|
||||||
args: args.reason,
|
args: args.reason,
|
||||||
|
@ -18,7 +18,7 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
|||||||
cur_frm.toggle_enable('new_item_code', doc.__islocal);
|
cur_frm.toggle_enable('new_item_code', doc.__islocal);
|
||||||
if(!doc.__islocal) {
|
if(!doc.__islocal) {
|
||||||
cur_frm.add_custom_button("Check for Duplicates", function() {
|
cur_frm.add_custom_button("Check for Duplicates", function() {
|
||||||
cur_frm.call_server('check_duplicate', 1)
|
return cur_frm.call_server('check_duplicate', 1)
|
||||||
}, 'icon-search')
|
}, 'icon-search')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -34,6 +34,6 @@ cur_frm.fields_dict.new_item_code.query_description = 'Select Item where "Is Sto
|
|||||||
cur_frm.cscript.item_code = function(doc, dt, dn) {
|
cur_frm.cscript.item_code = function(doc, dt, dn) {
|
||||||
var d = locals[dt][dn];
|
var d = locals[dt][dn];
|
||||||
if (d.item_code){
|
if (d.item_code){
|
||||||
get_server_fields('get_item_details', d.item_code, 'sales_bom_items', doc ,dt, dn, 1);
|
return get_server_fields('get_item_details', d.item_code, 'sales_bom_items', doc ,dt, dn, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -135,7 +135,7 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
|
|||||||
msgprint(wn._("Please specify Company"));
|
msgprint(wn._("Please specify Company"));
|
||||||
} else {
|
} else {
|
||||||
var price_list_name = this.frm.doc.price_list_name;
|
var price_list_name = this.frm.doc.price_list_name;
|
||||||
this.frm.call({
|
return this.frm.call({
|
||||||
doc: this.frm.doc,
|
doc: this.frm.doc,
|
||||||
method: "set_customer_defaults",
|
method: "set_customer_defaults",
|
||||||
freeze: true,
|
freeze: true,
|
||||||
@ -154,7 +154,7 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
|
|||||||
customer_address: function() {
|
customer_address: function() {
|
||||||
var me = this;
|
var me = this;
|
||||||
if(this.frm.doc.customer) {
|
if(this.frm.doc.customer) {
|
||||||
this.frm.call({
|
return this.frm.call({
|
||||||
doc: this.frm.doc,
|
doc: this.frm.doc,
|
||||||
args: {
|
args: {
|
||||||
customer: this.frm.doc.customer,
|
customer: this.frm.doc.customer,
|
||||||
@ -183,7 +183,7 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
|
|||||||
item.item_code = null;
|
item.item_code = null;
|
||||||
refresh_field("item_code", item.name, item.parentfield);
|
refresh_field("item_code", item.name, item.parentfield);
|
||||||
} else {
|
} else {
|
||||||
this.frm.call({
|
return this.frm.call({
|
||||||
method: "selling.utils.get_item_details",
|
method: "selling.utils.get_item_details",
|
||||||
child: item,
|
child: item,
|
||||||
args: {
|
args: {
|
||||||
@ -292,7 +292,7 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
|
|||||||
warehouse: function(doc, cdt, cdn) {
|
warehouse: function(doc, cdt, cdn) {
|
||||||
var item = wn.model.get_doc(cdt, cdn);
|
var item = wn.model.get_doc(cdt, cdn);
|
||||||
if(item.item_code && item.warehouse) {
|
if(item.item_code && item.warehouse) {
|
||||||
this.frm.call({
|
return this.frm.call({
|
||||||
method: "selling.utils.get_available_qty",
|
method: "selling.utils.get_available_qty",
|
||||||
child: item,
|
child: item,
|
||||||
args: {
|
args: {
|
||||||
@ -484,7 +484,7 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
|
|||||||
charge: function() {
|
charge: function() {
|
||||||
var me = this;
|
var me = this;
|
||||||
if(this.frm.doc.charge) {
|
if(this.frm.doc.charge) {
|
||||||
this.frm.call({
|
return this.frm.call({
|
||||||
doc: this.frm.doc,
|
doc: this.frm.doc,
|
||||||
method: "get_other_charges",
|
method: "get_other_charges",
|
||||||
callback: function(r) {
|
callback: function(r) {
|
||||||
@ -499,7 +499,7 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
|
|||||||
shipping_rule: function() {
|
shipping_rule: function() {
|
||||||
var me = this;
|
var me = this;
|
||||||
if(this.frm.doc.shipping_rule) {
|
if(this.frm.doc.shipping_rule) {
|
||||||
this.frm.call({
|
return this.frm.call({
|
||||||
doc: this.frm.doc,
|
doc: this.frm.doc,
|
||||||
method: "apply_shipping_rule",
|
method: "apply_shipping_rule",
|
||||||
callback: function(r) {
|
callback: function(r) {
|
||||||
|
@ -101,7 +101,7 @@ erpnext.selling.SalesOrderController = erpnext.selling.SellingController.extend(
|
|||||||
reserved_warehouse: function(doc, cdt, cdn) {
|
reserved_warehouse: function(doc, cdt, cdn) {
|
||||||
var item = wn.model.get_doc(cdt, cdn);
|
var item = wn.model.get_doc(cdt, cdn);
|
||||||
if(item.item_code && item.reserved_warehouse) {
|
if(item.item_code && item.reserved_warehouse) {
|
||||||
this.frm.call({
|
return this.frm.call({
|
||||||
method: "selling.utils.get_available_qty",
|
method: "selling.utils.get_available_qty",
|
||||||
child: item,
|
child: item,
|
||||||
args: {
|
args: {
|
||||||
@ -173,7 +173,7 @@ cur_frm.cscript['Stop Sales Order'] = function() {
|
|||||||
var check = confirm("Are you sure you want to STOP " + doc.name);
|
var check = confirm("Are you sure you want to STOP " + doc.name);
|
||||||
|
|
||||||
if (check) {
|
if (check) {
|
||||||
$c('runserverobj', {
|
return $c('runserverobj', {
|
||||||
'method':'stop_sales_order',
|
'method':'stop_sales_order',
|
||||||
'docs': wn.model.compress(make_doclist(doc.doctype, doc.name))
|
'docs': wn.model.compress(make_doclist(doc.doctype, doc.name))
|
||||||
}, function(r,rt) {
|
}, function(r,rt) {
|
||||||
@ -188,7 +188,7 @@ cur_frm.cscript['Unstop Sales Order'] = function() {
|
|||||||
var check = confirm("Are you sure you want to UNSTOP " + doc.name);
|
var check = confirm("Are you sure you want to UNSTOP " + doc.name);
|
||||||
|
|
||||||
if (check) {
|
if (check) {
|
||||||
$c('runserverobj', {
|
return $c('runserverobj', {
|
||||||
'method':'unstop_sales_order',
|
'method':'unstop_sales_order',
|
||||||
'docs': wn.model.compress(make_doclist(doc.doctype, doc.name))
|
'docs': wn.model.compress(make_doclist(doc.doctype, doc.name))
|
||||||
}, function(r,rt) {
|
}, function(r,rt) {
|
||||||
|
@ -396,7 +396,8 @@ def make_delivery_note(source_name, target_doclist=None):
|
|||||||
"parenttype": "prevdoc_doctype",
|
"parenttype": "prevdoc_doctype",
|
||||||
"reserved_warehouse": "warehouse"
|
"reserved_warehouse": "warehouse"
|
||||||
},
|
},
|
||||||
"postprocess": update_item
|
"postprocess": update_item,
|
||||||
|
"condition": lambda doc: doc.delivered_qty < doc.qty
|
||||||
},
|
},
|
||||||
"Sales Taxes and Charges": {
|
"Sales Taxes and Charges": {
|
||||||
"doctype": "Sales Taxes and Charges",
|
"doctype": "Sales Taxes and Charges",
|
||||||
|
@ -33,7 +33,7 @@ pscript['onload_Sales Browser'] = function(wrapper){
|
|||||||
|
|
||||||
wrapper.make_tree = function() {
|
wrapper.make_tree = function() {
|
||||||
var ctype = wn.get_route()[1] || 'Territory';
|
var ctype = wn.get_route()[1] || 'Territory';
|
||||||
wn.call({
|
return wn.call({
|
||||||
method: 'selling.page.sales_browser.sales_browser.get_children',
|
method: 'selling.page.sales_browser.sales_browser.get_children',
|
||||||
args: {ctype: ctype},
|
args: {ctype: ctype},
|
||||||
callback: function(r) {
|
callback: function(r) {
|
||||||
@ -155,7 +155,7 @@ erpnext.SalesChart = Class.extend({
|
|||||||
v.parent = node.data('label');
|
v.parent = node.data('label');
|
||||||
v.ctype = me.ctype;
|
v.ctype = me.ctype;
|
||||||
|
|
||||||
wn.call({
|
return wn.call({
|
||||||
method: 'selling.page.sales_browser.sales_browser.add_node',
|
method: 'selling.page.sales_browser.sales_browser.add_node',
|
||||||
args: v,
|
args: v,
|
||||||
callback: function() {
|
callback: function() {
|
||||||
|
@ -43,7 +43,7 @@ $.extend(cur_frm.cscript, {
|
|||||||
|
|
||||||
allow_dropbox_access: function() {
|
allow_dropbox_access: function() {
|
||||||
if(cur_frm.cscript.validate_send_notifications_to()) {
|
if(cur_frm.cscript.validate_send_notifications_to()) {
|
||||||
wn.call({
|
return wn.call({
|
||||||
method: "setup.doctype.backup_manager.backup_dropbox.get_dropbox_authorize_url",
|
method: "setup.doctype.backup_manager.backup_dropbox.get_dropbox_authorize_url",
|
||||||
callback: function(r) {
|
callback: function(r) {
|
||||||
if(!r.exc) {
|
if(!r.exc) {
|
||||||
@ -60,7 +60,7 @@ $.extend(cur_frm.cscript, {
|
|||||||
|
|
||||||
allow_gdrive_access: function() {
|
allow_gdrive_access: function() {
|
||||||
if(cur_frm.cscript.validate_send_notifications_to()) {
|
if(cur_frm.cscript.validate_send_notifications_to()) {
|
||||||
wn.call({
|
return wn.call({
|
||||||
method: "setup.doctype.backup_manager.backup_googledrive.get_gdrive_authorize_url",
|
method: "setup.doctype.backup_manager.backup_googledrive.get_gdrive_authorize_url",
|
||||||
callback: function(r) {
|
callback: function(r) {
|
||||||
if(!r.exc) {
|
if(!r.exc) {
|
||||||
@ -72,7 +72,7 @@ $.extend(cur_frm.cscript, {
|
|||||||
},
|
},
|
||||||
|
|
||||||
validate_gdrive: function() {
|
validate_gdrive: function() {
|
||||||
wn.call({
|
return wn.call({
|
||||||
method: "setup.doctype.backup_manager.backup_googledrive.gdrive_callback",
|
method: "setup.doctype.backup_manager.backup_googledrive.gdrive_callback",
|
||||||
args: {
|
args: {
|
||||||
verification_code: cur_frm.doc.verification_code
|
verification_code: cur_frm.doc.verification_code
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
// get sates on country trigger
|
// get sates on country trigger
|
||||||
// -----------------------------
|
// -----------------------------
|
||||||
cur_frm.cscript.get_states=function(doc,dt,dn){
|
cur_frm.cscript.get_states=function(doc,dt,dn){
|
||||||
$c('runserverobj', args={'method':'check_state', 'docs':wn.model.compress(make_doclist(doc.doctype, doc.name))},
|
return $c('runserverobj', args={'method':'check_state', 'docs':wn.model.compress(make_doclist(doc.doctype, doc.name))},
|
||||||
function(r,rt){
|
function(r,rt){
|
||||||
if(r.message) {
|
if(r.message) {
|
||||||
set_field_options('state', r.message);
|
set_field_options('state', r.message);
|
||||||
@ -152,7 +152,7 @@ cur_frm.cscript.delete_doc = function(doctype, name) {
|
|||||||
}));
|
}));
|
||||||
if (!go_ahead) return;
|
if (!go_ahead) return;
|
||||||
|
|
||||||
wn.call({
|
return wn.call({
|
||||||
method: 'webnotes.model.delete_doc',
|
method: 'webnotes.model.delete_doc',
|
||||||
args: {
|
args: {
|
||||||
dt: doctype,
|
dt: doctype,
|
||||||
|
@ -22,7 +22,7 @@ cur_frm.cscript.refresh = function(doc, dt, dn) {
|
|||||||
cur_frm.add_custom_button('View Now', function() {
|
cur_frm.add_custom_button('View Now', function() {
|
||||||
doc = locals[dt][dn];
|
doc = locals[dt][dn];
|
||||||
if(doc.__unsaved != 1) {
|
if(doc.__unsaved != 1) {
|
||||||
$c_obj(make_doclist(dt, dn), 'get_digest_msg', '', function(r, rt) {
|
return $c_obj(make_doclist(dt, dn), 'get_digest_msg', '', function(r, rt) {
|
||||||
if(r.exc) {
|
if(r.exc) {
|
||||||
msgprint(err_msg);
|
msgprint(err_msg);
|
||||||
console.log(r.exc);
|
console.log(r.exc);
|
||||||
@ -45,7 +45,7 @@ cur_frm.cscript.refresh = function(doc, dt, dn) {
|
|||||||
cur_frm.add_custom_button('Send Now', function() {
|
cur_frm.add_custom_button('Send Now', function() {
|
||||||
doc = locals[dt][dn];
|
doc = locals[dt][dn];
|
||||||
if(doc.__unsaved != 1) {
|
if(doc.__unsaved != 1) {
|
||||||
$c_obj(make_doclist(dt, dn), 'send', '', function(r, rt) {
|
return $c_obj(make_doclist(dt, dn), 'send', '', function(r, rt) {
|
||||||
if(r.exc) {
|
if(r.exc) {
|
||||||
msgprint(err_msg);
|
msgprint(err_msg);
|
||||||
console.log(r.exc);
|
console.log(r.exc);
|
||||||
@ -62,7 +62,7 @@ cur_frm.cscript.refresh = function(doc, dt, dn) {
|
|||||||
|
|
||||||
cur_frm.cscript.addremove_recipients = function(doc, dt, dn) {
|
cur_frm.cscript.addremove_recipients = function(doc, dt, dn) {
|
||||||
// Get profile list
|
// Get profile list
|
||||||
$c_obj(make_doclist(dt, dn), 'get_profiles', '', function(r, rt) {
|
return $c_obj(make_doclist(dt, dn), 'get_profiles', '', function(r, rt) {
|
||||||
if(r.exc) {
|
if(r.exc) {
|
||||||
msgprint(r.exc);
|
msgprint(r.exc);
|
||||||
} else {
|
} else {
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
// Validate
|
// Validate
|
||||||
cur_frm.cscript.validate = function(doc, cdt, cdn) {
|
cur_frm.cscript.validate = function(doc, cdt, cdn) {
|
||||||
$c_obj(make_doclist(cdt, cdn), 'get_defaults', '', function(r, rt){
|
return $c_obj(make_doclist(cdt, cdn), 'get_defaults', '', function(r, rt){
|
||||||
sys_defaults = r.message;
|
sys_defaults = r.message;
|
||||||
});
|
});
|
||||||
}
|
}
|
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
// Settings
|
// Settings
|
||||||
cur_frm.cscript.onload_post_render = function(doc, cdt, cdn){
|
cur_frm.cscript.onload_post_render = function(doc, cdt, cdn){
|
||||||
cur_frm.call({
|
return cur_frm.call({
|
||||||
doc: cur_frm.doc,
|
doc: cur_frm.doc,
|
||||||
method: 'get_transactions',
|
method: 'get_transactions',
|
||||||
callback: function(r) {
|
callback: function(r) {
|
||||||
@ -45,15 +45,15 @@ cur_frm.cscript.select_doc_for_series = function(doc, cdt, cdn) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(doc.select_doc_for_series)
|
if(doc.select_doc_for_series)
|
||||||
$c_obj(make_doclist(doc.doctype, doc.name),'get_options','',callback)
|
return $c_obj(make_doclist(doc.doctype, doc.name),'get_options','',callback)
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.update = function() {
|
cur_frm.cscript.update = function() {
|
||||||
cur_frm.call_server('update_series', '', cur_frm.cscript.update_selects)
|
return cur_frm.call_server('update_series', '', cur_frm.cscript.update_selects)
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.prefix = function(doc, dt, dn) {
|
cur_frm.cscript.prefix = function(doc, dt, dn) {
|
||||||
cur_frm.call_server('get_current', '', function(r) {
|
return cur_frm.call_server('get_current', '', function(r) {
|
||||||
refresh_field('current_value');
|
refresh_field('current_value');
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,6 @@ cur_frm.cscript.select_transaction = function(doc, cdt, cdn) {
|
|||||||
doc.custom_message = r.message;
|
doc.custom_message = r.message;
|
||||||
refresh_field('custom_message');
|
refresh_field('custom_message');
|
||||||
}
|
}
|
||||||
$c_obj(make_doclist(cdt, cdn),'get_message',doc.select_transaction, callback)
|
return $c_obj(make_doclist(cdt, cdn),'get_message',doc.select_transaction, callback)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,36 +21,7 @@ wn.pages.Setup.make = function(wrapper) {
|
|||||||
completed = 0;
|
completed = 0;
|
||||||
|
|
||||||
body.html('<div class="progress progress-striped active">\
|
body.html('<div class="progress progress-striped active">\
|
||||||
<div class="progress-bar" style="width: 100%;"></div></div>')
|
<div class="progress-bar" style="width: 100%;"></div></div>');
|
||||||
|
|
||||||
wn.call({
|
|
||||||
method: "setup.page.setup.setup.get",
|
|
||||||
callback: function(r) {
|
|
||||||
if(r.message) {
|
|
||||||
body.empty();
|
|
||||||
if(wn.boot.expires_on) {
|
|
||||||
$(body).prepend("<div class='text-muted' style='text-align:right'>Account expires on "
|
|
||||||
+ wn.datetime.global_date_format(wn.boot.expires_on) + "</div>");
|
|
||||||
}
|
|
||||||
|
|
||||||
$completed = $('<h4>Setup Completed <span class="completed-percent"></span><h4>\
|
|
||||||
<div class="progress"><div class="progress-bar"></div></div>')
|
|
||||||
.appendTo(body);
|
|
||||||
|
|
||||||
$.each(r.message, function(i, item) {
|
|
||||||
render_item(item)
|
|
||||||
});
|
|
||||||
|
|
||||||
var completed_percent = cint(flt(completed) / total * 100) + "%";
|
|
||||||
$completed
|
|
||||||
.find(".progress-bar")
|
|
||||||
.css({"width": completed_percent});
|
|
||||||
$(body)
|
|
||||||
.find(".completed-percent")
|
|
||||||
.html("(" + completed_percent + ")");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
var render_item = function(item, dependency) {
|
var render_item = function(item, dependency) {
|
||||||
if(item.type==="Section") {
|
if(item.type==="Section") {
|
||||||
@ -199,4 +170,33 @@ wn.pages.Setup.make = function(wrapper) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return wn.call({
|
||||||
|
method: "setup.page.setup.setup.get",
|
||||||
|
callback: function(r) {
|
||||||
|
if(r.message) {
|
||||||
|
body.empty();
|
||||||
|
if(wn.boot.expires_on) {
|
||||||
|
$(body).prepend("<div class='text-muted' style='text-align:right'>Account expires on "
|
||||||
|
+ wn.datetime.global_date_format(wn.boot.expires_on) + "</div>");
|
||||||
|
}
|
||||||
|
|
||||||
|
$completed = $('<h4>Setup Completed <span class="completed-percent"></span><h4>\
|
||||||
|
<div class="progress"><div class="progress-bar"></div></div>')
|
||||||
|
.appendTo(body);
|
||||||
|
|
||||||
|
$.each(r.message, function(i, item) {
|
||||||
|
render_item(item)
|
||||||
|
});
|
||||||
|
|
||||||
|
var completed_percent = cint(flt(completed) / total * 100) + "%";
|
||||||
|
$completed
|
||||||
|
.find(".progress-bar")
|
||||||
|
.css({"width": completed_percent});
|
||||||
|
$(body)
|
||||||
|
.find(".completed-percent")
|
||||||
|
.html("(" + completed_percent + ")");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
@ -29,13 +29,15 @@ erpnext.stock.DeliveryNoteController = erpnext.selling.SellingController.extend(
|
|||||||
refresh: function(doc, dt, dn) {
|
refresh: function(doc, dt, dn) {
|
||||||
this._super();
|
this._super();
|
||||||
|
|
||||||
if(flt(doc.per_billed, 2) < 100 && doc.docstatus==1) cur_frm.add_custom_button('Make Invoice', this.make_sales_invoice);
|
if(!doc.__billing_complete && doc.docstatus==1) cur_frm.add_custom_button('Make Invoice', this.make_sales_invoice);
|
||||||
|
|
||||||
if(flt(doc.per_installed, 2) < 100 && doc.docstatus==1)
|
if(flt(doc.per_installed, 2) < 100 && doc.docstatus==1)
|
||||||
cur_frm.add_custom_button('Make Installation Note', this.make_installation_note);
|
cur_frm.add_custom_button('Make Installation Note', this.make_installation_note);
|
||||||
|
|
||||||
if (doc.docstatus==1) {
|
if (doc.docstatus==1) {
|
||||||
cur_frm.add_custom_button('Send SMS', cur_frm.cscript.send_sms);
|
cur_frm.add_custom_button('Send SMS', cur_frm.cscript.send_sms);
|
||||||
|
this.show_stock_ledger();
|
||||||
|
this.show_general_ledger();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(doc.docstatus==0 && !doc.__islocal) {
|
if(doc.docstatus==0 && !doc.__islocal) {
|
||||||
@ -112,7 +114,7 @@ cur_frm.fields_dict['project_name'].get_query = function(doc, cdt, cdn) {
|
|||||||
cur_frm.cscript.serial_no = function(doc, cdt, cdn) {
|
cur_frm.cscript.serial_no = function(doc, cdt, cdn) {
|
||||||
var d = locals[cdt][cdn];
|
var d = locals[cdt][cdn];
|
||||||
if (d.serial_no) {
|
if (d.serial_no) {
|
||||||
get_server_fields('get_serial_details',d.serial_no,'delivery_note_details',doc,cdt,cdn,1);
|
return get_server_fields('get_serial_details',d.serial_no,'delivery_note_details',doc,cdt,cdn,1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,6 +50,13 @@ class DocType(SellingController):
|
|||||||
'keyword': 'Delivered'
|
'keyword': 'Delivered'
|
||||||
}]
|
}]
|
||||||
|
|
||||||
|
def onload(self):
|
||||||
|
billed_qty = webnotes.conn.sql("""select sum(ifnull(qty, 0)) from `tabSales Invoice Item`
|
||||||
|
where delivery_note=%s""", self.doc.name)
|
||||||
|
if billed_qty:
|
||||||
|
total_qty = sum((item.qty for item in self.doclist.get({"parentfield": "delivery_note_details"})))
|
||||||
|
self.doc.fields["__billing_complete"] = billed_qty[0][0] == total_qty
|
||||||
|
|
||||||
def get_contact_details(self):
|
def get_contact_details(self):
|
||||||
return get_obj('Sales Common').get_contact_details(self,0)
|
return get_obj('Sales Common').get_contact_details(self,0)
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ cur_frm.cscript.refresh = function(doc) {
|
|||||||
var enabled = (r.message == 'exists') ? false : true;
|
var enabled = (r.message == 'exists') ? false : true;
|
||||||
cur_frm.toggle_enable(['has_serial_no', 'is_stock_item', 'valuation_method'], enabled);
|
cur_frm.toggle_enable(['has_serial_no', 'is_stock_item', 'valuation_method'], enabled);
|
||||||
}
|
}
|
||||||
$c_obj(make_doclist(doc.doctype, doc.name),'check_if_sle_exists','',callback);
|
return $c_obj(make_doclist(doc.doctype, doc.name),'check_if_sle_exists','',callback);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -130,7 +130,7 @@ cur_frm.fields_dict['item_tax'].grid.get_field("tax_type").get_query = function(
|
|||||||
|
|
||||||
cur_frm.cscript.tax_type = function(doc, cdt, cdn){
|
cur_frm.cscript.tax_type = function(doc, cdt, cdn){
|
||||||
var d = locals[cdt][cdn];
|
var d = locals[cdt][cdn];
|
||||||
get_server_fields('get_tax_rate',d.tax_type,'item_tax',doc, cdt, cdn, 1);
|
return get_server_fields('get_tax_rate',d.tax_type,'item_tax',doc, cdt, cdn, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -124,7 +124,7 @@ cur_frm.cscript['Stop Material Request'] = function() {
|
|||||||
var check = confirm("Do you really want to STOP this Material Request?");
|
var check = confirm("Do you really want to STOP this Material Request?");
|
||||||
|
|
||||||
if (check) {
|
if (check) {
|
||||||
$c('runserverobj', args={'method':'update_status', 'arg': 'Stopped', 'docs': wn.model.compress(make_doclist(doc.doctype, doc.name))}, function(r,rt) {
|
return $c('runserverobj', args={'method':'update_status', 'arg': 'Stopped', 'docs': wn.model.compress(make_doclist(doc.doctype, doc.name))}, function(r,rt) {
|
||||||
cur_frm.refresh();
|
cur_frm.refresh();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -135,7 +135,7 @@ cur_frm.cscript['Unstop Material Request'] = function(){
|
|||||||
var check = confirm("Do you really want to UNSTOP this Material Request?");
|
var check = confirm("Do you really want to UNSTOP this Material Request?");
|
||||||
|
|
||||||
if (check) {
|
if (check) {
|
||||||
$c('runserverobj', args={'method':'update_status', 'arg': 'Submitted','docs': wn.model.compress(make_doclist(doc.doctype, doc.name))}, function(r,rt) {
|
return $c('runserverobj', args={'method':'update_status', 'arg': 'Submitted','docs': wn.model.compress(make_doclist(doc.doctype, doc.name))}, function(r,rt) {
|
||||||
cur_frm.refresh();
|
cur_frm.refresh();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@ cur_frm.cscript.onload_post_render = function(doc, cdt, cdn) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.get_items = function(doc, cdt, cdn) {
|
cur_frm.cscript.get_items = function(doc, cdt, cdn) {
|
||||||
this.frm.call({
|
return this.frm.call({
|
||||||
doc: this.frm.doc,
|
doc: this.frm.doc,
|
||||||
method: "get_items",
|
method: "get_items",
|
||||||
callback: function(r) {
|
callback: function(r) {
|
||||||
|
@ -28,11 +28,14 @@ erpnext.stock.PurchaseReceiptController = erpnext.buying.BuyingController.extend
|
|||||||
this._super();
|
this._super();
|
||||||
|
|
||||||
if(this.frm.doc.docstatus == 1) {
|
if(this.frm.doc.docstatus == 1) {
|
||||||
if(flt(this.frm.doc.per_billed, 2) < 100) {
|
if(!this.frm.doc.__billing_complete) {
|
||||||
cur_frm.add_custom_button('Make Purchase Invoice',
|
cur_frm.add_custom_button('Make Purchase Invoice',
|
||||||
this.make_purchase_invoice);
|
this.make_purchase_invoice);
|
||||||
}
|
}
|
||||||
cur_frm.add_custom_button('Send SMS', cur_frm.cscript['Send SMS']);
|
cur_frm.add_custom_button('Send SMS', cur_frm.cscript['Send SMS']);
|
||||||
|
|
||||||
|
this.show_stock_ledger();
|
||||||
|
this.show_general_ledger();
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.add_custom_button(wn._('From Purchase Order'),
|
cur_frm.add_custom_button(wn._('From Purchase Order'),
|
||||||
@ -68,6 +71,10 @@ erpnext.stock.PurchaseReceiptController = erpnext.buying.BuyingController.extend
|
|||||||
var item = wn.model.get_doc(cdt, cdn);
|
var item = wn.model.get_doc(cdt, cdn);
|
||||||
wn.model.round_floats_in(item, ["qty", "received_qty"]);
|
wn.model.round_floats_in(item, ["qty", "received_qty"]);
|
||||||
|
|
||||||
|
if(!(item.received_qty || item.rejected_qty) && item.qty) {
|
||||||
|
item.received_qty = item.qty;
|
||||||
|
}
|
||||||
|
|
||||||
if(item.qty > item.received_qty) {
|
if(item.qty > item.received_qty) {
|
||||||
msgprint(wn._("Error") + ": " + wn._(wn.meta.get_label(item.doctype, "qty", item.name))
|
msgprint(wn._("Error") + ": " + wn._(wn.meta.get_label(item.doctype, "qty", item.name))
|
||||||
+ " > " + wn._(wn.meta.get_label(item.doctype, "received_qty", item.name)));
|
+ " > " + wn._(wn.meta.get_label(item.doctype, "received_qty", item.name)));
|
||||||
|
@ -45,6 +45,13 @@ class DocType(BuyingController):
|
|||||||
'percent_join_field': 'prevdoc_docname',
|
'percent_join_field': 'prevdoc_docname',
|
||||||
}]
|
}]
|
||||||
|
|
||||||
|
def onload(self):
|
||||||
|
billed_qty = webnotes.conn.sql("""select sum(ifnull(qty, 0)) from `tabPurchase Invoice Item`
|
||||||
|
where purchase_receipt=%s""", self.doc.name)
|
||||||
|
if billed_qty:
|
||||||
|
total_qty = sum((item.qty for item in self.doclist.get({"parentfield": "purchase_receipt_details"})))
|
||||||
|
self.doc.fields["__billing_complete"] = billed_qty[0][0] == total_qty
|
||||||
|
|
||||||
# get available qty at warehouse
|
# get available qty at warehouse
|
||||||
def get_bin_details(self, arg = ''):
|
def get_bin_details(self, arg = ''):
|
||||||
return get_obj(dt='Purchase Common').get_bin_details(arg)
|
return get_obj(dt='Purchase Common').get_bin_details(arg)
|
||||||
|
@ -54,7 +54,7 @@ cur_frm.fields_dict['territory'].get_query = function(doc,cdt,cdn) {
|
|||||||
// Supplier
|
// Supplier
|
||||||
//-------------
|
//-------------
|
||||||
cur_frm.cscript.supplier = function(doc,dt,dn) {
|
cur_frm.cscript.supplier = function(doc,dt,dn) {
|
||||||
if(doc.supplier) get_server_fields('get_default_supplier_address', JSON.stringify({supplier: doc.supplier}),'', doc, dt, dn, 1);
|
if(doc.supplier) return get_server_fields('get_default_supplier_address', JSON.stringify({supplier: doc.supplier}),'', doc, dt, dn, 1);
|
||||||
if(doc.supplier) unhide_field(['supplier_name','address_display']);
|
if(doc.supplier) unhide_field(['supplier_name','address_display']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,14 +25,14 @@ erpnext.stock.StockEntry = erpnext.stock.StockController.extend({
|
|||||||
set_default_account: function() {
|
set_default_account: function() {
|
||||||
var me = this;
|
var me = this;
|
||||||
|
|
||||||
if (sys_defaults.auto_inventory_accounting && !this.frm.doc.expense_adjustment_account) {
|
if (cint(wn.defaults.get_default("auto_inventory_accounting")) && !this.frm.doc.expense_adjustment_account) {
|
||||||
if (this.frm.doc.purpose == "Sales Return")
|
if (this.frm.doc.purpose == "Sales Return")
|
||||||
account_for = "stock_in_hand_account";
|
account_for = "stock_in_hand_account";
|
||||||
else if (this.frm.doc.purpose == "Purchase Return")
|
else if (this.frm.doc.purpose == "Purchase Return")
|
||||||
account_for = "stock_received_but_not_billed";
|
account_for = "stock_received_but_not_billed";
|
||||||
else account_for = "stock_adjustment_account";
|
else account_for = "stock_adjustment_account";
|
||||||
|
|
||||||
this.frm.call({
|
return this.frm.call({
|
||||||
method: "accounts.utils.get_company_default",
|
method: "accounts.utils.get_company_default",
|
||||||
args: {
|
args: {
|
||||||
"fieldname": account_for,
|
"fieldname": account_for,
|
||||||
@ -78,7 +78,7 @@ erpnext.stock.StockEntry = erpnext.stock.StockController.extend({
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if (sys_defaults.auto_inventory_accounting) {
|
if(cint(wn.defaults.get_default("auto_inventory_accounting"))) {
|
||||||
this.frm.add_fetch("company", "stock_adjustment_account", "expense_adjustment_account");
|
this.frm.add_fetch("company", "stock_adjustment_account", "expense_adjustment_account");
|
||||||
|
|
||||||
this.frm.fields_dict["expense_adjustment_account"].get_query = function() {
|
this.frm.fields_dict["expense_adjustment_account"].get_query = function() {
|
||||||
@ -105,11 +105,8 @@ erpnext.stock.StockEntry = erpnext.stock.StockController.extend({
|
|||||||
erpnext.hide_naming_series();
|
erpnext.hide_naming_series();
|
||||||
this.toggle_related_fields(this.frm.doc);
|
this.toggle_related_fields(this.frm.doc);
|
||||||
this.toggle_enable_bom();
|
this.toggle_enable_bom();
|
||||||
if (this.frm.doc.docstatus==1) {
|
this.show_stock_ledger();
|
||||||
this.show_stock_ledger();
|
this.show_general_ledger();
|
||||||
if(wn.boot.auto_inventory_accounting)
|
|
||||||
this.show_general_ledger();
|
|
||||||
}
|
|
||||||
|
|
||||||
if(this.frm.doc.docstatus === 1 &&
|
if(this.frm.doc.docstatus === 1 &&
|
||||||
wn.boot.profile.can_create.indexOf("Journal Voucher")!==-1) {
|
wn.boot.profile.can_create.indexOf("Journal Voucher")!==-1) {
|
||||||
@ -142,7 +139,7 @@ erpnext.stock.StockEntry = erpnext.stock.StockController.extend({
|
|||||||
},
|
},
|
||||||
|
|
||||||
get_items: function() {
|
get_items: function() {
|
||||||
this.frm.call({
|
return this.frm.call({
|
||||||
doc: this.frm.doc,
|
doc: this.frm.doc,
|
||||||
method: "get_items",
|
method: "get_items",
|
||||||
callback: function(r) {
|
callback: function(r) {
|
||||||
@ -160,7 +157,7 @@ erpnext.stock.StockEntry = erpnext.stock.StockController.extend({
|
|||||||
production_order: function() {
|
production_order: function() {
|
||||||
this.toggle_enable_bom();
|
this.toggle_enable_bom();
|
||||||
|
|
||||||
this.frm.call({
|
return this.frm.call({
|
||||||
method: "get_production_order_details",
|
method: "get_production_order_details",
|
||||||
args: {production_order: this.frm.doc.production_order}
|
args: {production_order: this.frm.doc.production_order}
|
||||||
});
|
});
|
||||||
@ -212,7 +209,7 @@ erpnext.stock.StockEntry = erpnext.stock.StockController.extend({
|
|||||||
|
|
||||||
make_return_jv: function() {
|
make_return_jv: function() {
|
||||||
if(this.get_doctype_docname()) {
|
if(this.get_doctype_docname()) {
|
||||||
this.frm.call({
|
return this.frm.call({
|
||||||
method: "make_return_jv",
|
method: "make_return_jv",
|
||||||
args: {
|
args: {
|
||||||
stock_entry: this.frm.doc.name
|
stock_entry: this.frm.doc.name
|
||||||
@ -269,23 +266,23 @@ cur_frm.cscript.toggle_related_fields = function(doc) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.delivery_note_no = function(doc,cdt,cdn){
|
cur_frm.cscript.delivery_note_no = function(doc,cdt,cdn){
|
||||||
if(doc.delivery_note_no) get_server_fields('get_cust_values','','',doc,cdt,cdn,1);
|
if(doc.delivery_note_no) return get_server_fields('get_cust_values','','',doc,cdt,cdn,1);
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.sales_invoice_no = function(doc,cdt,cdn){
|
cur_frm.cscript.sales_invoice_no = function(doc,cdt,cdn){
|
||||||
if(doc.sales_invoice_no) get_server_fields('get_cust_values','','',doc,cdt,cdn,1);
|
if(doc.sales_invoice_no) return get_server_fields('get_cust_values','','',doc,cdt,cdn,1);
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.customer = function(doc,cdt,cdn){
|
cur_frm.cscript.customer = function(doc,cdt,cdn){
|
||||||
if(doc.customer) get_server_fields('get_cust_addr','','',doc,cdt,cdn,1);
|
if(doc.customer) return get_server_fields('get_cust_addr','','',doc,cdt,cdn,1);
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.purchase_receipt_no = function(doc,cdt,cdn){
|
cur_frm.cscript.purchase_receipt_no = function(doc,cdt,cdn){
|
||||||
if(doc.purchase_receipt_no) get_server_fields('get_supp_values','','',doc,cdt,cdn,1);
|
if(doc.purchase_receipt_no) return get_server_fields('get_supp_values','','',doc,cdt,cdn,1);
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.supplier = function(doc,cdt,cdn){
|
cur_frm.cscript.supplier = function(doc,cdt,cdn){
|
||||||
if(doc.supplier) get_server_fields('get_supp_addr','','',doc,cdt,cdn,1);
|
if(doc.supplier) return get_server_fields('get_supp_addr','','',doc,cdt,cdn,1);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -328,7 +325,7 @@ cur_frm.cscript.item_code = function(doc, cdt, cdn) {
|
|||||||
'serial_no' : d.serial_no,
|
'serial_no' : d.serial_no,
|
||||||
'bom_no' : d.bom_no
|
'bom_no' : d.bom_no
|
||||||
};
|
};
|
||||||
get_server_fields('get_item_details',JSON.stringify(args),'mtn_details',doc,cdt,cdn,1);
|
return get_server_fields('get_item_details',JSON.stringify(args),'mtn_details',doc,cdt,cdn,1);
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.s_warehouse = function(doc, cdt, cdn) {
|
cur_frm.cscript.s_warehouse = function(doc, cdt, cdn) {
|
||||||
@ -341,7 +338,7 @@ cur_frm.cscript.s_warehouse = function(doc, cdt, cdn) {
|
|||||||
'bom_no' : d.bom_no,
|
'bom_no' : d.bom_no,
|
||||||
'qty' : d.s_warehouse ? -1* d.qty : d.qty
|
'qty' : d.s_warehouse ? -1* d.qty : d.qty
|
||||||
}
|
}
|
||||||
get_server_fields('get_warehouse_details', JSON.stringify(args),
|
return get_server_fields('get_warehouse_details', JSON.stringify(args),
|
||||||
'mtn_details', doc, cdt, cdn, 1);
|
'mtn_details', doc, cdt, cdn, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -351,7 +348,7 @@ cur_frm.cscript.uom = function(doc, cdt, cdn) {
|
|||||||
var d = locals[cdt][cdn];
|
var d = locals[cdt][cdn];
|
||||||
if(d.uom && d.item_code){
|
if(d.uom && d.item_code){
|
||||||
var arg = {'item_code':d.item_code, 'uom':d.uom, 'qty':d.qty}
|
var arg = {'item_code':d.item_code, 'uom':d.uom, 'qty':d.qty}
|
||||||
get_server_fields('get_uom_details',JSON.stringify(arg),'mtn_details', doc, cdt, cdn, 1);
|
return get_server_fields('get_uom_details',JSON.stringify(arg),'mtn_details', doc, cdt, cdn, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -554,7 +554,7 @@ class DocType(StockController):
|
|||||||
`tabBOM Item`, `tabItem`
|
`tabBOM Item`, `tabItem`
|
||||||
where
|
where
|
||||||
`tabBOM Item`.parent = %s and
|
`tabBOM Item`.parent = %s and
|
||||||
`tabBOM Item`.item_code = tabItem.name
|
`tabBOM Item`.item_code = tabItem.name and
|
||||||
`tabBOM Item`.docstatus < 2
|
`tabBOM Item`.docstatus < 2
|
||||||
group by item_code""", (qty, self.doc.bom_no), as_dict=1)
|
group by item_code""", (qty, self.doc.bom_no), as_dict=1)
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ erpnext.stock.StockReconciliation = erpnext.stock.StockController.extend({
|
|||||||
var me = this;
|
var me = this;
|
||||||
|
|
||||||
if (sys_defaults.auto_inventory_accounting && !this.frm.doc.expense_account) {
|
if (sys_defaults.auto_inventory_accounting && !this.frm.doc.expense_account) {
|
||||||
this.frm.call({
|
return this.frm.call({
|
||||||
method: "accounts.utils.get_company_default",
|
method: "accounts.utils.get_company_default",
|
||||||
args: {
|
args: {
|
||||||
"fieldname": "stock_adjustment_account",
|
"fieldname": "stock_adjustment_account",
|
||||||
@ -68,6 +68,7 @@ erpnext.stock.StockReconciliation = erpnext.stock.StockController.extend({
|
|||||||
} else if(this.frm.doc.docstatus == 1) {
|
} else if(this.frm.doc.docstatus == 1) {
|
||||||
this.frm.set_intro("Cancelling this Stock Reconciliation will nullify its effect.");
|
this.frm.set_intro("Cancelling this Stock Reconciliation will nullify its effect.");
|
||||||
this.show_stock_ledger();
|
this.show_stock_ledger();
|
||||||
|
this.show_general_ledger();
|
||||||
} else {
|
} else {
|
||||||
this.frm.set_intro("");
|
this.frm.set_intro("");
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@ $.extend(cur_frm.cscript, {
|
|||||||
|
|
||||||
item_code: function() {
|
item_code: function() {
|
||||||
if(cur_frm.doc.item_code) {
|
if(cur_frm.doc.item_code) {
|
||||||
cur_frm.call({
|
return cur_frm.call({
|
||||||
method: "get_stock_uom",
|
method: "get_stock_uom",
|
||||||
args: { item_code: cur_frm.doc.item_code }
|
args: { item_code: cur_frm.doc.item_code }
|
||||||
});
|
});
|
||||||
|
@ -26,6 +26,6 @@ cur_frm.cscript.merge = function(doc, cdt, cdn) {
|
|||||||
var check = confirm("Are you sure you want to merge this warehouse into "
|
var check = confirm("Are you sure you want to merge this warehouse into "
|
||||||
+ doc.merge_with + "?");
|
+ doc.merge_with + "?");
|
||||||
if (check) {
|
if (check) {
|
||||||
$c_obj(make_doclist(cdt, cdn), 'merge_warehouses', '', '');
|
return $c_obj(make_doclist(cdt, cdn), 'merge_warehouses', '', '');
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -26,13 +26,13 @@ erpnext.support.CustomerIssue = wn.ui.form.Controller.extend({
|
|||||||
customer: function() {
|
customer: function() {
|
||||||
var me = this;
|
var me = this;
|
||||||
if(this.frm.doc.customer) {
|
if(this.frm.doc.customer) {
|
||||||
this.frm.call({
|
// TODO shift this to depends_on
|
||||||
|
unhide_field(['customer_address', 'contact_person']);
|
||||||
|
|
||||||
|
return this.frm.call({
|
||||||
doc: this.frm.doc,
|
doc: this.frm.doc,
|
||||||
method: "set_customer_defaults",
|
method: "set_customer_defaults",
|
||||||
});
|
});
|
||||||
|
|
||||||
// TODO shift this to depends_on
|
|
||||||
unhide_field(['customer_address', 'contact_person']);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -56,7 +56,7 @@ cur_frm.cscript.onload = function(doc,cdt,cdn){
|
|||||||
|
|
||||||
cur_frm.cscript.customer_address = cur_frm.cscript.contact_person = function(doc,dt,dn) {
|
cur_frm.cscript.customer_address = cur_frm.cscript.contact_person = function(doc,dt,dn) {
|
||||||
if(doc.customer)
|
if(doc.customer)
|
||||||
get_server_fields('get_customer_address',
|
return get_server_fields('get_customer_address',
|
||||||
JSON.stringify({customer: doc.customer, address: doc.customer_address, contact: doc.contact_person}),'', doc, dt, dn, 1);
|
JSON.stringify({customer: doc.customer, address: doc.customer_address, contact: doc.contact_person}),'', doc, dt, dn, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ erpnext.support.MaintenanceSchedule = wn.ui.form.Controller.extend({
|
|||||||
customer: function() {
|
customer: function() {
|
||||||
var me = this;
|
var me = this;
|
||||||
if(this.frm.doc.customer) {
|
if(this.frm.doc.customer) {
|
||||||
this.frm.call({
|
return this.frm.call({
|
||||||
doc: this.frm.doc,
|
doc: this.frm.doc,
|
||||||
method: "set_customer_defaults",
|
method: "set_customer_defaults",
|
||||||
});
|
});
|
||||||
@ -64,7 +64,7 @@ cur_frm.cscript.onload = function(doc, dt, dn) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.customer_address = cur_frm.cscript.contact_person = function(doc,dt,dn) {
|
cur_frm.cscript.customer_address = cur_frm.cscript.contact_person = function(doc,dt,dn) {
|
||||||
if(doc.customer) get_server_fields('get_customer_address', JSON.stringify({customer: doc.customer, address: doc.customer_address, contact: doc.contact_person}),'', doc, dt, dn, 1);
|
if(doc.customer) return get_server_fields('get_customer_address', JSON.stringify({customer: doc.customer, address: doc.customer_address, contact: doc.contact_person}),'', doc, dt, dn, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.fields_dict['customer_address'].get_query = function(doc, cdt, cdn) {
|
cur_frm.fields_dict['customer_address'].get_query = function(doc, cdt, cdn) {
|
||||||
@ -90,7 +90,7 @@ cur_frm.cscript.item_code = function(doc, cdt, cdn) {
|
|||||||
var fname = cur_frm.cscript.fname;
|
var fname = cur_frm.cscript.fname;
|
||||||
var d = locals[cdt][cdn];
|
var d = locals[cdt][cdn];
|
||||||
if (d.item_code) {
|
if (d.item_code) {
|
||||||
get_server_fields('get_item_details',d.item_code, 'item_maintenance_detail',doc,cdt,cdn,1);
|
return get_server_fields('get_item_details',d.item_code, 'item_maintenance_detail',doc,cdt,cdn,1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -101,7 +101,7 @@ cur_frm.cscript.periodicity = function(doc, cdt, cdn){
|
|||||||
arg.start_date = d.start_date;
|
arg.start_date = d.start_date;
|
||||||
arg.end_date = d.end_date;
|
arg.end_date = d.end_date;
|
||||||
arg.periodicity = d.periodicity;
|
arg.periodicity = d.periodicity;
|
||||||
get_server_fields('get_no_of_visits',docstring(arg),'item_maintenance_detail',doc, cdt, cdn, 1);
|
return get_server_fields('get_no_of_visits',docstring(arg),'item_maintenance_detail',doc, cdt, cdn, 1);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
msgprint("Please enter Start Date and End Date");
|
msgprint("Please enter Start Date and End Date");
|
||||||
@ -110,7 +110,7 @@ cur_frm.cscript.periodicity = function(doc, cdt, cdn){
|
|||||||
|
|
||||||
cur_frm.cscript.generate_schedule = function(doc, cdt, cdn) {
|
cur_frm.cscript.generate_schedule = function(doc, cdt, cdn) {
|
||||||
if (!doc.__islocal) {
|
if (!doc.__islocal) {
|
||||||
$c('runserverobj', args={'method':'generate_schedule', 'docs':wn.model.compress(make_doclist(cdt,cdn))},
|
return $c('runserverobj', args={'method':'generate_schedule', 'docs':wn.model.compress(make_doclist(cdt,cdn))},
|
||||||
function(r,rt){
|
function(r,rt){
|
||||||
refresh_field('maintenance_schedule_detail');
|
refresh_field('maintenance_schedule_detail');
|
||||||
}
|
}
|
||||||
|
@ -62,13 +62,13 @@ erpnext.support.MaintenanceVisit = wn.ui.form.Controller.extend({
|
|||||||
customer: function() {
|
customer: function() {
|
||||||
var me = this;
|
var me = this;
|
||||||
if(this.frm.doc.customer) {
|
if(this.frm.doc.customer) {
|
||||||
this.frm.call({
|
// TODO shift this to depends_on
|
||||||
|
cur_frm.cscript.hide_contact_info();
|
||||||
|
|
||||||
|
return this.frm.call({
|
||||||
doc: this.frm.doc,
|
doc: this.frm.doc,
|
||||||
method: "set_customer_defaults",
|
method: "set_customer_defaults",
|
||||||
});
|
});
|
||||||
|
|
||||||
// TODO shift this to depends_on
|
|
||||||
cur_frm.cscript.hide_contact_info();
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@ -86,7 +86,7 @@ cur_frm.cscript.hide_contact_info = function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.customer_address = cur_frm.cscript.contact_person = function(doc,dt,dn) {
|
cur_frm.cscript.customer_address = cur_frm.cscript.contact_person = function(doc,dt,dn) {
|
||||||
if(doc.customer) get_server_fields('get_customer_address', JSON.stringify({customer: doc.customer, address: doc.customer_address, contact: doc.contact_person}),'', doc, dt, dn, 1);
|
if(doc.customer) return get_server_fields('get_customer_address', JSON.stringify({customer: doc.customer, address: doc.customer_address, contact: doc.contact_person}),'', doc, dt, dn, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.fields_dict['customer_address'].get_query = function(doc, cdt, cdn) {
|
cur_frm.fields_dict['customer_address'].get_query = function(doc, cdt, cdn) {
|
||||||
@ -111,7 +111,7 @@ cur_frm.cscript.item_code = function(doc, cdt, cdn) {
|
|||||||
var fname = cur_frm.cscript.fname;
|
var fname = cur_frm.cscript.fname;
|
||||||
var d = locals[cdt][cdn];
|
var d = locals[cdt][cdn];
|
||||||
if (d.item_code) {
|
if (d.item_code) {
|
||||||
get_server_fields('get_item_details',d.item_code, 'maintenance_visit_details',doc,cdt,cdn,1);
|
return get_server_fields('get_item_details',d.item_code, 'maintenance_visit_details',doc,cdt,cdn,1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ cur_frm.cscript.refresh = function(doc) {
|
|||||||
if(!doc.__islocal && !cint(doc.email_sent) && !doc.__unsaved
|
if(!doc.__islocal && !cint(doc.email_sent) && !doc.__unsaved
|
||||||
&& inList(wn.boot.profile.can_write, doc.doctype)) {
|
&& inList(wn.boot.profile.can_write, doc.doctype)) {
|
||||||
cur_frm.add_custom_button('Send', function() {
|
cur_frm.add_custom_button('Send', function() {
|
||||||
$c_obj(make_doclist(doc.doctype, doc.name), 'send_emails', '', function(r) {
|
return $c_obj(make_doclist(doc.doctype, doc.name), 'send_emails', '', function(r) {
|
||||||
cur_frm.refresh();
|
cur_frm.refresh();
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
@ -30,7 +30,7 @@ cur_frm.cscript.refresh = function(doc) {
|
|||||||
repl("%(fullname)s <%(email)s>", wn.user_info(doc.owner)));
|
repl("%(fullname)s <%(email)s>", wn.user_info(doc.owner)));
|
||||||
}
|
}
|
||||||
|
|
||||||
wn.call({
|
return wn.call({
|
||||||
method: "support.doctype.newsletter.newsletter.get_lead_options",
|
method: "support.doctype.newsletter.newsletter.get_lead_options",
|
||||||
type: "GET",
|
type: "GET",
|
||||||
callback: function(r) {
|
callback: function(r) {
|
||||||
|
@ -23,7 +23,7 @@ erpnext.support.CustomerIssue = wn.ui.form.Controller.extend({
|
|||||||
customer: function() {
|
customer: function() {
|
||||||
var me = this;
|
var me = this;
|
||||||
if(this.frm.doc.customer) {
|
if(this.frm.doc.customer) {
|
||||||
this.frm.call({
|
return this.frm.call({
|
||||||
doc: this.frm.doc,
|
doc: this.frm.doc,
|
||||||
method: "set_customer_defaults",
|
method: "set_customer_defaults",
|
||||||
});
|
});
|
||||||
@ -93,7 +93,7 @@ $.extend(cur_frm.cscript, {
|
|||||||
},
|
},
|
||||||
|
|
||||||
set_status: function(status) {
|
set_status: function(status) {
|
||||||
wn.call({
|
return wn.call({
|
||||||
method:"support.doctype.support_ticket.support_ticket.set_status",
|
method:"support.doctype.support_ticket.support_ticket.set_status",
|
||||||
args: {
|
args: {
|
||||||
name: cur_frm.doc.name,
|
name: cur_frm.doc.name,
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
cur_frm.cscript.refresh = function(doc) {
|
cur_frm.cscript.refresh = function(doc) {
|
||||||
wn.call({
|
return wn.call({
|
||||||
method:"utilities.doctype.rename_tool.rename_tool.get_doctypes",
|
method:"utilities.doctype.rename_tool.rename_tool.get_doctypes",
|
||||||
callback: function(r) {
|
callback: function(r) {
|
||||||
cur_frm.set_df_property("select_doctype", "options", r.message);
|
cur_frm.set_df_property("select_doctype", "options", r.message);
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
function SMSManager() {
|
function SMSManager() {
|
||||||
var me = this;
|
var me = this;
|
||||||
this.get_contact_number = function(contact, key, value) {
|
this.get_contact_number = function(contact, key, value) {
|
||||||
$c_obj('SMS Control', 'get_contact_number', {
|
return $c_obj('SMS Control', 'get_contact_number', {
|
||||||
contact_name:contact,
|
contact_name:contact,
|
||||||
value:value,
|
value:value,
|
||||||
key:key
|
key:key
|
||||||
@ -63,7 +63,7 @@ function SMSManager() {
|
|||||||
var v = me.dialog.get_values();
|
var v = me.dialog.get_values();
|
||||||
if(v) {
|
if(v) {
|
||||||
$(this).set_working();
|
$(this).set_working();
|
||||||
$c_obj('SMS Control', 'send_form_sms', v, function(r,rt) {
|
return $c_obj('SMS Control', 'send_form_sms', v, function(r,rt) {
|
||||||
$(this).done_working();
|
$(this).done_working();
|
||||||
if(r.exc) {msgprint(r.exc); return; }
|
if(r.exc) {msgprint(r.exc); return; }
|
||||||
msgprint('Message Sent');
|
msgprint('Message Sent');
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
wn.cart.bind_events();
|
wn.cart.bind_events();
|
||||||
wn.call({
|
return wn.call({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
method: "website.helpers.cart.get_cart_quotation",
|
method: "website.helpers.cart.get_cart_quotation",
|
||||||
callback: function(r) {
|
callback: function(r) {
|
||||||
@ -204,7 +204,7 @@ $.extend(wn.cart, {
|
|||||||
},
|
},
|
||||||
|
|
||||||
apply_shipping_rule: function(rule, btn) {
|
apply_shipping_rule: function(rule, btn) {
|
||||||
wn.call({
|
return wn.call({
|
||||||
btn: btn,
|
btn: btn,
|
||||||
type: "POST",
|
type: "POST",
|
||||||
method: "website.helpers.cart.apply_shipping_rule",
|
method: "website.helpers.cart.apply_shipping_rule",
|
||||||
@ -257,7 +257,7 @@ $.extend(wn.cart, {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
wn.call({
|
return wn.call({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
method: "website.helpers.cart.update_cart_address",
|
method: "website.helpers.cart.update_cart_address",
|
||||||
args: {
|
args: {
|
||||||
@ -288,7 +288,7 @@ $.extend(wn.cart, {
|
|||||||
},
|
},
|
||||||
|
|
||||||
place_order: function() {
|
place_order: function() {
|
||||||
wn.call({
|
return wn.call({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
method: "website.helpers.cart.place_order",
|
method: "website.helpers.cart.place_order",
|
||||||
callback: function(r) {
|
callback: function(r) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user