mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-16 11:39:18 +00:00
Merge branch 'master' into stable
This commit is contained in:
@@ -455,7 +455,8 @@
|
|||||||
'description': "Don't delete this field at any cost",
|
'description': "Don't delete this field at any cost",
|
||||||
'doctype': 'DocField',
|
'doctype': 'DocField',
|
||||||
'fieldname': 'old_parent',
|
'fieldname': 'old_parent',
|
||||||
'fieldtype': 'Data',
|
'fieldtype': 'Link',
|
||||||
|
'options': 'Account',
|
||||||
'hidden': 1,
|
'hidden': 1,
|
||||||
'idx': 24,
|
'idx': 24,
|
||||||
'label': 'Old Parent',
|
'label': 'Old Parent',
|
||||||
|
|||||||
@@ -51,7 +51,6 @@ for r in res:
|
|||||||
q1 = "select sum(t1.budget_allocated) from `tabBudget Detail` t1, `tab%s` t2, `tabAccount` t3 where "
|
q1 = "select sum(t1.budget_allocated) from `tabBudget Detail` t1, `tab%s` t2, `tabAccount` t3 where "
|
||||||
cond2 = " t3.is_pl_account = 'Yes' and t3.debit_or_credit = 'Debit' and t3.name = t1.account and t1.docstatus != 2 and "
|
cond2 = " t3.is_pl_account = 'Yes' and t3.debit_or_credit = 'Debit' and t3.name = t1.account and t1.docstatus != 2 and "
|
||||||
if ch:
|
if ch:
|
||||||
|
|
||||||
qur = q1+cond2+cond1+" and t2.name = '%s'"
|
qur = q1+cond2+cond1+" and t2.name = '%s'"
|
||||||
ret_amt = sql(qur%(based_on,fiscal_year,based_on,r[0].strip()))
|
ret_amt = sql(qur%(based_on,fiscal_year,based_on,r[0].strip()))
|
||||||
|
|
||||||
|
|||||||
@@ -52,12 +52,12 @@ cur_frm.cscript.from_date = function(doc, dt, dn) {
|
|||||||
// to date
|
// to date
|
||||||
// --------
|
// --------
|
||||||
cur_frm.cscript.to_date = function(doc, dt, dn) {
|
cur_frm.cscript.to_date = function(doc, dt, dn) {
|
||||||
if(cint(doc.half_day) == 1 && doc.from_date && doc.from_date != doc.to_date){
|
if(cint(doc.half_day) == 1 && cstr(doc.from_date) && doc.from_date != doc.to_date){
|
||||||
msgprint("To Date should be same as From Date for Half Day leave");
|
msgprint("To Date should be same as From Date for Half Day leave");
|
||||||
return;
|
set_multiple(dt,dn,{to_date:doc.from_date});
|
||||||
}
|
}
|
||||||
if(cint(doc.half_day) == 1){
|
if(cint(doc.half_day) == 1){
|
||||||
set_multiple(dt,dn,{to_date:doc.from_date});
|
|
||||||
}
|
}
|
||||||
calculate_total_days(doc, dt, dn);
|
calculate_total_days(doc, dt, dn);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ cur_frm.cscript.month = cur_frm.cscript.employee = cur_frm.cscript.fiscal_year;
|
|||||||
// Calculate total if lwp exists
|
// Calculate total if lwp exists
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
cur_frm.cscript.leave_without_pay = function(doc,dt,dn){
|
cur_frm.cscript.leave_without_pay = function(doc,dt,dn){
|
||||||
doc.payment_days = cint(doc.total_days_in_month) - cint(doc.leave_without_pay);
|
doc.payment_days = flt(doc.total_days_in_month) - flt(doc.leave_without_pay);
|
||||||
refresh_field('payment_days');
|
refresh_field('payment_days');
|
||||||
calculate_all(doc, dt, dn);
|
calculate_all(doc, dt, dn);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -101,8 +101,17 @@ class DocType(TransactionBase):
|
|||||||
for d in range(m[3]):
|
for d in range(m[3]):
|
||||||
dt = add_days(cstr(m[1]), d)
|
dt = add_days(cstr(m[1]), d)
|
||||||
if dt not in holidays:
|
if dt not in holidays:
|
||||||
if sql("select t1.name from `tabLeave Application` t1, `tabLeave Type` t2 where t2.name = t1.leave_type and ifnull(t2.is_lwp, 0) = 1 and t1.docstatus = 1 and t1.employee = '%s' and '%s' between from_date and to_date"%(self.doc.employee, dt)):
|
leave = sql("""
|
||||||
lwp += 1
|
select t1.name, t1.half_day
|
||||||
|
from `tabLeave Application` t1, `tabLeave Type` t2
|
||||||
|
where t2.name = t1.leave_type
|
||||||
|
and ifnull(t2.is_lwp, 0) = 1
|
||||||
|
and t1.docstatus = 1
|
||||||
|
and t1.employee = '%s'
|
||||||
|
and '%s' between from_date and to_date
|
||||||
|
"""%(self.doc.employee, dt))
|
||||||
|
if leave:
|
||||||
|
lwp = cint(leave[0][1]) and lwp + 0.5 or lwp + 1
|
||||||
return lwp
|
return lwp
|
||||||
|
|
||||||
# Check existing
|
# Check existing
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# REMEMBER to update this
|
# REMEMBER to update this
|
||||||
# ========================
|
# ========================
|
||||||
|
|
||||||
last_patch = 332
|
last_patch = 335
|
||||||
|
|
||||||
#-------------------------------------------
|
#-------------------------------------------
|
||||||
|
|
||||||
@@ -1343,3 +1343,15 @@ def execute(patch_no):
|
|||||||
p.add_permission('Lease Agreement', 'Accounts Manager', 1, read = 1)
|
p.add_permission('Lease Agreement', 'Accounts Manager', 1, read = 1)
|
||||||
elif patch_no == 332:
|
elif patch_no == 332:
|
||||||
sql("update `tabDocField` set permlevel=1, hidden = 1 where parent = 'Bulk Rename Tool' and fieldname = 'file_list'")
|
sql("update `tabDocField` set permlevel=1, hidden = 1 where parent = 'Bulk Rename Tool' and fieldname = 'file_list'")
|
||||||
|
elif patch_no == 333:
|
||||||
|
sql("update `tabDocPerm` set create =1 where role = 'Accounts Manager' and parent = 'Lease Agreement'")
|
||||||
|
|
||||||
|
p = get_obj('Patch Util')
|
||||||
|
p.add_permission('DocType Mapper', 'System Manager', 0, read = 1, write=1, create=1)
|
||||||
|
p.add_permission('Role', 'System Manager', 0, read = 1, write=1, create=1)
|
||||||
|
p.add_permission('Print Format', 'System Manager', 0, read = 1, write=1, create=1)
|
||||||
|
elif patch_no == 334:
|
||||||
|
reload_doc('knowledge_base', 'doctype', 'answer')
|
||||||
|
elif patch_no == 335:
|
||||||
|
for dt in ['Account', 'Cost Center', 'Territory', 'Item Group', 'Customer Group']:
|
||||||
|
sql("update `tabDocField` set fieldtype = 'Link', options = %s where fieldname = 'old_parent' and parent = %s", (dt, dt))
|
||||||
|
|||||||
@@ -329,6 +329,28 @@ class DocType(TransactionBase):
|
|||||||
il.append([warehouse, d.item_code, qty, reserved_qty, d.stock_uom, d.batch_no, d.serial_no])
|
il.append([warehouse, d.item_code, qty, reserved_qty, d.stock_uom, d.batch_no, d.serial_no])
|
||||||
return il
|
return il
|
||||||
|
|
||||||
|
# ---------------------------------------------------------------------------------------------
|
||||||
|
# get qty, amount already billed or delivered against curr line item for current doctype
|
||||||
|
# For Eg: SO-RV get total qty, amount from SO and also total qty, amount against that SO in RV
|
||||||
|
# ---------------------------------------------------------------------------------------------
|
||||||
|
def get_curr_and_ref_doc_details(self, curr_doctype, ref_tab_fname, ref_tab_dn, ref_doc_tname, curr_parent_name, curr_parent_doctype):
|
||||||
|
# Get total qty, amt of current doctype (eg RV) except for qty, amt of this transaction
|
||||||
|
if curr_parent_doctype == 'Installation Note':
|
||||||
|
curr_det = sql("select sum(qty) from `tab%s` where %s = '%s' and docstatus = 1 and parent != '%s'"% (curr_doctype, ref_tab_fname, ref_tab_dn, curr_parent_name))
|
||||||
|
qty, amt = curr_det and flt(curr_det[0][0]) or 0, 0
|
||||||
|
else:
|
||||||
|
curr_det = sql("select sum(qty), sum(amount) from `tab%s` where %s = '%s' and docstatus = 1 and parent != '%s'"% (curr_doctype, ref_tab_fname, ref_tab_dn, curr_parent_name))
|
||||||
|
qty, amt = curr_det and flt(curr_det[0][0]) or 0, curr_det and flt(curr_det[0][1]) or 0
|
||||||
|
|
||||||
|
# get total qty of ref doctype
|
||||||
|
ref_det = sql("select qty, amount from `tab%s` where name = '%s' and docstatus = 1"% (ref_doc_tname, ref_tab_dn))
|
||||||
|
max_qty, max_amt = ref_det and flt(ref_det[0][0]) or 0, ref_det and flt(ref_det[0][1]) or 0
|
||||||
|
|
||||||
|
return qty, max_qty, amt, max_amt
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# -----------------------
|
# -----------------------
|
||||||
# add packing list items
|
# add packing list items
|
||||||
@@ -458,26 +480,6 @@ class DocType(TransactionBase):
|
|||||||
def update_prevdoc_detail(self, is_submit, obj):
|
def update_prevdoc_detail(self, is_submit, obj):
|
||||||
StatusUpdater(obj, is_submit).update()
|
StatusUpdater(obj, is_submit).update()
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------------------------
|
|
||||||
# get qty, amount already billed or delivered against curr line item for current doctype
|
|
||||||
# For Eg: SO-RV get total qty, amount from SO and also total qty, amount against that SO in RV
|
|
||||||
# ---------------------------------------------------------------------------------------------
|
|
||||||
def get_curr_and_ref_doc_details(self, curr_doctype, ref_tab_fname, ref_tab_dn, ref_doc_tname, curr_parent_name, curr_parent_doctype):
|
|
||||||
# Get total qty, amt of current doctype (eg RV) except for qty, amt of this transaction
|
|
||||||
if curr_parent_doctype == 'Installation Note':
|
|
||||||
curr_det = sql("select sum(qty) from `tab%s` where %s = '%s' and docstatus = 1 and parent != '%s'"% (curr_doctype, ref_tab_fname, ref_tab_dn, curr_parent_name))
|
|
||||||
qty, amt = curr_det and flt(curr_det[0][0]) or 0, 0
|
|
||||||
else:
|
|
||||||
curr_det = sql("select sum(qty), sum(amount) from `tab%s` where %s = '%s' and docstatus = 1 and parent != '%s'"% (curr_doctype, ref_tab_fname, ref_tab_dn, curr_parent_name))
|
|
||||||
qty, amt = curr_det and flt(curr_det[0][0]) or 0, curr_det and flt(curr_det[0][1]) or 0
|
|
||||||
|
|
||||||
# get total qty of ref doctype
|
|
||||||
ref_det = sql("select qty, amount from `tab%s` where name = '%s' and docstatus = 1"% (ref_doc_tname, ref_tab_dn))
|
|
||||||
max_qty, max_amt = ref_det and flt(ref_det[0][0]) or 0, ref_det and flt(ref_det[0][1]) or 0
|
|
||||||
|
|
||||||
return qty, max_qty, amt, max_amt
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,25 +0,0 @@
|
|||||||
import unittest
|
|
||||||
import webnotes
|
|
||||||
|
|
||||||
from webnotes.model.code import get_obj
|
|
||||||
|
|
||||||
class SubmissionTest(unittest.TestCase):
|
|
||||||
def setUp(self):
|
|
||||||
self.dn = webnotes.testing.create('Delivery Note')
|
|
||||||
self.dn_items = []
|
|
||||||
|
|
||||||
# get a line item for testing
|
|
||||||
for d in self.dn.doclist:
|
|
||||||
if d.doctype=='Delivery Note Detail':
|
|
||||||
self.dn_items.append(d)
|
|
||||||
|
|
||||||
self.old_bin = get_obj('Warehouse', self.line_item[0].warehouse).get_bin(self.line_item[0].item_code)
|
|
||||||
self.dn.on_submit()
|
|
||||||
|
|
||||||
def test_bin_is_updated(self):
|
|
||||||
"tests if bin quantity is affected when on submission"
|
|
||||||
bin = get_obj('Warehouse', self.line_item.warehouse).get_bin(self.line_item[0].item_code)
|
|
||||||
self.assertTrue(bin.actual_qty == self.old_bin.actual_qty - self.line_item[0].qty)
|
|
||||||
|
|
||||||
def test_sales_order_is_updated(self):
|
|
||||||
"tests if"
|
|
||||||
@@ -178,3 +178,7 @@ Total Available Qty: %s
|
|||||||
|
|
||||||
sle = sql("select name from `tabStock Ledger Entry` where item_code = %s and ifnull(is_cancelled, 'No') = 'No'", self.doc.name)
|
sle = sql("select name from `tabStock Ledger Entry` where item_code = %s and ifnull(is_cancelled, 'No') = 'No'", self.doc.name)
|
||||||
return sle and 'exists' or 'not exists'
|
return sle and 'exists' or 'not exists'
|
||||||
|
|
||||||
|
def on_rename(self,newdn,olddn):
|
||||||
|
sql("update tabItem set item_code = %s where name = %s", (newdn, olddn))
|
||||||
|
|
||||||
|
|||||||
@@ -253,7 +253,8 @@
|
|||||||
'no_copy': 1,
|
'no_copy': 1,
|
||||||
'oldfieldname': 'serial_no',
|
'oldfieldname': 'serial_no',
|
||||||
'oldfieldtype': 'Text',
|
'oldfieldtype': 'Text',
|
||||||
'permlevel': 0
|
'permlevel': 0,
|
||||||
|
'reqd': 0
|
||||||
},
|
},
|
||||||
|
|
||||||
# DocField
|
# DocField
|
||||||
|
|||||||
@@ -86,6 +86,7 @@ class DocType:
|
|||||||
d.parenttype = 'DocType'
|
d.parenttype = 'DocType'
|
||||||
d.parentfield = 'permissions'
|
d.parentfield = 'permissions'
|
||||||
|
|
||||||
|
d.level = level
|
||||||
d.role = role
|
d.role = role
|
||||||
d.read = read
|
d.read = read
|
||||||
d.write = write
|
d.write = write
|
||||||
|
|||||||
Reference in New Issue
Block a user