Merge branch 'latest' of github.com:webnotes/erpnext into latest
This commit is contained in:
commit
96765f170d
@ -61,12 +61,16 @@ cur_frm.cscript.supplier = function(doc,dt,dn) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var callback2 = function(r,rt){
|
var callback2 = function(r,rt){
|
||||||
var doc = locals[cur_frm.doctype][cur_frm.docname];
|
var doc = locals[cur_frm.doctype][cur_frm.docname];
|
||||||
var el = getchildren('PV Detail',doc.name,'entries');
|
var el = getchildren('PV Detail',doc.name,'entries');
|
||||||
for(var i in el){
|
for(var i in el){
|
||||||
if(el[i].item_code && (!el[i].expense_head || !el[i].cost_center)){
|
if(el[i].item_code && (!el[i].expense_head || !el[i].cost_center)){
|
||||||
args = "{'item_code':'" + el[i].item_code + "','expense_head':'" + el[i].expense_head + "','cost_center':'" + el[i].cost_center + "'}";
|
args = {
|
||||||
get_server_fields('get_default_values', args, 'entries', doc, el[i].doctype, el[i].name, 1);
|
item_code: el[i].item_code,
|
||||||
|
expense_head: el[i].expense_head,
|
||||||
|
cost_center: el[i].cost_center
|
||||||
|
};
|
||||||
|
get_server_fields('get_default_values', JSON.stringify(args), 'entries', doc, el[i].doctype, el[i].name, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cur_frm.cscript.calc_amount(doc, 1);
|
cur_frm.cscript.calc_amount(doc, 1);
|
||||||
|
@ -61,7 +61,8 @@ class DocType(TransactionBase):
|
|||||||
# Get Default Cost Center and Expense Head from Item Master
|
# Get Default Cost Center and Expense Head from Item Master
|
||||||
# ----------------------------------------------------------
|
# ----------------------------------------------------------
|
||||||
def get_default_values(self,args):
|
def get_default_values(self,args):
|
||||||
args = eval(args)
|
import json
|
||||||
|
args = json.loads(args)
|
||||||
ret = {}
|
ret = {}
|
||||||
if sql("select name from `tabItem` where name = '%s'" % args['item_code']):
|
if sql("select name from `tabItem` where name = '%s'" % args['item_code']):
|
||||||
if not args['expense_head'] or args['expense_head'] == 'undefined':
|
if not args['expense_head'] or args['expense_head'] == 'undefined':
|
||||||
@ -105,6 +106,7 @@ class DocType(TransactionBase):
|
|||||||
|
|
||||||
|
|
||||||
def get_pv_details(self, arg):
|
def get_pv_details(self, arg):
|
||||||
|
import json
|
||||||
item_det = sql("select item_name, brand, description, item_group,purchase_account,cost_center from tabItem where name=%s",arg,as_dict=1)
|
item_det = sql("select item_name, brand, description, item_group,purchase_account,cost_center from tabItem where name=%s",arg,as_dict=1)
|
||||||
tax = sql("select tax_type, tax_rate from `tabItem Tax` where parent = %s" , arg)
|
tax = sql("select tax_type, tax_rate from `tabItem Tax` where parent = %s" , arg)
|
||||||
t = {}
|
t = {}
|
||||||
@ -119,7 +121,7 @@ class DocType(TransactionBase):
|
|||||||
'amount' : 0.00,
|
'amount' : 0.00,
|
||||||
'expense_head' : item_det and item_det[0]['purchase_account'] or '',
|
'expense_head' : item_det and item_det[0]['purchase_account'] or '',
|
||||||
'cost_center' : item_det and item_det[0]['cost_center'] or '',
|
'cost_center' : item_det and item_det[0]['cost_center'] or '',
|
||||||
'item_tax_rate' : str(t)
|
'item_tax_rate' : json.dumps(t)
|
||||||
}
|
}
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ cur_frm.cscript.load_defaults = function(doc, dt, dn) {
|
|||||||
|
|
||||||
// Update existing item details
|
// Update existing item details
|
||||||
cur_frm.cscript.update_item_details = function(doc, dt, dn) {
|
cur_frm.cscript.update_item_details = function(doc, dt, dn) {
|
||||||
if(!cur_frm.doc.__islocal) return;
|
if(!cur_frm.doc.__islocal) { return; }
|
||||||
var children = getchildren(cur_frm.cscript.tname, doc.name, cur_frm.cscript.fname);
|
var children = getchildren(cur_frm.cscript.tname, doc.name, cur_frm.cscript.fname);
|
||||||
if(children) {
|
if(children) {
|
||||||
$c_obj(make_doclist(doc.doctype, doc.name), 'get_item_details', '',
|
$c_obj(make_doclist(doc.doctype, doc.name), 'get_item_details', '',
|
||||||
|
@ -197,17 +197,19 @@ class DocType(TransactionBase):
|
|||||||
|
|
||||||
#---------------------------------------- Get Tax Details -------------------------------#
|
#---------------------------------------- Get Tax Details -------------------------------#
|
||||||
def get_tax_details(self, item_code, obj):
|
def get_tax_details(self, item_code, obj):
|
||||||
|
import json
|
||||||
tax = webnotes.conn.sql("select tax_type, tax_rate from `tabItem Tax` where parent = %s" , item_code)
|
tax = webnotes.conn.sql("select tax_type, tax_rate from `tabItem Tax` where parent = %s" , item_code)
|
||||||
t = {}
|
t = {}
|
||||||
for x in tax: t[x[0]] = flt(x[1])
|
for x in tax: t[x[0]] = flt(x[1])
|
||||||
ret = {
|
ret = {
|
||||||
'item_tax_rate' : tax and str(t) or ''
|
'item_tax_rate' : tax and json.dumps(t) or ''
|
||||||
}
|
}
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
# Get Serial No Details
|
# Get Serial No Details
|
||||||
# ==========================================================================
|
# ==========================================================================
|
||||||
def get_serial_details(self, serial_no, obj):
|
def get_serial_details(self, serial_no, obj):
|
||||||
|
import json
|
||||||
item = webnotes.conn.sql("select item_code, make, label,brand, description from `tabSerial No` where name = '%s' and docstatus != 2" %(serial_no), as_dict=1)
|
item = webnotes.conn.sql("select item_code, make, label,brand, description from `tabSerial No` where name = '%s' and docstatus != 2" %(serial_no), as_dict=1)
|
||||||
tax = webnotes.conn.sql("select tax_type, tax_rate from `tabItem Tax` where parent = %s" , item[0]['item_code'])
|
tax = webnotes.conn.sql("select tax_type, tax_rate from `tabItem Tax` where parent = %s" , item[0]['item_code'])
|
||||||
t = {}
|
t = {}
|
||||||
@ -218,7 +220,7 @@ class DocType(TransactionBase):
|
|||||||
'label' : item and item[0]['label'] or '',
|
'label' : item and item[0]['label'] or '',
|
||||||
'brand' : item and item[0]['brand'] or '',
|
'brand' : item and item[0]['brand'] or '',
|
||||||
'description' : item and item[0]['description'] or '',
|
'description' : item and item[0]['description'] or '',
|
||||||
'item_tax_rate' : str(t)
|
'item_tax_rate' : json.dumps(t)
|
||||||
}
|
}
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
@ -112,6 +112,7 @@ class DocType:
|
|||||||
|
|
||||||
def cal_charges_and_item_tax_amt(self):
|
def cal_charges_and_item_tax_amt(self):
|
||||||
""" Re-calculates other charges values and itemwise tax amount for getting valuation rate"""
|
""" Re-calculates other charges values and itemwise tax amount for getting valuation rate"""
|
||||||
|
import json
|
||||||
for pr in self.selected_pr:
|
for pr in self.selected_pr:
|
||||||
obj = get_obj('Purchase Receipt', pr, with_children = 1)
|
obj = get_obj('Purchase Receipt', pr, with_children = 1)
|
||||||
total = 0
|
total = 0
|
||||||
@ -121,7 +122,11 @@ class DocType:
|
|||||||
prev_total, item_tax = flt(prd.amount), 0
|
prev_total, item_tax = flt(prd.amount), 0
|
||||||
total += flt(prd.qty) * flt(prd.purchase_rate)
|
total += flt(prd.qty) * flt(prd.purchase_rate)
|
||||||
|
|
||||||
item_tax_rate = prd.item_tax_rate and eval(prd.item_tax_rate) or {}
|
try:
|
||||||
|
item_tax_rate = prd.item_tax_rate and json.loads(prd.item_tax_rate) or {}
|
||||||
|
except ValueError:
|
||||||
|
item_tax_rate = prd.item_tax_rate and eval(prd.item_tax_rate) or {}
|
||||||
|
|
||||||
|
|
||||||
ocd = getlist(obj.doclist, 'purchase_tax_details')
|
ocd = getlist(obj.doclist, 'purchase_tax_details')
|
||||||
# calculate tax for other charges
|
# calculate tax for other charges
|
||||||
|
@ -241,7 +241,7 @@ cur_frm.cscript['Make Purchase Invoice'] = function() {
|
|||||||
'from_docname': cur_frm.doc.name,
|
'from_docname': cur_frm.doc.name,
|
||||||
'from_to_list':"[['Purchase Receipt','Payable Voucher'],['Purchase Receipt Detail','PV Detail'],['Purchase Tax Detail','Purchase Tax Detail']]"
|
'from_to_list':"[['Purchase Receipt','Payable Voucher'],['Purchase Receipt Detail','PV Detail'],['Purchase Tax Detail','Purchase Tax Detail']]"
|
||||||
}, function(r,rt) {
|
}, function(r,rt) {
|
||||||
loaddoc('Payable Voucher', n);
|
loaddoc('Payable Voucher', n);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user