[cleanup] [minor] deprecated cancelled stock ledger entry

This commit is contained in:
Nabin Hait
2013-08-20 12:04:46 +05:30
parent 05652874fc
commit 4ae729bfd2
17 changed files with 22 additions and 59 deletions

View File

@@ -65,7 +65,6 @@ class DocType:
select * from `tabStock Ledger Entry`
where item_code = %s
and warehouse = %s
and ifnull(is_cancelled, 'No') = 'No'
order by timestamp(posting_date, posting_time) asc, name asc
limit 1
""", (self.doc.item_code, self.doc.warehouse), as_dict=1)

View File

@@ -194,7 +194,7 @@ class DocType(DocListController):
def check_if_sle_exists(self):
sle = webnotes.conn.sql("""select name from `tabStock Ledger Entry`
where item_code = %s and ifnull(is_cancelled, 'No') = 'No'""", self.doc.name)
where item_code = %s""", self.doc.name)
return sle and 'exists' or 'not exists'
def validate_name_with_item_group(self):
@@ -255,8 +255,6 @@ class DocType(DocListController):
def on_trash(self):
webnotes.conn.sql("""delete from tabBin where item_code=%s""", self.doc.item_code)
webnotes.conn.sql("""delete from `tabStock Ledger Entry`
where item_code=%s and is_cancelled='Yes' """, self.doc.item_code)
if self.doc.page_name:
from webnotes.webutils import clear_cache

View File

