This commit is contained in:
@@ -18,7 +18,7 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
|||||||
|
|
||||||
if(doc.group_or_ledger=='Ledger') {
|
if(doc.group_or_ledger=='Ledger') {
|
||||||
frappe.model.with_doc("Accounts Settings", "Accounts Settings", function (name) {
|
frappe.model.with_doc("Accounts Settings", "Accounts Settings", function (name) {
|
||||||
var accounts_settings = frappe.model.get_doc("Accounts Settings", name);
|
var accounts_settings = frappe.get_doc("Accounts Settings", name);
|
||||||
var display = accounts_settings["frozen_accounts_modifier"]
|
var display = accounts_settings["frozen_accounts_modifier"]
|
||||||
&& in_list(user_roles, accounts_settings["frozen_accounts_modifier"]);
|
&& in_list(user_roles, accounts_settings["frozen_accounts_modifier"]);
|
||||||
|
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ erpnext.accounts.JournalVoucher = frappe.ui.form.Controller.extend({
|
|||||||
$.each([["against_voucher", "Purchase Invoice", "credit_to"],
|
$.each([["against_voucher", "Purchase Invoice", "credit_to"],
|
||||||
["against_invoice", "Sales Invoice", "debit_to"]], function(i, opts) {
|
["against_invoice", "Sales Invoice", "debit_to"]], function(i, opts) {
|
||||||
me.frm.set_query(opts[0], "entries", function(doc, cdt, cdn) {
|
me.frm.set_query(opts[0], "entries", function(doc, cdt, cdn) {
|
||||||
var jvd = frappe.model.get_doc(cdt, cdn);
|
var jvd = frappe.get_doc(cdt, cdn);
|
||||||
frappe.model.validate_missing(jvd, "account");
|
frappe.model.validate_missing(jvd, "account");
|
||||||
return {
|
return {
|
||||||
filters: [
|
filters: [
|
||||||
@@ -52,7 +52,7 @@ erpnext.accounts.JournalVoucher = frappe.ui.form.Controller.extend({
|
|||||||
});
|
});
|
||||||
|
|
||||||
this.frm.set_query("against_jv", "entries", function(doc, cdt, cdn) {
|
this.frm.set_query("against_jv", "entries", function(doc, cdt, cdn) {
|
||||||
var jvd = frappe.model.get_doc(cdt, cdn);
|
var jvd = frappe.get_doc(cdt, cdn);
|
||||||
frappe.model.validate_missing(jvd, "account");
|
frappe.model.validate_missing(jvd, "account");
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@@ -63,7 +63,7 @@ erpnext.accounts.JournalVoucher = frappe.ui.form.Controller.extend({
|
|||||||
},
|
},
|
||||||
|
|
||||||
against_voucher: function(doc, cdt, cdn) {
|
against_voucher: function(doc, cdt, cdn) {
|
||||||
var d = frappe.model.get_doc(cdt, cdn);
|
var d = frappe.get_doc(cdt, cdn);
|
||||||
if (d.against_voucher && !flt(d.debit)) {
|
if (d.against_voucher && !flt(d.debit)) {
|
||||||
this.get_outstanding({
|
this.get_outstanding({
|
||||||
'doctype': 'Purchase Invoice',
|
'doctype': 'Purchase Invoice',
|
||||||
@@ -73,7 +73,7 @@ erpnext.accounts.JournalVoucher = frappe.ui.form.Controller.extend({
|
|||||||
},
|
},
|
||||||
|
|
||||||
against_invoice: function(doc, cdt, cdn) {
|
against_invoice: function(doc, cdt, cdn) {
|
||||||
var d = frappe.model.get_doc(cdt, cdn);
|
var d = frappe.get_doc(cdt, cdn);
|
||||||
if (d.against_invoice && !flt(d.credit)) {
|
if (d.against_invoice && !flt(d.credit)) {
|
||||||
this.get_outstanding({
|
this.get_outstanding({
|
||||||
'doctype': 'Sales Invoice',
|
'doctype': 'Sales Invoice',
|
||||||
@@ -83,7 +83,7 @@ erpnext.accounts.JournalVoucher = frappe.ui.form.Controller.extend({
|
|||||||
},
|
},
|
||||||
|
|
||||||
against_jv: function(doc, cdt, cdn) {
|
against_jv: function(doc, cdt, cdn) {
|
||||||
var d = frappe.model.get_doc(cdt, cdn);
|
var d = frappe.get_doc(cdt, cdn);
|
||||||
if (d.against_jv && !flt(d.credit) && !flt(d.debit)) {
|
if (d.against_jv && !flt(d.credit) && !flt(d.debit)) {
|
||||||
this.get_outstanding({
|
this.get_outstanding({
|
||||||
'doctype': 'Journal Voucher',
|
'doctype': 'Journal Voucher',
|
||||||
@@ -138,7 +138,7 @@ cur_frm.cscript.is_opening = function(doc, cdt, cdn) {
|
|||||||
|
|
||||||
cur_frm.cscript.update_totals = function(doc) {
|
cur_frm.cscript.update_totals = function(doc) {
|
||||||
var td=0.0; var tc =0.0;
|
var td=0.0; var tc =0.0;
|
||||||
var el = getchildren('Journal Voucher Detail', doc.name, 'entries');
|
var el = doc.entries || [];
|
||||||
for(var i in el) {
|
for(var i in el) {
|
||||||
td += flt(el[i].debit, 2);
|
td += flt(el[i].debit, 2);
|
||||||
tc += flt(el[i].credit, 2);
|
tc += flt(el[i].credit, 2);
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({
|
|||||||
},
|
},
|
||||||
|
|
||||||
entries_add: function(doc, cdt, cdn) {
|
entries_add: function(doc, cdt, cdn) {
|
||||||
var row = frappe.model.get_doc(cdt, cdn);
|
var row = frappe.get_doc(cdt, cdn);
|
||||||
this.frm.script_manager.copy_from_first_row("entries", row, ["expense_account", "cost_center"]);
|
this.frm.script_manager.copy_from_first_row("entries", row, ["expense_account", "cost_center"]);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -184,7 +184,7 @@ cur_frm.set_query("expense_account", "entries", function(doc) {
|
|||||||
cur_frm.cscript.expense_account = function(doc, cdt, cdn){
|
cur_frm.cscript.expense_account = function(doc, cdt, cdn){
|
||||||
var d = locals[cdt][cdn];
|
var d = locals[cdt][cdn];
|
||||||
if(d.idx == 1 && d.expense_account){
|
if(d.idx == 1 && d.expense_account){
|
||||||
var cl = getchildren('Purchase Invoice Item', doc.name, 'entries', doc.doctype);
|
var cl = doc.entries || [];
|
||||||
for(var i = 0; i < cl.length; i++){
|
for(var i = 0; i < cl.length; i++){
|
||||||
if(!cl[i].expense_account) cl[i].expense_account = d.expense_account;
|
if(!cl[i].expense_account) cl[i].expense_account = d.expense_account;
|
||||||
}
|
}
|
||||||
@@ -205,7 +205,7 @@ cur_frm.fields_dict["entries"].grid.get_field("cost_center").get_query = functio
|
|||||||
cur_frm.cscript.cost_center = function(doc, cdt, cdn){
|
cur_frm.cscript.cost_center = function(doc, cdt, cdn){
|
||||||
var d = locals[cdt][cdn];
|
var d = locals[cdt][cdn];
|
||||||
if(d.idx == 1 && d.cost_center){
|
if(d.idx == 1 && d.cost_center){
|
||||||
var cl = getchildren('Purchase Invoice Item', doc.name, 'entries', doc.doctype);
|
var cl = doc.entries || [];
|
||||||
for(var i = 0; i < cl.length; i++){
|
for(var i = 0; i < cl.length; i++){
|
||||||
if(!cl[i].cost_center) cl[i].cost_center = d.cost_center;
|
if(!cl[i].cost_center) cl[i].cost_center = d.cost_center;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ cur_frm.pformat.other_charges= function(doc) {
|
|||||||
return doc_field.print_hide;
|
return doc_field.print_hide;
|
||||||
}
|
}
|
||||||
|
|
||||||
var cl = getchildren('Purchase Taxes and Charges', doc.name, 'other_charges');
|
var cl = doc.other_charges || [];
|
||||||
|
|
||||||
// outer table
|
// outer table
|
||||||
var out='<div><table class="noborder" style="width:100%">\
|
var out='<div><table class="noborder" style="width:100%">\
|
||||||
|
|||||||
@@ -293,8 +293,7 @@ erpnext.POS = Class.extend({
|
|||||||
|
|
||||||
// check whether the item is already added
|
// check whether the item is already added
|
||||||
if (no_of_items != 0) {
|
if (no_of_items != 0) {
|
||||||
$.each(frappe.model.get_children(this.frm.doctype + " Item", this.frm.doc.name,
|
$.each(this.frm.doc[this.frm.cscript.fname] || [], function(i, d) {
|
||||||
this.frm.cscript.fname, this.frm.doctype), function(i, d) {
|
|
||||||
if (d.item_code == item_code) {
|
if (d.item_code == item_code) {
|
||||||
caught = true;
|
caught = true;
|
||||||
if (serial_no)
|
if (serial_no)
|
||||||
@@ -335,8 +334,7 @@ erpnext.POS = Class.extend({
|
|||||||
},
|
},
|
||||||
update_qty: function(item_code, qty) {
|
update_qty: function(item_code, qty) {
|
||||||
var me = this;
|
var me = this;
|
||||||
$.each(frappe.model.get_children(this.frm.doctype + " Item", this.frm.doc.name,
|
$.each(this.frm.doc[this.frm.cscript.fname] || [], function(i, d) {
|
||||||
this.frm.cscript.fname, this.frm.doctype), function(i, d) {
|
|
||||||
if (d.item_code == item_code) {
|
if (d.item_code == item_code) {
|
||||||
if (qty == 0) {
|
if (qty == 0) {
|
||||||
frappe.model.clear_doc(d.doctype, d.name);
|
frappe.model.clear_doc(d.doctype, d.name);
|
||||||
@@ -387,8 +385,7 @@ erpnext.POS = Class.extend({
|
|||||||
var me = this;
|
var me = this;
|
||||||
var $items = this.wrapper.find("#cart tbody").empty();
|
var $items = this.wrapper.find("#cart tbody").empty();
|
||||||
|
|
||||||
$.each(frappe.model.get_children(this.frm.doctype + " Item", this.frm.doc.name,
|
$.each(this.frm.doc[this.frm.cscript.fname] || [], function(i, d) {
|
||||||
this.frm.cscript.fname, this.frm.doctype), function(i, d) {
|
|
||||||
|
|
||||||
$(repl('<tr id="%(item_code)s" data-selected="false">\
|
$(repl('<tr id="%(item_code)s" data-selected="false">\
|
||||||
<td>%(item_code)s%(item_name)s</td>\
|
<td>%(item_code)s%(item_name)s</td>\
|
||||||
@@ -422,8 +419,7 @@ erpnext.POS = Class.extend({
|
|||||||
},
|
},
|
||||||
show_taxes: function() {
|
show_taxes: function() {
|
||||||
var me = this;
|
var me = this;
|
||||||
var taxes = frappe.model.get_children(this.sales_or_purchase + " Taxes and Charges",
|
var taxes = this.frm.doc[this.frm.cscript.other_fname] || [];
|
||||||
this.frm.doc.name, this.frm.cscript.other_fname, this.frm.doctype);
|
|
||||||
$(this.wrapper).find(".tax-table")
|
$(this.wrapper).find(".tax-table")
|
||||||
.toggle((taxes && taxes.length) ? true : false)
|
.toggle((taxes && taxes.length) ? true : false)
|
||||||
.find("tbody").empty();
|
.find("tbody").empty();
|
||||||
@@ -544,8 +540,7 @@ erpnext.POS = Class.extend({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var child = frappe.model.get_children(this.frm.doctype + " Item", this.frm.doc.name,
|
var child = this.frm.doc[this.frm.cscript.fname] || [];
|
||||||
this.frm.cscript.fname, this.frm.doctype);
|
|
||||||
|
|
||||||
$.each(child, function(i, d) {
|
$.each(child, function(i, d) {
|
||||||
for (var i in selected_items) {
|
for (var i in selected_items) {
|
||||||
|
|||||||
@@ -199,7 +199,7 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
|
|||||||
},
|
},
|
||||||
|
|
||||||
entries_add: function(doc, cdt, cdn) {
|
entries_add: function(doc, cdt, cdn) {
|
||||||
var row = frappe.model.get_doc(cdt, cdn);
|
var row = frappe.get_doc(cdt, cdn);
|
||||||
this.frm.script_manager.copy_from_first_row("entries", row, ["income_account", "cost_center"]);
|
this.frm.script_manager.copy_from_first_row("entries", row, ["income_account", "cost_center"]);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ cur_frm.pformat.other_charges= function(doc){
|
|||||||
|
|
||||||
out ='';
|
out ='';
|
||||||
if (!doc.print_without_amount) {
|
if (!doc.print_without_amount) {
|
||||||
var cl = getchildren('Sales Taxes and Charges', doc.name, 'other_charges');
|
var cl = doc.other_charges || [];
|
||||||
|
|
||||||
// outer table
|
// outer table
|
||||||
var out='<div><table class="noborder" style="width:100%"><tr><td style="width: 60%"></td><td>';
|
var out='<div><table class="noborder" style="width:100%"><tr><td style="width: 60%"></td><td>';
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
|
|||||||
},
|
},
|
||||||
|
|
||||||
price_list_rate: function(doc, cdt, cdn) {
|
price_list_rate: function(doc, cdt, cdn) {
|
||||||
var item = frappe.model.get_doc(cdt, cdn);
|
var item = frappe.get_doc(cdt, cdn);
|
||||||
frappe.model.round_floats_in(item, ["price_list_rate", "discount_percentage"]);
|
frappe.model.round_floats_in(item, ["price_list_rate", "discount_percentage"]);
|
||||||
|
|
||||||
item.rate = flt(item.price_list_rate * (1 - item.discount_percentage / 100.0),
|
item.rate = flt(item.price_list_rate * (1 - item.discount_percentage / 100.0),
|
||||||
@@ -92,7 +92,7 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
|
|||||||
},
|
},
|
||||||
|
|
||||||
rate: function(doc, cdt, cdn) {
|
rate: function(doc, cdt, cdn) {
|
||||||
var item = frappe.model.get_doc(cdt, cdn);
|
var item = frappe.get_doc(cdt, cdn);
|
||||||
frappe.model.round_floats_in(item, ["rate", "discount_percentage"]);
|
frappe.model.round_floats_in(item, ["rate", "discount_percentage"]);
|
||||||
|
|
||||||
if(item.price_list_rate) {
|
if(item.price_list_rate) {
|
||||||
@@ -107,7 +107,7 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
|
|||||||
|
|
||||||
uom: function(doc, cdt, cdn) {
|
uom: function(doc, cdt, cdn) {
|
||||||
var me = this;
|
var me = this;
|
||||||
var item = frappe.model.get_doc(cdt, cdn);
|
var item = frappe.get_doc(cdt, cdn);
|
||||||
if(item.item_code && item.uom) {
|
if(item.item_code && item.uom) {
|
||||||
return this.frm.call({
|
return this.frm.call({
|
||||||
method: "erpnext.buying.utils.get_conversion_factor",
|
method: "erpnext.buying.utils.get_conversion_factor",
|
||||||
@@ -132,7 +132,7 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
|
|||||||
|
|
||||||
conversion_factor: function(doc, cdt, cdn) {
|
conversion_factor: function(doc, cdt, cdn) {
|
||||||
if(frappe.meta.get_docfield(cdt, "stock_qty", cdn)) {
|
if(frappe.meta.get_docfield(cdt, "stock_qty", cdn)) {
|
||||||
var item = frappe.model.get_doc(cdt, cdn);
|
var item = frappe.get_doc(cdt, cdn);
|
||||||
frappe.model.round_floats_in(item, ["qty", "conversion_factor"]);
|
frappe.model.round_floats_in(item, ["qty", "conversion_factor"]);
|
||||||
item.stock_qty = flt(item.qty * item.conversion_factor, precision("stock_qty", item));
|
item.stock_qty = flt(item.qty * item.conversion_factor, precision("stock_qty", item));
|
||||||
refresh_field("stock_qty", item.name, item.parentfield);
|
refresh_field("stock_qty", item.name, item.parentfield);
|
||||||
@@ -140,7 +140,7 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
|
|||||||
},
|
},
|
||||||
|
|
||||||
warehouse: function(doc, cdt, cdn) {
|
warehouse: function(doc, cdt, cdn) {
|
||||||
var item = frappe.model.get_doc(cdt, cdn);
|
var item = frappe.get_doc(cdt, cdn);
|
||||||
if(item.item_code && item.warehouse) {
|
if(item.item_code && item.warehouse) {
|
||||||
return this.frm.call({
|
return this.frm.call({
|
||||||
method: "erpnext.buying.utils.get_projected_qty",
|
method: "erpnext.buying.utils.get_projected_qty",
|
||||||
@@ -154,7 +154,7 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
|
|||||||
},
|
},
|
||||||
|
|
||||||
project_name: function(doc, cdt, cdn) {
|
project_name: function(doc, cdt, cdn) {
|
||||||
var item = frappe.model.get_doc(cdt, cdn);
|
var item = frappe.get_doc(cdt, cdn);
|
||||||
if(item.project_name) {
|
if(item.project_name) {
|
||||||
$.each(this.frm.doc[this.fname],
|
$.each(this.frm.doc[this.fname],
|
||||||
function(i, other_item) {
|
function(i, other_item) {
|
||||||
|
|||||||
@@ -170,7 +170,7 @@ cur_frm.pformat.indent_no = function(doc, cdt, cdn){
|
|||||||
|
|
||||||
out ='';
|
out ='';
|
||||||
|
|
||||||
var cl = getchildren('Purchase Order Item',doc.name,'po_details');
|
var cl = doc.po_details || [];
|
||||||
|
|
||||||
// outer table
|
// outer table
|
||||||
var out='<div><table class="noborder" style="width:100%"><tr><td style="width: 50%"></td><td>';
|
var out='<div><table class="noborder" style="width:100%"><tr><td style="width: 50%"></td><td>';
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ cur_frm.cscript.refresh = function(doc, dt, dn) {
|
|||||||
cur_frm.cscript.make_contact(doc,dt,dn);
|
cur_frm.cscript.make_contact(doc,dt,dn);
|
||||||
|
|
||||||
cur_frm.communication_view = new frappe.views.CommunicationList({
|
cur_frm.communication_view = new frappe.views.CommunicationList({
|
||||||
list: frappe.model.get("Communication", {"supplier": doc.name}),
|
list: frappe.get_list("Communication", {"supplier": doc.name}),
|
||||||
parent: cur_frm.fields_dict.communication_html.wrapper,
|
parent: cur_frm.fields_dict.communication_html.wrapper,
|
||||||
doc: doc
|
doc: doc
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
|||||||
"Installation Note", "Opportunity", "Customer Issue", "Maintenance Visit",
|
"Installation Note", "Opportunity", "Customer Issue", "Maintenance Visit",
|
||||||
"Maintenance Schedule"]
|
"Maintenance Schedule"]
|
||||||
.indexOf(doctype)!==-1) {
|
.indexOf(doctype)!==-1) {
|
||||||
var refdoc = frappe.model.get_doc(doctype, docname);
|
var refdoc = frappe.get_doc(doctype, docname);
|
||||||
|
|
||||||
if(refdoc.doctype == "Quotation" ? refdoc.quotation_to=="Customer" : true) {
|
if(refdoc.doctype == "Quotation" ? refdoc.quotation_to=="Customer" : true) {
|
||||||
cur_frm.set_value("customer", refdoc.customer || refdoc.name);
|
cur_frm.set_value("customer", refdoc.customer || refdoc.name);
|
||||||
@@ -34,7 +34,7 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
|||||||
}
|
}
|
||||||
if(["Supplier", "Supplier Quotation", "Purchase Order", "Purchase Invoice", "Purchase Receipt"]
|
if(["Supplier", "Supplier Quotation", "Purchase Order", "Purchase Invoice", "Purchase Receipt"]
|
||||||
.indexOf(doctype)!==-1) {
|
.indexOf(doctype)!==-1) {
|
||||||
var refdoc = frappe.model.get_doc(doctype, docname);
|
var refdoc = frappe.get_doc(doctype, docname);
|
||||||
cur_frm.set_value("supplier", refdoc.supplier || refdoc.name);
|
cur_frm.set_value("supplier", refdoc.supplier || refdoc.name);
|
||||||
cur_frm.set_value("supplier_name", refdoc.supplier_name);
|
cur_frm.set_value("supplier_name", refdoc.supplier_name);
|
||||||
if(cur_frm.doc.doctype==="Address")
|
if(cur_frm.doc.doctype==="Address")
|
||||||
@@ -42,7 +42,7 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
|||||||
}
|
}
|
||||||
if(["Lead", "Quotation"]
|
if(["Lead", "Quotation"]
|
||||||
.indexOf(doctype)!==-1) {
|
.indexOf(doctype)!==-1) {
|
||||||
var refdoc = frappe.model.get_doc(doctype, docname);
|
var refdoc = frappe.get_doc(doctype, docname);
|
||||||
|
|
||||||
if(refdoc.doctype == "Quotation" ? refdoc.quotation_to=="Lead" : true) {
|
if(refdoc.doctype == "Quotation" ? refdoc.quotation_to=="Lead" : true) {
|
||||||
cur_frm.set_value("lead", refdoc.lead || refdoc.name);
|
cur_frm.set_value("lead", refdoc.lead || refdoc.name);
|
||||||
|
|||||||
@@ -32,7 +32,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){
|
||||||
//return 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 = doc.appraisal_details || [];
|
||||||
var total =0;
|
var total =0;
|
||||||
for(var i = 0; i<val.length; i++){
|
for(var i = 0; i<val.length; i++){
|
||||||
total = flt(total)+flt(val[i].score_earned)
|
total = flt(total)+flt(val[i].score_earned)
|
||||||
@@ -61,7 +61,7 @@ cur_frm.cscript.score = function(doc,cdt,cdn){
|
|||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.calculate_total = function(doc,cdt,cdn){
|
cur_frm.cscript.calculate_total = function(doc,cdt,cdn){
|
||||||
var val = getchildren('Appraisal Goal', doc.name, 'appraisal_details', doc.doctype);
|
var val = doc.appraisal_details || [];
|
||||||
var total =0;
|
var total =0;
|
||||||
for(var i = 0; i<val.length; i++){
|
for(var i = 0; i<val.length; i++){
|
||||||
total = flt(total)+flt(val[i].score_earned);
|
total = flt(total)+flt(val[i].score_earned);
|
||||||
|
|||||||
@@ -69,8 +69,7 @@ cur_frm.cscript.onload = function(doc,cdt,cdn) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.clear_sanctioned = function(doc) {
|
cur_frm.cscript.clear_sanctioned = function(doc) {
|
||||||
var val = getchildren('Expense Claim Detail', doc.name,
|
var val = doc.expense_voucher_details || [];
|
||||||
'expense_voucher_details', doc.doctype);
|
|
||||||
for(var i = 0; i<val.length; i++){
|
for(var i = 0; i<val.length; i++){
|
||||||
val[i].sanctioned_amount ='';
|
val[i].sanctioned_amount ='';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ cur_frm.cscript = {
|
|||||||
},
|
},
|
||||||
make_listing: function(doc) {
|
make_listing: function(doc) {
|
||||||
cur_frm.communication_view = new frappe.views.CommunicationList({
|
cur_frm.communication_view = new frappe.views.CommunicationList({
|
||||||
list: frappe.model.get("Communication", {"parent": doc.name, "parenttype": "Job Applicant"}),
|
list: frappe.get_list("Communication", {"parent": doc.name, "parenttype": "Job Applicant"}),
|
||||||
parent: cur_frm.fields_dict['thread_html'].wrapper,
|
parent: cur_frm.fields_dict['thread_html'].wrapper,
|
||||||
doc: doc,
|
doc: doc,
|
||||||
recipients: doc.email_id
|
recipients: doc.email_id
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ cur_frm.cscript.d_depends_on_lwp = cur_frm.cscript.d_modified_amount;
|
|||||||
// Calculate earning total
|
// Calculate earning total
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
var calculate_earning_total = function(doc, dt, dn) {
|
var calculate_earning_total = function(doc, dt, dn) {
|
||||||
var tbl = getchildren('Salary Slip Earning', doc.name, 'earning_details', doc.doctype);
|
var tbl = doc.earning_details || [];
|
||||||
|
|
||||||
var total_earn = 0;
|
var total_earn = 0;
|
||||||
for(var i = 0; i < tbl.length; i++){
|
for(var i = 0; i < tbl.length; i++){
|
||||||
@@ -82,7 +82,7 @@ var calculate_earning_total = function(doc, dt, dn) {
|
|||||||
// Calculate deduction total
|
// Calculate deduction total
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
var calculate_ded_total = function(doc, dt, dn) {
|
var calculate_ded_total = function(doc, dt, dn) {
|
||||||
var tbl = getchildren('Salary Slip Deduction', doc.name, 'deduction_details', doc.doctype);
|
var tbl = doc.deduction_details || [];
|
||||||
|
|
||||||
var total_ded = 0;
|
var total_ded = 0;
|
||||||
for(var i = 0; i < tbl.length; i++){
|
for(var i = 0; i < tbl.length; i++){
|
||||||
|
|||||||
@@ -4,8 +4,8 @@
|
|||||||
cur_frm.add_fetch('employee', 'company', 'company');
|
cur_frm.add_fetch('employee', 'company', 'company');
|
||||||
|
|
||||||
cur_frm.cscript.onload = function(doc, dt, dn){
|
cur_frm.cscript.onload = function(doc, dt, dn){
|
||||||
e_tbl = getchildren('Salary Structure Earning', doc.name, 'earning_details', doc.doctype);
|
e_tbl = doc.earning_details || [];
|
||||||
d_tbl = getchildren('Salary Structure Deduction', doc.name, 'deduction_details', doc.doctype);
|
d_tbl = doc.deduction_details || [];
|
||||||
if (e_tbl.length == 0 && d_tbl.length == 0)
|
if (e_tbl.length == 0 && d_tbl.length == 0)
|
||||||
return $c_obj(doc,'make_earn_ded_table','', function(r, rt) { refresh_many(['earning_details', 'deduction_details']);});
|
return $c_obj(doc,'make_earn_ded_table','', function(r, rt) { refresh_many(['earning_details', 'deduction_details']);});
|
||||||
}
|
}
|
||||||
@@ -39,8 +39,8 @@ cur_frm.cscript.d_modified_amt = function(doc, cdt, cdn){
|
|||||||
}
|
}
|
||||||
|
|
||||||
var calculate_totals = function(doc, cdt, cdn) {
|
var calculate_totals = function(doc, cdt, cdn) {
|
||||||
var tbl1 = getchildren('Salary Structure Earning', doc.name, 'earning_details', doc.doctype);
|
var tbl1 = doc.earning_details || [];
|
||||||
var tbl2 = getchildren('Salary Structure Deduction', doc.name, 'deduction_details', doc.doctype);
|
var tbl2 = doc.deduction_details || [];
|
||||||
|
|
||||||
var total_earn = 0; var total_ded = 0;
|
var total_earn = 0; var total_ded = 0;
|
||||||
for(var i = 0; i < tbl1.length; i++){
|
for(var i = 0; i < tbl1.length; i++){
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ cur_frm.cscript.operation_no = function(doc, cdt, cdn) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var set_operation_no = function(doc) {
|
var set_operation_no = function(doc) {
|
||||||
var op_table = getchildren('BOM Operation', doc.name, 'bom_operations');
|
var op_table = doc.bom_operations || [];
|
||||||
var operations = [];
|
var operations = [];
|
||||||
|
|
||||||
for (var i=0, j=op_table.length; i<j; i++) {
|
for (var i=0, j=op_table.length; i<j; i++) {
|
||||||
@@ -45,7 +45,7 @@ var set_operation_no = function(doc) {
|
|||||||
frappe.meta.get_docfield("BOM Item", "operation_no",
|
frappe.meta.get_docfield("BOM Item", "operation_no",
|
||||||
cur_frm.docname).options = operations.join("\n");
|
cur_frm.docname).options = operations.join("\n");
|
||||||
|
|
||||||
$.each(getchildren("BOM Item", doc.name, "bom_materials"), function(i, v) {
|
$.each(doc.bom_materials || [], function(i, v) {
|
||||||
if(!inList(operations, cstr(v.operation_no))) v.operation_no = null;
|
if(!inList(operations, cstr(v.operation_no))) v.operation_no = null;
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -132,7 +132,7 @@ cur_frm.cscript.rate = function(doc, cdt, cdn) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var calculate_op_cost = function(doc) {
|
var calculate_op_cost = function(doc) {
|
||||||
var op = getchildren('BOM Operation', doc.name, 'bom_operations');
|
var op = doc.bom_operations || [];
|
||||||
total_op_cost = 0;
|
total_op_cost = 0;
|
||||||
for(var i=0;i<op.length;i++) {
|
for(var i=0;i<op.length;i++) {
|
||||||
op_cost = flt(flt(op[i].hour_rate) * flt(op[i].time_in_mins) / 60, 2);
|
op_cost = flt(flt(op[i].hour_rate) * flt(op[i].time_in_mins) / 60, 2);
|
||||||
@@ -144,7 +144,7 @@ var calculate_op_cost = function(doc) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var calculate_rm_cost = function(doc) {
|
var calculate_rm_cost = function(doc) {
|
||||||
var rm = getchildren('BOM Item', doc.name, 'bom_materials');
|
var rm = doc.bom_materials || [];
|
||||||
total_rm_cost = 0;
|
total_rm_cost = 0;
|
||||||
for(var i=0;i<rm.length;i++) {
|
for(var i=0;i<rm.length;i++) {
|
||||||
amt = flt(rm[i].rate) * flt(rm[i].qty);
|
amt = flt(rm[i].rate) * flt(rm[i].qty);
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ erpnext.stock.StockController = frappe.ui.form.Controller.extend({
|
|||||||
copy_account_in_all_row: function(doc, dt, dn, fieldname) {
|
copy_account_in_all_row: function(doc, dt, dn, fieldname) {
|
||||||
var d = locals[dt][dn];
|
var d = locals[dt][dn];
|
||||||
if(d[fieldname]){
|
if(d[fieldname]){
|
||||||
var cl = getchildren(this.frm.cscript.tname, doc.name, this.frm.cscript.fname, doc.doctype);
|
var cl = doc[this.frm.cscript.fname] || [];
|
||||||
for(var i = 0; i < cl.length; i++) {
|
for(var i = 0; i < cl.length; i++) {
|
||||||
if(!cl[i][fieldname]) cl[i][fieldname] = d[fieldname];
|
if(!cl[i][fieldname]) cl[i][fieldname] = d[fieldname];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ erpnext.TransactionController = erpnext.stock.StockController.extend({
|
|||||||
|
|
||||||
item_code: function(doc, cdt, cdn) {
|
item_code: function(doc, cdt, cdn) {
|
||||||
var me = this;
|
var me = this;
|
||||||
var item = frappe.model.get_doc(cdt, cdn);
|
var item = frappe.get_doc(cdt, cdn);
|
||||||
if(item.item_code || item.barcode || item.serial_no) {
|
if(item.item_code || item.barcode || item.serial_no) {
|
||||||
if(!this.validate_company_and_party()) {
|
if(!this.validate_company_and_party()) {
|
||||||
cur_frm.fields_dict[me.frm.cscript.fname].grid.grid_rows[item.idx - 1].remove();
|
cur_frm.fields_dict[me.frm.cscript.fname].grid.grid_rows[item.idx - 1].remove();
|
||||||
@@ -156,7 +156,7 @@ erpnext.TransactionController = erpnext.stock.StockController.extend({
|
|||||||
|
|
||||||
serial_no: function(doc, cdt, cdn) {
|
serial_no: function(doc, cdt, cdn) {
|
||||||
var me = this;
|
var me = this;
|
||||||
var item = frappe.model.get_doc(cdt, cdn);
|
var item = frappe.get_doc(cdt, cdn);
|
||||||
|
|
||||||
if (item.serial_no) {
|
if (item.serial_no) {
|
||||||
if (!item.item_code) {
|
if (!item.item_code) {
|
||||||
@@ -262,7 +262,7 @@ erpnext.TransactionController = erpnext.stock.StockController.extend({
|
|||||||
get_exchange_rate: function(from_currency, to_currency, callback) {
|
get_exchange_rate: function(from_currency, to_currency, callback) {
|
||||||
var exchange_name = from_currency + "-" + to_currency;
|
var exchange_name = from_currency + "-" + to_currency;
|
||||||
frappe.model.with_doc("Currency Exchange", exchange_name, function(name) {
|
frappe.model.with_doc("Currency Exchange", exchange_name, function(name) {
|
||||||
var exchange_doc = frappe.model.get_doc("Currency Exchange", exchange_name);
|
var exchange_doc = frappe.get_doc("Currency Exchange", exchange_name);
|
||||||
callback(exchange_doc ? flt(exchange_doc.exchange_rate) : 0);
|
callback(exchange_doc ? flt(exchange_doc.exchange_rate) : 0);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@@ -304,7 +304,7 @@ erpnext.TransactionController = erpnext.stock.StockController.extend({
|
|||||||
},
|
},
|
||||||
|
|
||||||
row_id: function(doc, cdt, cdn) {
|
row_id: function(doc, cdt, cdn) {
|
||||||
var tax = frappe.model.get_doc(cdt, cdn);
|
var tax = frappe.get_doc(cdt, cdn);
|
||||||
try {
|
try {
|
||||||
this.validate_on_previous_row(tax);
|
this.validate_on_previous_row(tax);
|
||||||
this.calculate_taxes_and_totals();
|
this.calculate_taxes_and_totals();
|
||||||
@@ -339,7 +339,7 @@ erpnext.TransactionController = erpnext.stock.StockController.extend({
|
|||||||
},
|
},
|
||||||
|
|
||||||
included_in_print_rate: function(doc, cdt, cdn) {
|
included_in_print_rate: function(doc, cdt, cdn) {
|
||||||
var tax = frappe.model.get_doc(cdt, cdn);
|
var tax = frappe.get_doc(cdt, cdn);
|
||||||
try {
|
try {
|
||||||
this.validate_on_previous_row(tax);
|
this.validate_on_previous_row(tax);
|
||||||
this.validate_inclusive_tax(tax);
|
this.validate_inclusive_tax(tax);
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ $.extend(erpnext, {
|
|||||||
if(!company && cur_frm)
|
if(!company && cur_frm)
|
||||||
company = cur_frm.doc.company;
|
company = cur_frm.doc.company;
|
||||||
if(company)
|
if(company)
|
||||||
return frappe.model.get_doc(":Company", company).default_currency || frappe.boot.sysdefaults.currency;
|
return frappe.get_doc(":Company", company).default_currency || frappe.boot.sysdefaults.currency;
|
||||||
else
|
else
|
||||||
return frappe.boot.sysdefaults.currency;
|
return frappe.boot.sysdefaults.currency;
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ erpnext.LeadController = frappe.ui.form.Controller.extend({
|
|||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.communication_view = new frappe.views.CommunicationList({
|
cur_frm.communication_view = new frappe.views.CommunicationList({
|
||||||
list: frappe.model.get("Communication", {"parenttype": "Lead", "parent":this.frm.doc.name}),
|
list: frappe.get_list("Communication", {"parenttype": "Lead", "parent":this.frm.doc.name}),
|
||||||
parent: this.frm.fields_dict.communication_html.wrapper,
|
parent: this.frm.fields_dict.communication_html.wrapper,
|
||||||
doc: this.frm.doc,
|
doc: this.frm.doc,
|
||||||
recipients: this.frm.doc.email_id
|
recipients: this.frm.doc.email_id
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ erpnext.selling.Opportunity = frappe.ui.form.Controller.extend({
|
|||||||
|
|
||||||
if(!this.frm.doc.__islocal) {
|
if(!this.frm.doc.__islocal) {
|
||||||
cur_frm.communication_view = new frappe.views.CommunicationList({
|
cur_frm.communication_view = new frappe.views.CommunicationList({
|
||||||
list: frappe.model.get("Communication", {"opportunity": this.frm.doc.name}),
|
list: frappe.get_list("Communication", {"opportunity": this.frm.doc.name}),
|
||||||
parent: cur_frm.fields_dict.communication_html.wrapper,
|
parent: cur_frm.fields_dict.communication_html.wrapper,
|
||||||
doc: this.frm.doc,
|
doc: this.frm.doc,
|
||||||
recipients: this.frm.doc.contact_email
|
recipients: this.frm.doc.contact_email
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ erpnext.selling.QuotationController = erpnext.selling.SellingController.extend({
|
|||||||
|
|
||||||
if (!doc.__islocal) {
|
if (!doc.__islocal) {
|
||||||
cur_frm.communication_view = new frappe.views.CommunicationList({
|
cur_frm.communication_view = new frappe.views.CommunicationList({
|
||||||
list: frappe.model.get("Communication", {"parent": doc.name, "parenttype": "Quotation"}),
|
list: frappe.get_list("Communication", {"parent": doc.name, "parenttype": "Quotation"}),
|
||||||
parent: cur_frm.fields_dict.communication_html.wrapper,
|
parent: cur_frm.fields_dict.communication_html.wrapper,
|
||||||
doc: doc,
|
doc: doc,
|
||||||
recipients: doc.contact_email
|
recipients: doc.contact_email
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ erpnext.selling.SalesOrderController = erpnext.selling.SellingController.extend(
|
|||||||
},
|
},
|
||||||
|
|
||||||
warehouse: function(doc, cdt, cdn) {
|
warehouse: function(doc, cdt, cdn) {
|
||||||
var item = frappe.model.get_doc(cdt, cdn);
|
var item = frappe.get_doc(cdt, cdn);
|
||||||
if(item.item_code && item.warehouse) {
|
if(item.item_code && item.warehouse) {
|
||||||
return this.frm.call({
|
return this.frm.call({
|
||||||
method: "erpnext.selling.utils.get_available_qty",
|
method: "erpnext.selling.utils.get_available_qty",
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
|
|||||||
|
|
||||||
if(this.frm.fields_dict[this.fname].grid.get_field('batch_no')) {
|
if(this.frm.fields_dict[this.fname].grid.get_field('batch_no')) {
|
||||||
this.frm.set_query("batch_no", this.fname, function(doc, cdt, cdn) {
|
this.frm.set_query("batch_no", this.fname, function(doc, cdt, cdn) {
|
||||||
var item = frappe.model.get_doc(cdt, cdn);
|
var item = frappe.get_doc(cdt, cdn);
|
||||||
if(!item.item_code) {
|
if(!item.item_code) {
|
||||||
frappe.throw(frappe._("Please enter Item Code to get batch no"));
|
frappe.throw(frappe._("Please enter Item Code to get batch no"));
|
||||||
} else {
|
} else {
|
||||||
@@ -128,7 +128,7 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
|
|||||||
},
|
},
|
||||||
|
|
||||||
price_list_rate: function(doc, cdt, cdn) {
|
price_list_rate: function(doc, cdt, cdn) {
|
||||||
var item = frappe.model.get_doc(cdt, cdn);
|
var item = frappe.get_doc(cdt, cdn);
|
||||||
frappe.model.round_floats_in(item, ["price_list_rate", "discount_percentage"]);
|
frappe.model.round_floats_in(item, ["price_list_rate", "discount_percentage"]);
|
||||||
|
|
||||||
item.rate = flt(item.price_list_rate * (1 - item.discount_percentage / 100.0),
|
item.rate = flt(item.price_list_rate * (1 - item.discount_percentage / 100.0),
|
||||||
@@ -138,7 +138,7 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
|
|||||||
},
|
},
|
||||||
|
|
||||||
discount_percentage: function(doc, cdt, cdn) {
|
discount_percentage: function(doc, cdt, cdn) {
|
||||||
var item = frappe.model.get_doc(cdt, cdn);
|
var item = frappe.get_doc(cdt, cdn);
|
||||||
if(!item.price_list_rate) {
|
if(!item.price_list_rate) {
|
||||||
item.discount_percentage = 0.0;
|
item.discount_percentage = 0.0;
|
||||||
} else {
|
} else {
|
||||||
@@ -147,7 +147,7 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
|
|||||||
},
|
},
|
||||||
|
|
||||||
rate: function(doc, cdt, cdn) {
|
rate: function(doc, cdt, cdn) {
|
||||||
var item = frappe.model.get_doc(cdt, cdn);
|
var item = frappe.get_doc(cdt, cdn);
|
||||||
frappe.model.round_floats_in(item, ["rate", "price_list_rate"]);
|
frappe.model.round_floats_in(item, ["rate", "price_list_rate"]);
|
||||||
|
|
||||||
if(item.price_list_rate) {
|
if(item.price_list_rate) {
|
||||||
@@ -188,7 +188,7 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
|
|||||||
},
|
},
|
||||||
|
|
||||||
allocated_percentage: function(doc, cdt, cdn) {
|
allocated_percentage: function(doc, cdt, cdn) {
|
||||||
var sales_person = frappe.model.get_doc(cdt, cdn);
|
var sales_person = frappe.get_doc(cdt, cdn);
|
||||||
|
|
||||||
if(sales_person.allocated_percentage) {
|
if(sales_person.allocated_percentage) {
|
||||||
sales_person.allocated_percentage = flt(sales_person.allocated_percentage,
|
sales_person.allocated_percentage = flt(sales_person.allocated_percentage,
|
||||||
@@ -203,7 +203,7 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
|
|||||||
},
|
},
|
||||||
|
|
||||||
warehouse: function(doc, cdt, cdn) {
|
warehouse: function(doc, cdt, cdn) {
|
||||||
var item = frappe.model.get_doc(cdt, cdn);
|
var item = frappe.get_doc(cdt, cdn);
|
||||||
if(item.item_code && item.warehouse) {
|
if(item.item_code && item.warehouse) {
|
||||||
return this.frm.call({
|
return this.frm.call({
|
||||||
method: "erpnext.selling.utils.get_available_qty",
|
method: "erpnext.selling.utils.get_available_qty",
|
||||||
@@ -565,7 +565,7 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
|
|||||||
// Help for Sales BOM items
|
// Help for Sales BOM items
|
||||||
var set_sales_bom_help = function(doc) {
|
var set_sales_bom_help = function(doc) {
|
||||||
if(!cur_frm.fields_dict.packing_list) return;
|
if(!cur_frm.fields_dict.packing_list) return;
|
||||||
if (getchildren('Packed Item', doc.name, 'packing_details').length) {
|
if ((doc.packing_details || []).length) {
|
||||||
$(cur_frm.fields_dict.packing_list.row.wrapper).toggle(true);
|
$(cur_frm.fields_dict.packing_list.row.wrapper).toggle(true);
|
||||||
|
|
||||||
if (inList(['Delivery Note', 'Sales Invoice'], doc.doctype)) {
|
if (inList(['Delivery Note', 'Sales Invoice'], doc.doctype)) {
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ cur_frm.pformat.sales_order_no= function(doc, cdt, cdn){
|
|||||||
|
|
||||||
out ='';
|
out ='';
|
||||||
|
|
||||||
var cl = getchildren('Delivery Note Item',doc.name,'delivery_note_details');
|
var cl = doc.delivery_note_details || [];
|
||||||
|
|
||||||
// outer table
|
// outer table
|
||||||
var out='<div><table class="noborder" style="width:100%"><tr><td style="width: 50%"></td><td>';
|
var out='<div><table class="noborder" style="width:100%"><tr><td style="width: 50%"></td><td>';
|
||||||
@@ -204,7 +204,7 @@ if (sys_defaults.auto_accounting_for_stock) {
|
|||||||
cur_frm.cscript.expense_account = function(doc, cdt, cdn){
|
cur_frm.cscript.expense_account = function(doc, cdt, cdn){
|
||||||
var d = locals[cdt][cdn];
|
var d = locals[cdt][cdn];
|
||||||
if(d.expense_account) {
|
if(d.expense_account) {
|
||||||
var cl = getchildren('Delivery Note Item', doc.name, cur_frm.cscript.fname, doc.doctype);
|
var cl = doc[cur_frm.cscript.fname] || [];
|
||||||
for(var i = 0; i < cl.length; i++){
|
for(var i = 0; i < cl.length; i++){
|
||||||
if(!cl[i].expense_account) cl[i].expense_account = d.expense_account;
|
if(!cl[i].expense_account) cl[i].expense_account = d.expense_account;
|
||||||
}
|
}
|
||||||
@@ -227,7 +227,7 @@ if (sys_defaults.auto_accounting_for_stock) {
|
|||||||
cur_frm.cscript.cost_center = function(doc, cdt, cdn){
|
cur_frm.cscript.cost_center = function(doc, cdt, cdn){
|
||||||
var d = locals[cdt][cdn];
|
var d = locals[cdt][cdn];
|
||||||
if(d.cost_center) {
|
if(d.cost_center) {
|
||||||
var cl = getchildren('Delivery Note Item', doc.name, cur_frm.cscript.fname, doc.doctype);
|
var cl = doc[cur_frm.cscript.fname] || [];
|
||||||
for(var i = 0; i < cl.length; i++){
|
for(var i = 0; i < cl.length; i++){
|
||||||
if(!cl[i].cost_center) cl[i].cost_center = d.cost_center;
|
if(!cl[i].cost_center) cl[i].cost_center = d.cost_center;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ cur_frm.cscript.validate_case_nos = function(doc) {
|
|||||||
|
|
||||||
cur_frm.cscript.validate_calculate_item_details = function(doc) {
|
cur_frm.cscript.validate_calculate_item_details = function(doc) {
|
||||||
doc = locals[doc.doctype][doc.name];
|
doc = locals[doc.doctype][doc.name];
|
||||||
var ps_detail = getchildren('Packing Slip Item', doc.name, 'item_details');
|
var ps_detail = doc.item_details || [];
|
||||||
|
|
||||||
cur_frm.cscript.validate_duplicate_items(doc, ps_detail);
|
cur_frm.cscript.validate_duplicate_items(doc, ps_detail);
|
||||||
cur_frm.cscript.calc_net_total_pkg(doc, ps_detail);
|
cur_frm.cscript.calc_net_total_pkg(doc, ps_detail);
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ erpnext.stock.PurchaseReceiptController = erpnext.buying.BuyingController.extend
|
|||||||
},
|
},
|
||||||
|
|
||||||
received_qty: function(doc, cdt, cdn) {
|
received_qty: function(doc, cdt, cdn) {
|
||||||
var item = frappe.model.get_doc(cdt, cdn);
|
var item = frappe.get_doc(cdt, cdn);
|
||||||
frappe.model.round_floats_in(item, ["qty", "received_qty"]);
|
frappe.model.round_floats_in(item, ["qty", "received_qty"]);
|
||||||
|
|
||||||
item.qty = (item.qty < item.received_qty) ? item.qty : item.received_qty;
|
item.qty = (item.qty < item.received_qty) ? item.qty : item.received_qty;
|
||||||
@@ -55,7 +55,7 @@ erpnext.stock.PurchaseReceiptController = erpnext.buying.BuyingController.extend
|
|||||||
},
|
},
|
||||||
|
|
||||||
qty: function(doc, cdt, cdn) {
|
qty: function(doc, cdt, cdn) {
|
||||||
var item = frappe.model.get_doc(cdt, cdn);
|
var item = frappe.get_doc(cdt, cdn);
|
||||||
frappe.model.round_floats_in(item, ["qty", "received_qty"]);
|
frappe.model.round_floats_in(item, ["qty", "received_qty"]);
|
||||||
|
|
||||||
if(!(item.received_qty || item.rejected_qty) && item.qty) {
|
if(!(item.received_qty || item.rejected_qty) && item.qty) {
|
||||||
@@ -74,7 +74,7 @@ erpnext.stock.PurchaseReceiptController = erpnext.buying.BuyingController.extend
|
|||||||
},
|
},
|
||||||
|
|
||||||
rejected_qty: function(doc, cdt, cdn) {
|
rejected_qty: function(doc, cdt, cdn) {
|
||||||
var item = frappe.model.get_doc(cdt, cdn);
|
var item = frappe.get_doc(cdt, cdn);
|
||||||
frappe.model.round_floats_in(item, ["received_qty", "rejected_qty"]);
|
frappe.model.round_floats_in(item, ["received_qty", "rejected_qty"]);
|
||||||
|
|
||||||
if(item.rejected_qty > item.received_qty) {
|
if(item.rejected_qty > item.received_qty) {
|
||||||
|
|||||||
@@ -105,9 +105,9 @@ erpnext.stock.StockEntry = erpnext.stock.StockController.extend({
|
|||||||
},
|
},
|
||||||
callback: function(r) {
|
callback: function(r) {
|
||||||
if (!r.exc) {
|
if (!r.exc) {
|
||||||
for(d in getchildren('Stock Entry Detail', me.frm.doc.name, 'mtn_details')) {
|
$.each(doc.mtn_details || [], function(i, d) {
|
||||||
if(!d.expense_account) d.expense_account = r.message;
|
if(!d.expense_account) d.expense_account = r.message;
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -225,7 +225,7 @@ erpnext.stock.StockEntry = erpnext.stock.StockController.extend({
|
|||||||
},
|
},
|
||||||
|
|
||||||
mtn_details_add: function(doc, cdt, cdn) {
|
mtn_details_add: function(doc, cdt, cdn) {
|
||||||
var row = frappe.model.get_doc(cdt, cdn);
|
var row = frappe.get_doc(cdt, cdn);
|
||||||
this.frm.script_manager.copy_from_first_row("mtn_details", row,
|
this.frm.script_manager.copy_from_first_row("mtn_details", row,
|
||||||
["expense_account", "cost_center"]);
|
["expense_account", "cost_center"]);
|
||||||
|
|
||||||
@@ -388,7 +388,7 @@ cur_frm.cscript.validate = function(doc, cdt, cdn) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.validate_items = function(doc) {
|
cur_frm.cscript.validate_items = function(doc) {
|
||||||
cl = getchildren('Stock Entry Detail', doc.name, 'mtn_details');
|
cl = doc.mtn_details || [];
|
||||||
if (!cl.length) {
|
if (!cl.length) {
|
||||||
msgprint(frappe._("Item table can not be blank"));
|
msgprint(frappe._("Item table can not be blank"));
|
||||||
validated = false;
|
validated = false;
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ $.extend(cur_frm.cscript, {
|
|||||||
make_listing: function(doc) {
|
make_listing: function(doc) {
|
||||||
var wrapper = cur_frm.fields_dict['thread_html'].wrapper;
|
var wrapper = cur_frm.fields_dict['thread_html'].wrapper;
|
||||||
|
|
||||||
var comm_list = frappe.model.get("Communication", {"parent": doc.name, "parenttype":"Support Ticket"})
|
var comm_list = frappe.get_list("Communication", {"parent": doc.name, "parenttype":"Support Ticket"})
|
||||||
|
|
||||||
if(!comm_list.length) {
|
if(!comm_list.length) {
|
||||||
comm_list.push({
|
comm_list.push({
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
cur_frm.cscript.refresh = function(doc) {
|
cur_frm.cscript.refresh = function(doc) {
|
||||||
cur_frm.communication_view = new frappe.views.CommunicationList({
|
cur_frm.communication_view = new frappe.views.CommunicationList({
|
||||||
list: frappe.model.get("Communication", {"parent": doc.name, "parenttype": "Contact"}),
|
list: frappe.get_list("Communication", {"parent": doc.name, "parenttype": "Contact"}),
|
||||||
parent: cur_frm.fields_dict.communication_html.wrapper,
|
parent: cur_frm.fields_dict.communication_html.wrapper,
|
||||||
doc: doc,
|
doc: doc,
|
||||||
recipients: doc.email_id
|
recipients: doc.email_id
|
||||||
|
|||||||
Reference in New Issue
Block a user