commit
ef1f75bdff
@ -1,7 +1,7 @@
|
|||||||
# REMEMBER to update this
|
# REMEMBER to update this
|
||||||
# ========================
|
# ========================
|
||||||
|
|
||||||
last_patch = 332
|
last_patch = 334
|
||||||
|
|
||||||
#-------------------------------------------
|
#-------------------------------------------
|
||||||
|
|
||||||
@ -1343,3 +1343,12 @@ 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')
|
||||||
|
@ -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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user