@@ -2,7 +2,7 @@
{
"creation": "2013-05-16 10:59:15",
"docstatus": 0,
"modified": "2013-08-16 10:16:00",
"modified": "2013-08-20 11:52:13",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -316,18 +316,6 @@
"no_copy": 1,
"read_only": 1
},
{
"doctype": "DocField",
"fieldname": "is_cancelled",
"fieldtype": "Select",
"hidden": 1,
"label": "Is Cancelled",
"oldfieldname": "is_cancelled",
"oldfieldtype": "Select",
"options": "\nYes\nNo",
"read_only": 0,
"report_hide": 1
},
{
"doctype": "DocField",
"fieldname": "column_break5",
@@ -465,13 +453,6 @@
"reqd": 1,
"search_index": 1
},
{
"cancel": 1,
"create": 1,
"doctype": "DocPerm",
"role": "System Manager",
"write": 1
},
{
"cancel": 1,
"create": 1,

View File

@@ -228,7 +228,7 @@ class DocType(StockController):
sle = webnotes.conn.sql("""select name, posting_date, posting_time,
actual_qty, stock_value, warehouse from `tabStock Ledger Entry`
where voucher_type = %s and voucher_no = %s and
item_code = %s and ifnull(is_cancelled, 'No') = 'No' limit 1""",
item_code = %s limit 1""",
((self.doc.delivery_note_no and "Delivery Note" or "Sales Invoice"),
self.doc.delivery_note_no or self.doc.sales_invoice_no, args.item_code), as_dict=1)
if sle:
@@ -770,7 +770,6 @@ def get_batch_no(doctype, txt, searchfield, start, page_len, filters):
from `tabStock Ledger Entry` sle
where item_code = '%(item_code)s'
and warehouse = '%(s_warehouse)s'
and ifnull(is_cancelled, 'No') = 'No'
and batch_no like '%(txt)s'
and exists(select * from `tabBatch`
where name = sle.batch_no

View File

@@ -2,7 +2,7 @@
{
"creation": "2013-01-29 19:25:42",
"docstatus": 0,
"modified": "2013-07-25 16:39:10",
"modified": "2013-08-20 11:56:25",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -272,20 +272,6 @@
"search_index": 0,
"width": "150px"
},
{
"doctype": "DocField",
"fieldname": "is_cancelled",
"fieldtype": "Select",
"in_filter": 1,
"label": "Is Cancelled",
"oldfieldname": "is_cancelled",
"oldfieldtype": "Select",
"options": "\nYes\nNo",
"print_width": "100px",
"read_only": 1,
"search_index": 0,
"width": "100px"
},
{
"amend": 0,
"cancel": 0,

View File

@@ -244,7 +244,6 @@ class DocType(StockController):
"voucher_type": self.doc.doctype,
"voucher_no": self.doc.name,
"company": self.doc.company,
"is_cancelled": "No",
"voucher_detail_no": row.voucher_detail_no,
"fiscal_year": self.doc.fiscal_year,
})
@@ -305,8 +304,7 @@ class DocType(StockController):
if not self.doc.expense_account:
msgprint(_("Please enter Expense Account"), raise_exception=1)
elif not webnotes.conn.sql("""select * from `tabStock Ledger Entry`
where ifnull(is_cancelled, 'No') = 'No'"""):
elif not webnotes.conn.sql("""select * from `tabStock Ledger Entry`"""):
if webnotes.conn.get_value("Account", self.doc.expense_account,
"is_pl_account") == "Yes":
msgprint(_("""Expense Account can not be a PL Account, as this stock \

View File

@@ -146,8 +146,7 @@ class DocType:
sql("delete from `tabBin` where name = %s", d['name'])
# delete cancelled sle
if sql("""select name from `tabStock Ledger Entry`
where warehouse = %s and ifnull('is_cancelled', '') = 'No'""", self.doc.name):
if sql("""select name from `tabStock Ledger Entry` where warehouse = %s""", self.doc.name):
msgprint("""Warehosue can not be deleted as stock ledger entry
exists for this warehouse.""", raise_exception=1)
else:

View File

@@ -52,7 +52,7 @@ def get_stock_ledger_entries(filters):
return webnotes.conn.sql("""select item_code, batch_no, warehouse,
posting_date, actual_qty
from `tabStock Ledger Entry`
where ifnull(is_cancelled, 'No') = 'No' %s order by item_code, warehouse""" %
where docstatus < 2 %s order by item_code, warehouse""" %
conditions, as_dict=1)
def get_item_warehouse_batch_map(filters):

View File

@@ -2,14 +2,14 @@
{
"creation": "2013-01-14 15:26:21",
"docstatus": 0,
"modified": "2013-02-22 15:53:01",
"modified": "2013-08-20 11:53:43",
"modified_by": "Administrator",
"owner": "Administrator"
},
{
"doctype": "Report",
"is_standard": "Yes",
"json": "{\"filters\":[[\"Stock Ledger Entry\",\"is_cancelled\",\"=\",\"No\"]],\"columns\":[[\"item_code\",\"Stock Ledger Entry\"],[\"warehouse\",\"Stock Ledger Entry\"],[\"posting_date\",\"Stock Ledger Entry\"],[\"posting_time\",\"Stock Ledger Entry\"],[\"actual_qty\",\"Stock Ledger Entry\"],[\"qty_after_transaction\",\"Stock Ledger Entry\"],[\"voucher_type\",\"Stock Ledger Entry\"],[\"voucher_no\",\"Stock Ledger Entry\"]],\"sort_by\":\"Stock Ledger Entry.posting_date\",\"sort_order\":\"desc\",\"sort_by_next\":\"Stock Ledger Entry.posting_time\",\"sort_order_next\":\"desc\"}",
"json": "{\"filters\":[],\"columns\":[[\"item_code\",\"Stock Ledger Entry\"],[\"warehouse\",\"Stock Ledger Entry\"],[\"posting_date\",\"Stock Ledger Entry\"],[\"posting_time\",\"Stock Ledger Entry\"],[\"actual_qty\",\"Stock Ledger Entry\"],[\"qty_after_transaction\",\"Stock Ledger Entry\"],[\"voucher_type\",\"Stock Ledger Entry\"],[\"voucher_no\",\"Stock Ledger Entry\"]],\"sort_by\":\"Stock Ledger Entry.posting_date\",\"sort_order\":\"desc\",\"sort_by_next\":\"Stock Ledger Entry.posting_time\",\"sort_order_next\":\"desc\"}",
"name": "__common__",
"ref_doctype": "Stock Ledger Entry",
"report_name": "Stock Ledger",

View File

@@ -52,7 +52,7 @@ def get_stock_ledger_entries(filters):
return webnotes.conn.sql("""select item_code, warehouse,
posting_date, actual_qty, company
from `tabStock Ledger Entry`
where ifnull(is_cancelled, 'No') = 'No' %s order by item_code, warehouse""" %
where docstatus < 2 %s order by item_code, warehouse""" %
conditions, as_dict=1)
def get_item_warehouse_map(filters):

View File

@@ -145,7 +145,6 @@ def get_stock_ledger_entries(args, conditions=None, order="desc", limit=None, fo
return webnotes.conn.sql("""select * from `tabStock Ledger Entry`
where item_code = %%(item_code)s
and warehouse = %%(warehouse)s
and ifnull(is_cancelled, 'No') = 'No'
%(conditions)s
order by timestamp(posting_date, posting_time) %(order)s, name %(order)s
%(limit)s %(for_update)s""" % {