[cleanup] Removed Warehouse Type

This commit is contained in:
Rushabh Mehta
2013-07-10 18:39:06 +05:30
parent 3093e6fd39
commit 982ad35fd2
18 changed files with 31 additions and 257 deletions

View File

@@ -31,11 +31,7 @@ class DocType:
def validate(self):
if not self.doc.stock_uom:
self.doc.stock_uom = webnotes.conn.get_value('Item', self.doc.item_code, 'stock_uom')
if not self.doc.warehouse_type:
self.doc.warehouse_type = webnotes.conn.get_value("Warehouse", self.doc.warehouse,
"warehouse_type")
self.validate_mandatory()
self.doc.projected_qty = flt(self.doc.actual_qty) + flt(self.doc.ordered_qty) + \

View File

@@ -2,7 +2,7 @@
{
"creation": "2013-01-10 16:34:25",
"docstatus": 0,
"modified": "2013-07-10 14:54:04",
"modified": "2013-07-10 18:32:13",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -52,15 +52,6 @@
"options": "Warehouse",
"search_index": 1
},
{
"doctype": "DocField",
"fieldname": "warehouse_type",
"fieldtype": "Data",
"in_list_view": 1,
"label": "Warehouse Type",
"oldfieldname": "warehouse_type",
"oldfieldtype": "Data"
},
{
"doctype": "DocField",
"fieldname": "item_code",

View File

@@ -51,7 +51,6 @@ class DocType(DocListController):
self.fill_customer_code()
self.check_item_tax()
self.validate_barcode()
self.check_non_asset_warehouse()
self.cant_change()
self.validate_item_type_for_reorder()
@@ -185,18 +184,7 @@ class DocType(DocListController):
if duplicate:
msgprint("Barcode: %s already used in item: %s" %
(self.doc.barcode, cstr(duplicate[0][0])), raise_exception = 1)
def check_non_asset_warehouse(self):
if not self.doc.__islocal and self.doc.is_asset_item == "Yes":
existing_qty = webnotes.conn.sql("select t1.warehouse, t1.actual_qty from tabBin t1, tabWarehouse t2 where t1.item_code=%s and (t2.warehouse_type!='Fixed Asset' or t2.warehouse_type is null) and t1.warehouse=t2.name and t1.actual_qty > 0", self.doc.name)
for e in existing_qty:
msgprint("%s Units exist in Warehouse %s, which is not an Asset Warehouse." %
(e[1],e[0]))
if existing_qty:
self.doc.is_asset_item = 'No'
msgprint(_("""Please transfer the above quantities to an asset warehouse \
before changing this item to an asset item"""), raise_exception=1)
def cant_change(self):
if not self.doc.fields.get("__islocal"):
vals = webnotes.conn.get_value("Item", self.doc.name,

View File

@@ -222,9 +222,6 @@ class DocType:
def make_entry(self, args):
args.update({"doctype": "Stock Ledger Entry"})
if args.get("warehouse"):
args["warehouse_type"] = webnotes.conn.get_value('Warehouse' , args["warehouse"],
'warehouse_type')
sle = webnotes.bean([args])
sle.ignore_permissions = 1
sle.insert()

View File

@@ -2,7 +2,7 @@
{
"creation": "2013-01-29 19:25:42",
"docstatus": 0,
"modified": "2013-07-05 14:56:15",
"modified": "2013-07-10 18:34:09",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -91,18 +91,6 @@
"search_index": 1,
"width": "100px"
},
{
"doctype": "DocField",
"fieldname": "warehouse_type",
"fieldtype": "Select",
"in_filter": 1,
"label": "Warehouse Type",
"oldfieldname": "warehouse_type",
"oldfieldtype": "Select",
"options": "link:Warehouse Type",
"read_only": 1,
"search_index": 0
},
{
"description": "The date at which current entry will get or has actually executed.",
"doctype": "DocField",

View File

@@ -2,19 +2,16 @@ test_records = [
[{
"doctype": "Warehouse",
"warehouse_name": "_Test Warehouse",
"warehouse_type": "_Test Warehouse Type",
"company": "_Test Company"
}],
[{
"doctype": "Warehouse",
"warehouse_name": "_Test Warehouse 1",
"warehouse_type": "_Test Warehouse Type",
"company": "_Test Company"
}],
[{
"doctype": "Warehouse",
"warehouse_name": "_Test Warehouse 2",
"warehouse_type": "_Test Warehouse Type",
"company": "_Test Company 1"
}]
]

View File

@@ -47,15 +47,7 @@ class DocType:
bin_obj = get_obj('Bin', bin)
return bin_obj
def validate_asset(self, item_code):
if webnotes.conn.get_value("Item", item_code, "is_asset_item") == 'Yes' \
and self.doc.warehouse_type != 'Fixed Asset':
msgprint("""Fixed Asset Item %s can only be transacted in a
Fixed Asset type Warehouse""" % item_code, raise_exception=1)
def update_bin(self, args):
self.validate_asset(args.get("item_code"))
is_stock_item = webnotes.conn.get_value('Item', args.get("item_code"), 'is_stock_item')
if is_stock_item == 'Yes':
bin = self.get_bin(args.get("item_code"))
@@ -68,14 +60,7 @@ class DocType:
def validate(self):
if self.doc.email_id and not validate_email_add(self.doc.email_id):
msgprint("Please enter valid Email Id", raise_exception=1)
if not self.doc.warehouse_type:
msgprint("Warehouse Type is Mandatory", raise_exception=1)
wt = sql("select warehouse_type from `tabWarehouse` where name ='%s'" % self.doc.name)
if wt and cstr(self.doc.warehouse_type) != cstr(wt[0][0]):
sql("""update `tabStock Ledger Entry` set warehouse_type = %s
where warehouse = %s""", (self.doc.warehouse_type, self.doc.name))
def merge_warehouses(self):
webnotes.conn.auto_commit_on_many_writes = 1

View File

@@ -2,7 +2,7 @@
{
"creation": "2013-03-07 18:50:32",
"docstatus": 0,
"modified": "2013-07-05 15:02:12",
"modified": "2013-07-10 18:37:24",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -14,8 +14,7 @@
"document_type": "Master",
"icon": "icon-building",
"module": "Stock",
"name": "__common__",
"search_fields": "warehouse_type"
"name": "__common__"
},
{
"doctype": "DocField",
@@ -57,19 +56,6 @@
"permlevel": 0,
"reqd": 1
},
{
"doctype": "DocField",
"fieldname": "warehouse_type",
"fieldtype": "Link",
"in_filter": 1,
"in_list_view": 1,
"label": "Warehouse Type",
"oldfieldname": "warehouse_type",
"oldfieldtype": "Link",
"options": "Warehouse Type",
"permlevel": 0,
"reqd": 1
},
{
"doctype": "DocField",
"fieldname": "company",
@@ -80,12 +66,13 @@
"oldfieldtype": "Link",
"options": "Company",
"permlevel": 0,
"reqd": 1,
"search_index": 1
},
{
"doctype": "DocField",
"fieldname": "column_break_4",
"fieldtype": "Column Break",
"fieldtype": "Section Break",
"permlevel": 0
},
{