[cleanup] purchase common

This commit is contained in:
Nabin Hait
2013-10-18 17:00:53 +05:30
parent 0bc5ae55d8
commit 5566bcaa0e
11 changed files with 15 additions and 42 deletions

View File

@@ -16,25 +16,6 @@ class DocType(BuyingController):
def __init__(self, doc, doclist=None):
self.doc = doc
self.doclist = doclist
def is_item_table_empty(self, obj):
if not len(obj.doclist.get({"parentfield": obj.fname})):
msgprint(_("You need to put at least one item in the item table."), raise_exception=True)
def get_supplier_details(self, name = ''):
details = webnotes.conn.sql("select supplier_name,address from `tabSupplier` where name = '%s' and docstatus != 2" %(name), as_dict = 1)
if details:
ret = {
'supplier_name' : details and details[0]['supplier_name'] or '',
'supplier_address' : details and details[0]['address'] or ''
}
# ********** get primary contact details (this is done separately coz. , in case there is no primary contact thn it would not be able to fetch customer details in case of join query)
contact_det = webnotes.conn.sql("select contact_name, contact_no, email_id from `tabContact` where supplier = '%s' and is_supplier = 1 and is_primary_contact = 'Yes' and docstatus != 2" %(name), as_dict = 1)
ret['contact_person'] = contact_det and contact_det[0]['contact_name'] or ''
return ret
else:
msgprint("Supplier : %s does not exists" % (name))
raise Exception
def update_last_purchase_rate(self, obj, is_submit):
"""updates last_purchase_rate in item table for each item"""

View File

@@ -147,7 +147,6 @@ class DocType(BuyingController):
def on_submit(self):
purchase_controller = webnotes.get_obj("Purchase Common")
purchase_controller.is_item_table_empty(self)
self.update_prevdoc_status()
self.update_bin(is_submit = 1, is_stopped = 0)

View File

@@ -26,9 +26,6 @@ class DocType(BuyingController):
self.validate_uom_is_integer("uom", "qty")
def on_submit(self):
purchase_controller = webnotes.get_obj("Purchase Common")
purchase_controller.is_item_table_empty(self)
webnotes.conn.set(self.doc, "status", "Submitted")
def on_cancel(self):