mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-08 15:42:52 +00:00
form cleanup: fixed callback issues
This commit is contained in:
@@ -1043,7 +1043,7 @@ div.dialog_head {
|
|||||||
}
|
}
|
||||||
|
|
||||||
div.dialog_body {
|
div.dialog_body {
|
||||||
padding: 8px 8px 16px;
|
padding: 8px 4px 16px 4px;
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
-moz-border-radius: 5px;
|
-moz-border-radius: 5px;
|
||||||
-webkit-border-radius: 5px;
|
-webkit-border-radius: 5px;
|
||||||
|
|||||||
@@ -362,7 +362,7 @@ div.dialog_head {
|
|||||||
}
|
}
|
||||||
|
|
||||||
div.dialog_body {
|
div.dialog_body {
|
||||||
padding: 8px 8px 16px;
|
padding: 8px 4px 16px 4px;
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
-moz-border-radius: 5px;
|
-moz-border-radius: 5px;
|
||||||
-webkit-border-radius: 5px;
|
-webkit-border-radius: 5px;
|
||||||
|
|||||||
@@ -42,10 +42,10 @@ cur_frm.cscript.onload = function(doc,dt,dn) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.onload_post_render = function(doc, dt, dn) {
|
cur_frm.cscript.onload_post_render = function(doc, dt, dn) {
|
||||||
var callback2 = null;
|
var callback = function(doc, dt, dn) {
|
||||||
if(doc.customer && doc.__islocal) {
|
|
||||||
// called from mapper, update the account names for items and customer
|
// called from mapper, update the account names for items and customer
|
||||||
callback2 = function(doc, dt, dn) {
|
var callback2 = function(doc, dt, dn) {
|
||||||
|
if(doc.customer && doc.__islocal) {
|
||||||
$c_obj(make_doclist(doc.doctype,doc.name),
|
$c_obj(make_doclist(doc.doctype,doc.name),
|
||||||
'load_default_accounts','',
|
'load_default_accounts','',
|
||||||
function(r,rt) {
|
function(r,rt) {
|
||||||
@@ -65,6 +65,10 @@ cur_frm.cscript.onload_post_render = function(doc, dt, dn) {
|
|||||||
else cur_frm.cscript.update_item_details(doc, dt, dn, callback2);
|
else cur_frm.cscript.update_item_details(doc, dt, dn, callback2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cur_frm.cscript.hide_price_list_currency(doc, dt, dn, callback);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Hide Fields
|
// Hide Fields
|
||||||
// ------------
|
// ------------
|
||||||
@@ -97,16 +101,11 @@ cur_frm.cscript.hide_fields = function(doc, cdt, cdn) {
|
|||||||
cur_frm.cscript.refresh = function(doc, dt, dn) {
|
cur_frm.cscript.refresh = function(doc, dt, dn) {
|
||||||
cur_frm.cscript.is_opening(doc, dt, dn);
|
cur_frm.cscript.is_opening(doc, dt, dn);
|
||||||
cur_frm.cscript.hide_fields(doc, dt, dn);
|
cur_frm.cscript.hide_fields(doc, dt, dn);
|
||||||
|
|
||||||
var callback = function() {
|
|
||||||
cur_frm.cscript.dynamic_label(doc, dt, dn);
|
|
||||||
}
|
|
||||||
cur_frm.cscript.hide_price_list_currency(doc, dt, dn, callback);
|
|
||||||
|
|
||||||
|
|
||||||
// Show / Hide button
|
// Show / Hide button
|
||||||
cur_frm.clear_custom_buttons();
|
cur_frm.clear_custom_buttons();
|
||||||
|
|
||||||
|
if (!cur_frm.cscript.is_onload) cur_frm.cscript.hide_price_list_currency(doc, dt, dn);
|
||||||
|
|
||||||
if(doc.docstatus==1) {
|
if(doc.docstatus==1) {
|
||||||
cur_frm.add_custom_button('View Ledger', cur_frm.cscript['View Ledger Entry']);
|
cur_frm.add_custom_button('View Ledger', cur_frm.cscript['View Ledger Entry']);
|
||||||
cur_frm.add_custom_button('Send SMS', cur_frm.cscript['Send SMS']);
|
cur_frm.add_custom_button('Send SMS', cur_frm.cscript['Send SMS']);
|
||||||
|
|||||||
@@ -167,16 +167,19 @@ class DocType(TransactionBase):
|
|||||||
# Item Details
|
# Item Details
|
||||||
# -------------
|
# -------------
|
||||||
def get_item_details(self, args=None):
|
def get_item_details(self, args=None):
|
||||||
args = eval(args)
|
args = args and eval(args) or {}
|
||||||
if args['item_code']:
|
if args.get('item_code'):
|
||||||
ret = get_obj('Sales Common').get_item_details(args, self)
|
ret = get_obj('Sales Common').get_item_details(args, self)
|
||||||
return self.get_pos_details(args, ret)
|
return self.get_pos_details(args, ret)
|
||||||
else:
|
else:
|
||||||
obj = get_obj('Sales Common')
|
obj = get_obj('Sales Common')
|
||||||
for doc in self.doclist:
|
for doc in self.doclist:
|
||||||
if doc.fields.get('item_code'):
|
if doc.fields.get('item_code'):
|
||||||
ret = obj.get_item_details(doc.item_code, self)
|
arg = {'item_code':doc.fields.get('item_code'), 'income_account':doc.fields.get('income_account'),
|
||||||
ret = self.get_pos_details(doc.item_code, ret)
|
'cost_center': doc.fields.get('cost_center'), 'warehouse': doc.fields.get('warehouse')};
|
||||||
|
|
||||||
|
ret = obj.get_item_details(arg, self)
|
||||||
|
ret = self.get_pos_details(arg, ret)
|
||||||
for r in ret:
|
for r in ret:
|
||||||
if not doc.fields.get(r):
|
if not doc.fields.get(r):
|
||||||
doc.fields[r] = ret[r]
|
doc.fields[r] = ret[r]
|
||||||
@@ -205,14 +208,6 @@ class DocType(TransactionBase):
|
|||||||
get_obj('Sales Common').get_adj_percent(self)
|
get_obj('Sales Common').get_adj_percent(self)
|
||||||
|
|
||||||
|
|
||||||
def get_comp_base_currency(self):
|
|
||||||
return get_obj('Sales Common').get_comp_base_currency(self.doc.company)
|
|
||||||
|
|
||||||
def get_price_list_currency(self):
|
|
||||||
return get_obj('Sales Common').get_price_list_currency(self.doc.price_list_name, self.doc.company)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Get tax rate if account type is tax
|
# Get tax rate if account type is tax
|
||||||
# ------------------------------------
|
# ------------------------------------
|
||||||
def get_rate(self,arg):
|
def get_rate(self,arg):
|
||||||
|
|||||||
@@ -50,8 +50,11 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.onload_post_render = function(doc, dt, dn) {
|
cur_frm.cscript.onload_post_render = function(doc, dt, dn) {
|
||||||
|
var callback = function(doc, dt, dn) {
|
||||||
// defined in sales_common.js
|
// defined in sales_common.js
|
||||||
cur_frm.cscript.update_item_details(doc, cdt, cdn);
|
cur_frm.cscript.update_item_details(doc, dt, dn);
|
||||||
|
}
|
||||||
|
cur_frm.cscript.hide_price_list_currency(doc, dt, dn, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
// hide - unhide fields based on lead or customer..
|
// hide - unhide fields based on lead or customer..
|
||||||
@@ -83,10 +86,7 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
|||||||
|
|
||||||
cur_frm.clear_custom_buttons();
|
cur_frm.clear_custom_buttons();
|
||||||
|
|
||||||
var callback = function() {
|
if (!cur_frm.cscript.is_onload) cur_frm.cscript.hide_price_list_currency(doc, cdt, cdn);
|
||||||
cur_frm.cscript.dynamic_label(doc, cdt, cdn);
|
|
||||||
}
|
|
||||||
cur_frm.cscript.hide_price_list_currency(doc, cdt, cdn, callback);
|
|
||||||
|
|
||||||
|
|
||||||
if(doc.docstatus == 1 && doc.status!='Order Lost') {
|
if(doc.docstatus == 1 && doc.status!='Order Lost') {
|
||||||
|
|||||||
@@ -77,14 +77,16 @@ class DocType(TransactionBase):
|
|||||||
# Get Item Details
|
# Get Item Details
|
||||||
# -----------------
|
# -----------------
|
||||||
def get_item_details(self, args=None):
|
def get_item_details(self, args=None):
|
||||||
args = eval(args)
|
args = args and eval(args) or {}
|
||||||
if args['item_code']:
|
if args.get('item_code'):
|
||||||
return get_obj('Sales Common').get_item_details(args, self)
|
return get_obj('Sales Common').get_item_details(args, self)
|
||||||
else:
|
else:
|
||||||
obj = get_obj('Sales Common')
|
obj = get_obj('Sales Common')
|
||||||
for doc in self.doclist:
|
for doc in self.doclist:
|
||||||
if doc.fields.get('item_code'):
|
if doc.fields.get('item_code'):
|
||||||
ret = obj.get_item_details(doc.item_code, self)
|
arg = {'item_code':doc.fields.get('item_code'), 'income_account':doc.fields.get('income_account'),
|
||||||
|
'cost_center': doc.fields.get('cost_center'), 'warehouse': doc.fields.get('warehouse')};
|
||||||
|
ret = obj.get_item_details(arg, self)
|
||||||
for r in ret:
|
for r in ret:
|
||||||
if not doc.fields.get(r):
|
if not doc.fields.get(r):
|
||||||
doc.fields[r] = ret[r]
|
doc.fields[r] = ret[r]
|
||||||
@@ -96,11 +98,6 @@ class DocType(TransactionBase):
|
|||||||
get_obj('Sales Common').get_adj_percent(self)
|
get_obj('Sales Common').get_adj_percent(self)
|
||||||
|
|
||||||
|
|
||||||
def get_comp_base_currency(self):
|
|
||||||
return get_obj('Sales Common').get_comp_base_currency(self.doc.company)
|
|
||||||
|
|
||||||
def get_price_list_currency(self):
|
|
||||||
return get_obj('Sales Common').get_price_list_currency(self.doc.price_list_name, self.doc.company)
|
|
||||||
|
|
||||||
|
|
||||||
# OTHER CHARGES TRIGGER FUNCTIONS
|
# OTHER CHARGES TRIGGER FUNCTIONS
|
||||||
|
|||||||
@@ -75,7 +75,6 @@ cur_frm.cscript.update_item_details = function(doc, dt, dn, callback) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// ============== Customer and its primary contact Details ============================
|
// ============== Customer and its primary contact Details ============================
|
||||||
cur_frm.cscript.customer = function(doc, cdt, cdn) {
|
cur_frm.cscript.customer = function(doc, cdt, cdn) {
|
||||||
if(doc.customer){
|
if(doc.customer){
|
||||||
@@ -136,17 +135,11 @@ var set_dynamic_label_child = function(doc, cdt, cdn, base_curr) {
|
|||||||
// Change label dynamically based on currency
|
// Change label dynamically based on currency
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
|
|
||||||
cur_frm.cscript.dynamic_label = function(doc, cdt, cdn) {
|
cur_frm.cscript.dynamic_label = function(doc, cdt, cdn, base_curr, callback) {
|
||||||
var callback = function(r, rt) {
|
|
||||||
if (r.message) base_curr = r.message;
|
|
||||||
else base_curr = sys_defaults['currency'];
|
|
||||||
|
|
||||||
set_dynamic_label_par(doc, cdt, cdn, base_curr);
|
set_dynamic_label_par(doc, cdt, cdn, base_curr);
|
||||||
set_dynamic_label_child(doc, cdt, cdn, base_curr);
|
set_dynamic_label_child(doc, cdt, cdn, base_curr);
|
||||||
}
|
|
||||||
|
|
||||||
if (doc.company == sys_defaults['company']) callback('', '');
|
if (callback) callback(doc, cdt, cdn);
|
||||||
else $c_obj(make_doclist(doc.doctype, doc.name), 'get_comp_base_currency', '', callback);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -155,7 +148,10 @@ cur_frm.cscript.dynamic_label = function(doc, cdt, cdn) {
|
|||||||
|
|
||||||
cur_frm.cscript.hide_price_list_currency = function(doc, cdt, cdn, callback1) {
|
cur_frm.cscript.hide_price_list_currency = function(doc, cdt, cdn, callback1) {
|
||||||
if (doc.price_list_name && doc.currency) {
|
if (doc.price_list_name && doc.currency) {
|
||||||
var callback = function(r, rt) {
|
wn.call({
|
||||||
|
method: 'selling.doctype.sales_common.sales_common.get_price_list_currency',
|
||||||
|
args: {'price_list':doc.price_list_name, 'company': doc.company},
|
||||||
|
callback: function(r, rt) {
|
||||||
pl_currency = r.message[0]?r.message[0]:[];
|
pl_currency = r.message[0]?r.message[0]:[];
|
||||||
if (pl_currency.length==1) {
|
if (pl_currency.length==1) {
|
||||||
if (pl_currency[0] == doc.currency) set_multiple(cdt, cdn, {price_list_currency:doc.currency, plc_conversion_rate:doc.conversion_rate});
|
if (pl_currency[0] == doc.currency) set_multiple(cdt, cdn, {price_list_currency:doc.currency, plc_conversion_rate:doc.conversion_rate});
|
||||||
@@ -173,9 +169,9 @@ cur_frm.cscript.hide_price_list_currency = function(doc, cdt, cdn, callback1) {
|
|||||||
hide_field('plc_conversion_rate');
|
hide_field('plc_conversion_rate');
|
||||||
} else unhide_field('plc_conversion_rate');
|
} else unhide_field('plc_conversion_rate');
|
||||||
|
|
||||||
callback1()
|
cur_frm.cscript.dynamic_label(doc, cdt, cdn, r.message[1], callback1);
|
||||||
}
|
}
|
||||||
$c_obj(make_doclist(doc.doctype, doc.name), 'get_price_list_currency', '', callback);
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -213,12 +209,15 @@ cur_frm.cscript.conversion_rate = cur_frm.cscript.currency;
|
|||||||
cur_frm.cscript.plc_conversion_rate = cur_frm.cscript.currency;
|
cur_frm.cscript.plc_conversion_rate = cur_frm.cscript.currency;
|
||||||
|
|
||||||
cur_frm.cscript.company = function(doc, dt, dn) {
|
cur_frm.cscript.company = function(doc, dt, dn) {
|
||||||
var callback = function(r, rt) {
|
wn.call({
|
||||||
|
method: 'selling.doctype.sales_common.sales_common.get_comp_base_currency',
|
||||||
|
args: {company:doc.company},
|
||||||
|
callback: function(r, rt) {
|
||||||
var doc = locals[dt][dn];
|
var doc = locals[dt][dn];
|
||||||
set_multiple(doc.doctype, doc.name, {currency:r.message, price_list_currency:r.message});
|
set_multiple(doc.doctype, doc.name, {currency:r.message, price_list_currency:r.message});
|
||||||
cur_frm.cscript.currency(doc, cdt, cdn);
|
cur_frm.cscript.currency(doc, cdt, cdn);
|
||||||
}
|
}
|
||||||
$c_obj(make_doclist(doc.doctype, doc.name), 'get_comp_base_currency', '', callback);
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -234,7 +233,6 @@ cur_frm.cscript.price_list_name = function(doc, cdt, cdn) {
|
|||||||
refresh_field(fname);
|
refresh_field(fname);
|
||||||
var doc = locals[cdt][cdn];
|
var doc = locals[cdt][cdn];
|
||||||
cur_frm.cscript.recalc(doc,3); //this is to re-calculate BASIC RATE and AMOUNT on basis of changed REF RATE
|
cur_frm.cscript.recalc(doc,3); //this is to re-calculate BASIC RATE and AMOUNT on basis of changed REF RATE
|
||||||
cur_frm.cscript.dynamic_label(doc, cdt, cdn);
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -178,18 +178,6 @@ class DocType(TransactionBase):
|
|||||||
d.export_amount = flt(d.qty)*flt(base_ref_rate)/flt(obj.doc.conversion_rate)
|
d.export_amount = flt(d.qty)*flt(base_ref_rate)/flt(obj.doc.conversion_rate)
|
||||||
|
|
||||||
|
|
||||||
def get_comp_base_currency(self, comp):
|
|
||||||
""" get default currency of company"""
|
|
||||||
return webnotes.conn.sql("select default_currency from `tabCompany` where name = %s", comp)[0][0]
|
|
||||||
|
|
||||||
def get_price_list_currency(self, price_list, comp):
|
|
||||||
""" Get all currency in which price list is maintained"""
|
|
||||||
plc = webnotes.conn.sql("select distinct ref_currency from `tabRef Rate Detail` where price_list_name = %s", price_list)
|
|
||||||
plc = [d[0] for d in plc]
|
|
||||||
base_currency = self.get_comp_base_currency(comp)
|
|
||||||
return plc, base_currency
|
|
||||||
|
|
||||||
|
|
||||||
# Load Default Taxes
|
# Load Default Taxes
|
||||||
# ====================
|
# ====================
|
||||||
def load_default_taxes(self, obj):
|
def load_default_taxes(self, obj):
|
||||||
@@ -781,3 +769,17 @@ class StatusUpdater:
|
|||||||
where
|
where
|
||||||
name="%(name)s"
|
name="%(name)s"
|
||||||
""" % args)
|
""" % args)
|
||||||
|
|
||||||
|
|
||||||
|
@webnotes.whitelist()
|
||||||
|
def get_comp_base_currency(arg=None):
|
||||||
|
""" get default currency of company"""
|
||||||
|
return webnotes.conn.sql("select default_currency from `tabCompany` where name = %s", webnotes.form_dict['company'])[0][0]
|
||||||
|
|
||||||
|
@webnotes.whitelist()
|
||||||
|
def get_price_list_currency(arg=None):
|
||||||
|
""" Get all currency in which price list is maintained"""
|
||||||
|
plc = webnotes.conn.sql("select distinct ref_currency from `tabRef Rate Detail` where price_list_name = %s", webnotes.form_dict['price_list'])
|
||||||
|
plc = [d[0] for d in plc]
|
||||||
|
base_currency = get_comp_base_currency(webnotes.form_dict['company'])
|
||||||
|
return plc, base_currency
|
||||||
|
|||||||
@@ -41,21 +41,24 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.onload_post_render = function(doc, cdt, cdn) {
|
cur_frm.cscript.onload_post_render = function(doc, cdt, cdn) {
|
||||||
|
var callback = function(doc, cdt, cdn) {
|
||||||
if(doc.__islocal) {
|
if(doc.__islocal) {
|
||||||
// defined in sales_common.js
|
// defined in sales_common.js
|
||||||
cur_frm.cscript.update_item_details(doc, cdt, cdn);
|
cur_frm.cscript.update_item_details(doc, cdt, cdn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cur_frm.cscript.hide_price_list_currency(doc, cdt, cdn, callback);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Refresh
|
// Refresh
|
||||||
//==================
|
//==================
|
||||||
cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
||||||
cur_frm.clear_custom_buttons();
|
cur_frm.clear_custom_buttons();
|
||||||
var callback = function() {
|
|
||||||
cur_frm.cscript.dynamic_label(doc, cdt, cdn);
|
if (!cur_frm.cscript.is_onload) cur_frm.cscript.hide_price_list_currency(doc, cdt, cdn);
|
||||||
}
|
|
||||||
cur_frm.cscript.hide_price_list_currency(doc, cdt, cdn, callback);
|
|
||||||
|
|
||||||
|
|
||||||
if(doc.docstatus==1) {
|
if(doc.docstatus==1) {
|
||||||
|
|||||||
@@ -102,14 +102,16 @@ class DocType(TransactionBase):
|
|||||||
# Get Item Details
|
# Get Item Details
|
||||||
# ----------------
|
# ----------------
|
||||||
def get_item_details(self, args=None):
|
def get_item_details(self, args=None):
|
||||||
args = eval(args)
|
args = args and eval(args) or {}
|
||||||
if args['item_code']:
|
if args.get('item_code'):
|
||||||
return get_obj('Sales Common').get_item_details(args, self)
|
return get_obj('Sales Common').get_item_details(args, self)
|
||||||
else:
|
else:
|
||||||
obj = get_obj('Sales Common')
|
obj = get_obj('Sales Common')
|
||||||
for doc in self.doclist:
|
for doc in self.doclist:
|
||||||
if doc.fields.get('item_code'):
|
if doc.fields.get('item_code'):
|
||||||
ret = obj.get_item_details(doc.item_code, self)
|
arg = {'item_code':doc.fields.get('item_code'), 'income_account':doc.fields.get('income_account'),
|
||||||
|
'cost_center': doc.fields.get('cost_center'), 'warehouse': doc.fields.get('warehouse')};
|
||||||
|
ret = obj.get_item_details(arg, self)
|
||||||
for r in ret:
|
for r in ret:
|
||||||
if not doc.fields.get(r):
|
if not doc.fields.get(r):
|
||||||
doc.fields[r] = ret[r]
|
doc.fields[r] = ret[r]
|
||||||
@@ -120,13 +122,6 @@ class DocType(TransactionBase):
|
|||||||
def get_adj_percent(self, arg=''):
|
def get_adj_percent(self, arg=''):
|
||||||
get_obj('Sales Common').get_adj_percent(self)
|
get_obj('Sales Common').get_adj_percent(self)
|
||||||
|
|
||||||
def get_comp_base_currency(self):
|
|
||||||
return get_obj('Sales Common').get_comp_base_currency(self.doc.company)
|
|
||||||
|
|
||||||
def get_price_list_currency(self):
|
|
||||||
return get_obj('Sales Common').get_price_list_currency(self.doc.price_list_name, self.doc.company)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Get projected qty of item based on warehouse selected
|
# Get projected qty of item based on warehouse selected
|
||||||
|
|||||||
@@ -43,17 +43,19 @@ cur_frm.cscript.onload = function(doc, dt, dn) {
|
|||||||
|
|
||||||
cur_frm.cscript.onload_post_render = function(doc, dt, dn) {
|
cur_frm.cscript.onload_post_render = function(doc, dt, dn) {
|
||||||
// defined in sales_common.js
|
// defined in sales_common.js
|
||||||
|
var callback = function(doc, dt, dn) {
|
||||||
if(doc.__islocal) cur_frm.cscript.update_item_details(doc, dt, dn);
|
if(doc.__islocal) cur_frm.cscript.update_item_details(doc, dt, dn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cur_frm.cscript.hide_price_list_currency(doc, dt, dn, callback);
|
||||||
|
}
|
||||||
|
|
||||||
// REFRESH
|
// REFRESH
|
||||||
// ================================================================================================
|
// ================================================================================================
|
||||||
cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
||||||
cur_frm.clear_custom_buttons();
|
cur_frm.clear_custom_buttons();
|
||||||
var callback = function() {
|
|
||||||
cur_frm.cscript.dynamic_label(doc, cdt, cdn);
|
if (!cur_frm.cscript.is_onload) cur_frm.cscript.hide_price_list_currency(doc, cdt, cdn);
|
||||||
}
|
|
||||||
cur_frm.cscript.hide_price_list_currency(doc, cdt, cdn, callback);
|
|
||||||
|
|
||||||
|
|
||||||
if(doc.per_billed < 100 && doc.docstatus==1) cur_frm.add_custom_button('Make Invoice', cur_frm.cscript['Make Sales Invoice']);
|
if(doc.per_billed < 100 && doc.docstatus==1) cur_frm.add_custom_button('Make Invoice', cur_frm.cscript['Make Sales Invoice']);
|
||||||
|
|||||||
@@ -117,14 +117,16 @@ class DocType(TransactionBase):
|
|||||||
|
|
||||||
# ***************** Get Item Details ******************************
|
# ***************** Get Item Details ******************************
|
||||||
def get_item_details(self, args=None):
|
def get_item_details(self, args=None):
|
||||||
args = eval(args)
|
args = args and eval(args) or {}
|
||||||
if args['item_code']:
|
if args.get('item_code'):
|
||||||
return get_obj('Sales Common').get_item_details(args, self)
|
return get_obj('Sales Common').get_item_details(args, self)
|
||||||
else:
|
else:
|
||||||
obj = get_obj('Sales Common')
|
obj = get_obj('Sales Common')
|
||||||
for doc in self.doclist:
|
for doc in self.doclist:
|
||||||
if doc.fields.get('item_code'):
|
if doc.fields.get('item_code'):
|
||||||
ret = obj.get_item_details(doc.item_code, self)
|
arg = {'item_code':doc.fields.get('item_code'), 'income_account':doc.fields.get('income_account'),
|
||||||
|
'cost_center': doc.fields.get('cost_center'), 'warehouse': doc.fields.get('warehouse')};
|
||||||
|
ret = obj.get_item_details(arg, self)
|
||||||
for r in ret:
|
for r in ret:
|
||||||
if not doc.fields.get(r):
|
if not doc.fields.get(r):
|
||||||
doc.fields[r] = ret[r]
|
doc.fields[r] = ret[r]
|
||||||
@@ -135,13 +137,6 @@ class DocType(TransactionBase):
|
|||||||
get_obj('Sales Common').get_adj_percent(self)
|
get_obj('Sales Common').get_adj_percent(self)
|
||||||
|
|
||||||
|
|
||||||
def get_comp_base_currency(self):
|
|
||||||
return get_obj('Sales Common').get_comp_base_currency(self.doc.company)
|
|
||||||
|
|
||||||
def get_price_list_currency(self):
|
|
||||||
return get_obj('Sales Common').get_price_list_currency(self.doc.price_list_name, self.doc.company)
|
|
||||||
|
|
||||||
|
|
||||||
# ********** Get Actual Qty of item in warehouse selected *************
|
# ********** Get Actual Qty of item in warehouse selected *************
|
||||||
def get_actual_qty(self,args):
|
def get_actual_qty(self,args):
|
||||||
args = eval(args)
|
args = eval(args)
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
753
|
755
|
||||||
Reference in New Issue
Block a user