From cfecd2bc1662c6eb7563164d441c49606fd4689f Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 11 Jul 2013 17:49:18 +0530 Subject: [PATCH] [fix] [cleanup] fixes while testing and code cleanup --- .../journal_voucher/journal_voucher.py | 9 +- .../payment_to_invoice_matching_tool.py | 49 +++-- .../doctype/pos_setting/test_pos_setting.py | 2 +- .../purchase_invoice/purchase_invoice.py | 4 - .../doctype/sales_invoice/sales_invoice.py | 2 - .../sales_invoice/test_sales_invoice.py | 2 +- accounts/utils.py | 10 +- .../purchase_common/purchase_common.py | 203 +++--------------- .../doctype/purchase_order/purchase_order.py | 37 ++-- .../purchase_order/test_purchase_order.py | 4 +- .../supplier_quotation/supplier_quotation.py | 5 - .../test_supplier_quotation.py | 2 +- controllers/accounts_controller.py | 16 +- controllers/queries.py | 3 +- hr/doctype/expense_claim/expense_claim.py | 16 +- manufacturing/doctype/bom/bom.js | 2 +- .../production_order/production_order.py | 7 +- .../production_order/production_order.txt | 14 +- .../installation_note/installation_note.py | 4 +- selling/doctype/lead/lead.py | 2 +- selling/doctype/opportunity/opportunity.py | 14 +- selling/doctype/quotation/quotation.py | 10 - selling/doctype/sales_common/sales_common.py | 33 +-- selling/doctype/sales_order/sales_order.py | 5 - .../doctype/sales_order/test_sales_order.py | 2 +- setup/doctype/company/test_company.py | 2 + .../doctype/sales_person/test_sales_person.py | 6 +- stock/doctype/delivery_note/delivery_note.py | 6 - .../delivery_note/test_delivery_note.py | 2 +- stock/doctype/item/test_item.py | 14 +- .../material_request/material_request.py | 11 - .../material_request/test_material_request.py | 28 +-- .../purchase_receipt/purchase_receipt.py | 4 - .../purchase_receipt/test_purchase_receipt.py | 6 +- stock/doctype/serial_no/test_serial_no.py | 4 +- stock/doctype/stock_entry/test_stock_entry.py | 42 ++-- .../test_stock_reconciliation.py | 20 +- stock/doctype/warehouse/warehouse.py | 2 +- utilities/cleanup_data.py | 2 +- 39 files changed, 197 insertions(+), 409 deletions(-) diff --git a/accounts/doctype/journal_voucher/journal_voucher.py b/accounts/doctype/journal_voucher/journal_voucher.py index 77fec8ee8b..8292bfad22 100644 --- a/accounts/doctype/journal_voucher/journal_voucher.py +++ b/accounts/doctype/journal_voucher/journal_voucher.py @@ -18,9 +18,8 @@ from __future__ import unicode_literals import webnotes from webnotes.utils import cint, cstr, flt, fmt_money, formatdate, getdate -from webnotes.model.doc import addchild, make_autoname +from webnotes.model.doc import addchild from webnotes.model.bean import getlist -from webnotes.model.code import get_obj from webnotes import msgprint from setup.utils import get_company_currency @@ -39,13 +38,13 @@ class DocType(AccountsController): self.doc.is_opening='No' self.doc.clearance_date = None - + + super(DocType, self).validate_date_with_fiscal_year() + self.validate_debit_credit() self.validate_cheque_info() self.validate_entries_for_advance() self.validate_against_jv() - get_obj('Sales Common').validate_fiscal_year(self.doc.fiscal_year, \ - self.doc.posting_date, 'Posting Date') self.set_against_account() self.create_remarks() diff --git a/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.py b/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.py index 07a97d8823..dde83e98d5 100644 --- a/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.py +++ b/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.py @@ -144,25 +144,30 @@ def gl_entry_details(doctype, txt, searchfield, start, page_len, filters): from controllers.queries import get_match_cond return webnotes.conn.sql("""select gle.voucher_no, gle.posting_date, - gle.%(account_type)s from `tabGL Entry` gle - where gle.account = '%(acc)s' - and gle.voucher_type = '%(dt)s' - and gle.voucher_no like '%(txt)s' - and ifnull(gle.is_cancelled, 'No') = 'No' - and (ifnull(gle.against_voucher, '') = '' - or ifnull(gle.against_voucher, '') = gle.voucher_no ) - and ifnull(gle.%(account_type)s, 0) > 0 - and (select ifnull(abs(sum(ifnull(debit, 0)) - - sum(ifnull(credit, 0))), 0) - from `tabGL Entry` - where against_voucher_type = '%(dt)s' - and against_voucher = gle.voucher_no - and voucher_no != gle.voucher_no - and ifnull(is_cancelled, 'No') = 'No') - != abs(ifnull(gle.debit, 0) - ifnull(gle.credit, 0) - ) - %(mcond)s - ORDER BY gle.posting_date desc, gle.voucher_no desc - limit %(start)s, %(page_len)s""" % {dt:filters["dt"], acc:filters["acc"], - account_type: filters['account_type'], 'mcond':get_match_cond(doctype, searchfield) - 'txt': "%%%s%%" % txt,"start": start, "page_len": page_len}) \ No newline at end of file + gle.%(account_type)s from `tabGL Entry` gle + where gle.account = '%(acc)s' + and gle.voucher_type = '%(dt)s' + and gle.voucher_no like '%(txt)s' + and ifnull(gle.is_cancelled, 'No') = 'No' + and (ifnull(gle.against_voucher, '') = '' + or ifnull(gle.against_voucher, '') = gle.voucher_no ) + and ifnull(gle.%(account_type)s, 0) > 0 + and (select ifnull(abs(sum(ifnull(debit, 0)) - sum(ifnull(credit, 0))), 0) + from `tabGL Entry` + where against_voucher_type = '%(dt)s' + and against_voucher = gle.voucher_no + and voucher_no != gle.voucher_no + and ifnull(is_cancelled, 'No') = 'No') + != abs(ifnull(gle.debit, 0) - ifnull(gle.credit, 0) + ) + %(mcond)s + ORDER BY gle.posting_date desc, gle.voucher_no desc + limit %(start)s, %(page_len)s""" % { + "dt":filters["dt"], + "acc":filters["acc"], + "account_type": filters['account_type'], + 'mcond':get_match_cond(doctype, searchfield), + 'txt': "%%%s%%" % txt, + "start": start, + "page_len": page_len + }) \ No newline at end of file diff --git a/accounts/doctype/pos_setting/test_pos_setting.py b/accounts/doctype/pos_setting/test_pos_setting.py index d6556ae04a..91159b1333 100644 --- a/accounts/doctype/pos_setting/test_pos_setting.py +++ b/accounts/doctype/pos_setting/test_pos_setting.py @@ -6,7 +6,7 @@ test_records = [ "conversion_rate": 1.0, "price_list_name": "_Test Price List", "company": "_Test Company", - "warehouse": "_Test Warehouse", + "warehouse": "_Test Warehouse - _TC", "territory": "_Test Territory", "cash_bank_account": "_Test Account Bank Account - _TC", "income_account": "Sales - _TC", diff --git a/accounts/doctype/purchase_invoice/purchase_invoice.py b/accounts/doctype/purchase_invoice/purchase_invoice.py index 6d18eaee32..f1c9c42644 100644 --- a/accounts/doctype/purchase_invoice/purchase_invoice.py +++ b/accounts/doctype/purchase_invoice/purchase_invoice.py @@ -66,10 +66,6 @@ class DocType(BuyingController): #set against account for credit to self.set_against_expense_account() - - #FY validation - get_obj('Sales Common').validate_fiscal_year(self.doc.fiscal_year, - self.doc.posting_date,'Posting Date') self.validate_write_off_account() self.update_raw_material_cost() diff --git a/accounts/doctype/sales_invoice/sales_invoice.py b/accounts/doctype/sales_invoice/sales_invoice.py index e42cb73340..79f757f423 100644 --- a/accounts/doctype/sales_invoice/sales_invoice.py +++ b/accounts/doctype/sales_invoice/sales_invoice.py @@ -65,8 +65,6 @@ class DocType(SellingController): sales_com_obj.check_active_sales_items(self) sales_com_obj.check_conversion_rate(self) sales_com_obj.validate_max_discount(self, 'entries') - sales_com_obj.validate_fiscal_year(self.doc.fiscal_year, - self.doc.posting_date,'Posting Date') self.validate_customer_account() self.validate_debit_acc() self.validate_fixed_asset_account() diff --git a/accounts/doctype/sales_invoice/test_sales_invoice.py b/accounts/doctype/sales_invoice/test_sales_invoice.py index db08a4f6d2..ec4535b226 100644 --- a/accounts/doctype/sales_invoice/test_sales_invoice.py +++ b/accounts/doctype/sales_invoice/test_sales_invoice.py @@ -327,7 +327,7 @@ class TestSalesInvoice(unittest.TestCase): si.doc.name, as_dict=1)[0] self.assertTrue(sle) self.assertEquals([sle.item_code, sle.warehouse, sle.actual_qty], - ["_Test Item", "_Test Warehouse", -1.0]) + ["_Test Item", "_Test Warehouse - _TC", -1.0]) # check gl entries stock_in_hand_account = webnotes.conn.get_value("Company", "_Test Company", diff --git a/accounts/utils.py b/accounts/utils.py index 4ca1b3a57a..3de445c68d 100644 --- a/accounts/utils.py +++ b/accounts/utils.py @@ -26,10 +26,10 @@ from utilities import build_filter_conditions class FiscalYearError(webnotes.ValidationError): pass -def get_fiscal_year(date=None, fiscal_year=None, verbose=1): - return get_fiscal_years(date, fiscal_year, verbose=1)[0] +def get_fiscal_year(date=None, fiscal_year=None, label="Date", verbose=1): + return get_fiscal_years(date, fiscal_year, label, verbose=1)[0] -def get_fiscal_years(date=None, fiscal_year=None, verbose=1): +def get_fiscal_years(date=None, fiscal_year=None, label="Date", verbose=1): # if year start date is 2012-04-01, year end date should be 2013-03-31 (hence subdate) cond = "" if fiscal_year: @@ -45,14 +45,14 @@ def get_fiscal_years(date=None, fiscal_year=None, verbose=1): order by year_start_date desc""" % cond) if not fy: - error_msg = """%s not in any Fiscal Year""" % formatdate(date) + error_msg = """%s %s not in any Fiscal Year""" % (label, formatdate(date)) if verbose: webnotes.msgprint(error_msg) raise FiscalYearError, error_msg return fy def validate_fiscal_year(date, fiscal_year, label="Date"): - years = [f[0] for f in get_fiscal_years(date)] + years = [f[0] for f in get_fiscal_years(date, label=label)] if fiscal_year not in years: webnotes.msgprint(("%(label)s '%(posting_date)s': " + _("not within Fiscal Year") + \ ": '%(fiscal_year)s'") % { diff --git a/buying/doctype/purchase_common/purchase_common.py b/buying/doctype/purchase_common/purchase_common.py index f7db9bfc93..1eb2809e36 100644 --- a/buying/doctype/purchase_common/purchase_common.py +++ b/buying/doctype/purchase_common/purchase_common.py @@ -17,9 +17,8 @@ from __future__ import unicode_literals import webnotes -from webnotes.utils import add_days, cstr, flt +from webnotes.utils import cstr, flt from webnotes.model.bean import getlist -from webnotes.model.code import get_obj from webnotes import msgprint, _ from buying.utils import get_last_purchase_details @@ -32,46 +31,11 @@ class DocType(BuyingController): self.doc = doc self.doclist = doclist - self.chk_tol_for_list = ['Material Request - Purchase Order', 'Purchase Order - Purchase Receipt', 'Purchase Order - Purchase Invoice'] - - self.update_qty = { - 'Material Request - Purchase Order': 'ordered_qty', - 'Purchase Order - Purchase Receipt': 'received_qty', - 'Purchase Order - Purchase Invoice': 'billed_qty', - 'Purchase Receipt - Purchase Invoice': 'billed_qty' - } - - self.update_percent_field = { - 'Material Request - Purchase Order': 'per_ordered', - 'Purchase Order - Purchase Receipt': 'per_received', - 'Purchase Order - Purchase Invoice': 'per_billed', - 'Purchase Receipt - Purchase Invoice': 'per_billed' - } - - # used in validation for items and update_prevdoc_detail - self.doctype_dict = { - 'Material Request': 'Material Request Item', - 'Purchase Order': 'Purchase Order Item', - 'Purchase Receipt': 'Purchase Receipt Item' - } - - self.next_dt_detail = { - 'ordered_qty' : 'Purchase Order Item', - 'billed_qty' : 'Purchase Invoice Item', - 'received_qty': 'Purchase Receipt Item' - } - - self.msg = [] - def is_item_table_empty(self, obj): if not len(obj.doclist.get({"parentfield": obj.fname})): msgprint(_("Hey there! You need to put at least one item in \ the item table."), raise_exception=True) - # Client Trigger functions - #------------------------------------------------------------------------------------------------ - - # Get Supplier Details def get_supplier_details(self, name = ''): details = sql("select supplier_name,address from `tabSupplier` where name = '%s' and docstatus != 2" %(name), as_dict = 1) if details: @@ -94,8 +58,6 @@ class DocType(BuyingController): ret = { 'projected_qty' : bin and flt(bin[0]['projected_qty']) or 0 } return ret - # --- Last Purchase Rate related methods --- - def update_last_purchase_rate(self, obj, is_submit): """updates last_purchase_rate in item table for each item""" @@ -146,8 +108,6 @@ class DocType(BuyingController): d.purchase_ref_rate = d.purchase_rate = d.import_ref_rate \ = d.import_rate = item_last_purchase_rate - - # validate for same items and validate is_stock_item , is_purchase_item also validate uom and conversion factor def validate_for_items(self, obj): check_list, chk_dupl_itm=[],[] for d in getlist( obj.doclist, obj.fname): @@ -159,7 +119,7 @@ class DocType(BuyingController): # udpate with latest quantities bin = sql("select projected_qty from `tabBin` where item_code = %s and warehouse = %s", (d.item_code, d.warehouse), as_dict = 1) - f_lst ={'projected_qty': bin and flt(bin[0]['projected_qty']) or 0, 'ordered_qty': 0, 'received_qty' : 0, 'billed_qty': 0} + f_lst ={'projected_qty': bin and flt(bin[0]['projected_qty']) or 0, 'ordered_qty': 0, 'received_qty' : 0} if d.doctype == 'Purchase Receipt Item': f_lst.pop('received_qty') for x in f_lst : @@ -206,36 +166,7 @@ class DocType(BuyingController): Please change any of the field value to enter the item twice.""" % d.item_code, raise_exception = 1) else: chk_dupl_itm.append(f) - - # Check for Stopped status - def check_for_stopped_status(self, doctype, docname): - stopped = sql("select name from `tab%s` where name = '%s' and status = 'Stopped'" % - ( doctype, docname)) - if stopped: - msgprint("One cannot do any transaction against %s : %s, it's status is 'Stopped'" % - ( doctype, docname), raise_exception=1) - - - # Check Docstatus of Next DocType on Cancel AND of Previous DocType on Submit - def check_docstatus(self, check, doctype, docname , detail_doctype = ''): - - if check == 'Next': - # Convention := doctype => Next Doctype, docname = current_docname , detail_doctype = Next Doctype Detail Table - - submitted = sql("select t1.name from `tab%s` t1,`tab%s` t2 where t1.name = t2.parent and t2.prevdoc_docname = '%s' and t1.docstatus = 1" % ( doctype, detail_doctype, docname)) - if submitted: - msgprint(cstr(doctype) + " : " + cstr(submitted[0][0]) + " has already been submitted !") - raise Exception - - if check == 'Previous': - # Convention := doctype => Previous Doctype, docname = Previous Docname - submitted = sql("select name from `tab%s` where docstatus = 1 and name = '%s'" % (doctype, docname)) - if not submitted: - msgprint(cstr(doctype) + " : " + cstr(submitted[0][0]) + " not submitted !") - raise Exception - - # Update Ref Doc - # ======================================================= + def get_qty(self,curr_doctype,ref_tab_fname,ref_tab_dn,ref_doc_tname, transaction, curr_parent_name): # Get total Quantities of current doctype (eg. PR) except for qty of this transaction #------------------------------ @@ -252,112 +183,35 @@ class DocType(BuyingController): max_qty = sql("select qty from `tab%s` where name = '%s' and docstatus = 1"% (ref_doc_tname, ref_tab_dn)) max_qty = max_qty and flt(max_qty[0][0]) or 0 - return cstr(qty)+'~~~'+cstr(max_qty) + return cstr(qty)+'~~~'+cstr(max_qty) + def check_for_stopped_status(self, doctype, docname): + stopped = sql("select name from `tab%s` where name = '%s' and status = 'Stopped'" % + ( doctype, docname)) + if stopped: + msgprint("One cannot do any transaction against %s : %s, it's status is 'Stopped'" % + ( doctype, docname), raise_exception=1) + + def check_docstatus(self, check, doctype, docname , detail_doctype = ''): + if check == 'Next': + submitted = sql("""select t1.name from `tab%s` t1,`tab%s` t2 + where t1.name = t2.parent and t2.prevdoc_docname = %s and t1.docstatus = 1""" + % (doctype, detail_doctype, '%s'), docname) + if submitted: + msgprint(cstr(doctype) + ": " + cstr(submitted[0][0]) + + _(" has already been submitted."), raise_exception=1) - - def update_refdoc_qty(self, curr_qty, curr_doctype, ref_dn, ref_dt, ref_tab_fname, ref_tab_dn, transaction, item_code, is_submit, curr_parent_doctype, curr_parent_name): - # Get Quantity - #------------------------------ - curr_ref_qty = self.get_qty(curr_doctype,ref_tab_fname,ref_tab_dn,self.doctype_dict[ref_dt], transaction, curr_parent_name) - qty, max_qty, max_qty_plus_tol = flt(curr_ref_qty.split('~~~')[0]), flt(curr_ref_qty.split('~~~')[1]), flt(curr_ref_qty.split('~~~')[1]) - - # Qty above Tolerance should be allowed only once. - # But there is special case for Transaction 'Material Request-Purhcase Order' that there should be no restriction - # One can create any no. of PO against same Material Request!!! - if qty >= max_qty and is_submit and flt(curr_qty) > 0: - reason = (curr_parent_doctype == 'Purchase Order') and 'Ordered' or (curr_parent_doctype == 'Purchase Receipt') and 'Received' or (curr_parent_doctype == 'Purchase Invoice') and 'Billed' - msgprint("Error: Item Code : '%s' of '%s' is already %s." %(item_code,ref_dn,reason)) - raise Exception - - #check if tolerance added in item master - tolerance = flt(webnotes.conn.get_value('Item',item_code,'tolerance') or 0) - - if not(tolerance): - tolerance = flt(webnotes.conn.get_value('Stock Settings',None,'tolerance') or 0) - - if is_submit: - qty = qty + flt(curr_qty) - - # Calculate max_qty_plus_tol i.e. max_qty with tolerance - #----------------------------------------------------------------- - if transaction in self.chk_tol_for_list: - max_qty_plus_tol = max_qty * (1 + (flt(tolerance)/ 100)) - - if max_qty_plus_tol < qty: - reason = (curr_parent_doctype == 'Purchase Order') and 'Ordered' or (curr_parent_doctype == 'Purchase Receipt') and 'Received' or (curr_parent_doctype == 'Purchase Invoice') and 'Billed' - msg = "error: Already %s Qty for %s is %s and \ - maximum allowed Qty is %s [against %s: %s]" % \ - (cstr(reason), item_code, - cstr(flt(qty) - flt(curr_qty)) , cstr(max_qty_plus_tol), - cstr(ref_dt), cstr(ref_dn)) - msgprint(msg, raise_exception=1) - - # Update qty - #------------------ - sql("update `tab%s` set %s = '%s',modified = now() where name = '%s'" % (self.doctype_dict[ref_dt],self.update_qty[transaction] , flt(qty), ref_tab_dn)) - - def update_ref_doctype_dict(self, curr_qty, curr_doctype, ref_dn, ref_dt, ref_tab_fname, ref_tab_dn, transaction, item_code, is_submit, curr_parent_doctype, curr_parent_name): - # update qty - self.update_refdoc_qty( curr_qty, curr_doctype, ref_dn, ref_dt, ref_tab_fname, ref_tab_dn, transaction, item_code, is_submit, curr_parent_doctype, curr_parent_name) - - # append distinct ref_dn in doctype_dict - if not self.ref_doctype_dict.has_key(ref_dn) and self.update_percent_field.has_key(transaction): - self.ref_doctype_dict[ref_dn] = [ ref_dt, self.doctype_dict[ref_dt],transaction] - - - # update prevdoc detail - # -------------------- - def update_prevdoc_detail(self, obj, is_submit): - import math - self.ref_doctype_dict= {} - for d in getlist(obj.doclist, obj.fname): - - if d.fields.has_key('prevdoc_docname') and d.prevdoc_docname: - transaction = cstr(d.prevdoc_doctype) + ' - ' + cstr(obj.doc.doctype) - curr_qty = (transaction == 'Material Request - Purchase Order') and flt(d.qty) * flt(d.conversion_factor) or flt(d.qty) - self.update_ref_doctype_dict( flt(curr_qty), d.doctype, d.prevdoc_docname, d.prevdoc_doctype, 'prevdoc_detail_docname', d.prevdoc_detail_docname, transaction, d.item_code, is_submit, obj.doc.doctype, obj.doc.name) - - # for payable voucher - if d.fields.has_key('purchase_order') and d.purchase_order: - curr_qty = sql("select sum(qty) from `tabPurchase Invoice Item` where po_detail = '%s' and parent = '%s'" % (cstr(d.po_detail), cstr(obj.doc.name))) - curr_qty = curr_qty and flt(curr_qty[0][0]) or 0 - self.update_ref_doctype_dict( curr_qty, d.doctype, d.purchase_order, 'Purchase Order', 'po_detail', d.po_detail, 'Purchase Order - ' + cstr(obj.doc.doctype), d.item_code, is_submit, obj.doc.doctype, obj.doc.name) - - if d.fields.has_key('purchase_receipt') and d.purchase_receipt: - self.update_ref_doctype_dict( flt(d.qty), d.doctype, d.purchase_receipt, 'Purchase Receipt', 'pr_detail', d.pr_detail, 'Purchase Receipt - ' + cstr(obj.doc.doctype), d.item_code, is_submit, obj.doc.doctype, obj.doc.name) - - for ref_dn in self.ref_doctype_dict: - # Calculate percentage - #---------------------- - ref_doc_obj = get_obj(self.ref_doctype_dict[ref_dn][0],ref_dn,with_children = 1) - count = 0 - percent = 0 - for d in getlist(ref_doc_obj.doclist,ref_doc_obj.fname): - ref_qty = d.fields[self.update_qty[self.ref_doctype_dict[ref_dn][2]]] - if flt(d.qty) - flt(ref_qty) <= 0: - percent += 100 - else: - percent += (flt(ref_qty)/flt(d.qty) * 100) - count += 1 - percent_complete = math.floor(flt(percent)/ flt(count)) - - # update percent complete and modified - #------------------------------------- - sql("update `tab%s` set %s = '%s', modified = '%s' where name = '%s'" % (self.ref_doctype_dict[ref_dn][0], self.update_percent_field[self.ref_doctype_dict[ref_dn][2]], percent_complete, obj.doc.modified, ref_dn)) - - - def validate_fiscal_year(self, fiscal_year, transaction_date, dn): - fy=sql("select year_start_date from `tabFiscal Year` where name='%s'"%fiscal_year) - ysd=fy and fy[0][0] or "" - yed=add_days(str(ysd),365) - if str(transaction_date) < str(ysd) or str(transaction_date) > str(yed): - msgprint("'%s' Not Within The Fiscal Year"%(dn)) - raise Exception + if check == 'Previous': + submitted = sql("""select name from `tab%s` + where docstatus = 1 and name = %s"""% (doctype, '%s'), docname) + if not submitted: + msgprint(cstr(doctype) + ": " + cstr(submitted[0][0]) + + _(" not submitted"), raise_exception=1) def get_rate(self, arg, obj): arg = eval(arg) - rate = sql("select account_type, tax_rate from `tabAccount` where name = '%s'" %(arg['account_head']), as_dict=1) + rate = sql("select account_type, tax_rate from `tabAccount` where name = %s" + , (arg['account_head']), as_dict=1) return {'rate': rate and (rate[0]['account_type'] == 'Tax' \ and not arg['charge_type'] == 'Actual') and flt(rate[0]['tax_rate']) or 0 } @@ -365,5 +219,6 @@ class DocType(BuyingController): def get_prevdoc_date(self, obj): for d in getlist(obj.doclist, obj.fname): if d.prevdoc_doctype and d.prevdoc_docname: - dt = sql("select transaction_date from `tab%s` where name = '%s'" % (d.prevdoc_doctype, d.prevdoc_docname)) + dt = sql("select transaction_date from `tab%s` where name = %s" + % (d.prevdoc_doctype, '%s'), (d.prevdoc_docname)) d.prevdoc_date = dt and dt[0][0].strftime('%Y-%m-%d') or '' diff --git a/buying/doctype/purchase_order/purchase_order.py b/buying/doctype/purchase_order/purchase_order.py index 22cecf6467..0ba00a6de1 100644 --- a/buying/doctype/purchase_order/purchase_order.py +++ b/buying/doctype/purchase_order/purchase_order.py @@ -31,12 +31,21 @@ class DocType(BuyingController): self.doclist = doclist self.tname = 'Purchase Order Item' self.fname = 'po_details' + self.status_updater = [{ + 'source_dt': 'Purchase Order Item', + 'target_dt': 'Material Request Item', + 'join_field': 'prevdoc_detail_docname', + 'target_field': 'ordered_qty', + 'target_parent_dt': 'Material Request', + 'target_parent_field': 'per_ordered', + 'target_ref_field': 'qty', + 'source_field': 'qty', + 'percent_join_field': 'prevdoc_docname', + }] def validate(self): super(DocType, self).validate() - self.validate_fiscal_year() - if not self.doc.status: self.doc.status = "Draft" @@ -53,9 +62,6 @@ class DocType(BuyingController): self.validate_for_subcontracting() self.update_raw_materials_supplied("po_raw_material_details") - def validate_fiscal_year(self): - get_obj(dt = 'Purchase Common').validate_fiscal_year(self.doc.fiscal_year,self.doc.transaction_date,'PO Date') - def validate_with_previous_doc(self): super(DocType, self).validate_with_previous_doc(self.tname, { "Supplier Quotation": { @@ -157,27 +163,18 @@ class DocType(BuyingController): purchase_controller = webnotes.get_obj("Purchase Common") purchase_controller.is_item_table_empty(self) - # Step 1 :=> Update Previous Doc i.e. update pending_qty and Status accordingly - purchase_controller.update_prevdoc_detail(self, is_submit = 1) - - # Step 2 :=> Update Bin + self.update_prevdoc_status() self.update_bin(is_submit = 1, is_stopped = 0) - # Step 3 :=> Check For Approval Authority - get_obj('Authorization Control').validate_approving_authority(self.doc.doctype, self.doc.company, self.doc.grand_total) + get_obj('Authorization Control').validate_approving_authority(self.doc.doctype, + self.doc.company, self.doc.grand_total) - # Step 5 :=> Update last purchase rate purchase_controller.update_last_purchase_rate(self, is_submit = 1) - - # Step 6 :=> Set Status + webnotes.conn.set(self.doc,'status','Submitted') def on_cancel(self): - pc_obj = get_obj(dt = 'Purchase Common') - - # Check if PO status is stopped - pc_obj.check_for_stopped_status(cstr(self.doc.doctype), cstr(self.doc.name)) - + pc_obj = get_obj(dt = 'Purchase Common') self.check_for_stopped_status(pc_obj) # Check if Purchase Receipt has been submitted against current Purchase Order @@ -190,7 +187,7 @@ class DocType(BuyingController): raise Exception webnotes.conn.set(self.doc,'status','Cancelled') - pc_obj.update_prevdoc_detail(self,is_submit = 0) + self.update_prevdoc_status() self.update_bin( is_submit = 0, is_stopped = 0) pc_obj.update_last_purchase_rate(self, is_submit = 0) diff --git a/buying/doctype/purchase_order/test_purchase_order.py b/buying/doctype/purchase_order/test_purchase_order.py index f1cf34d9eb..2c354b52b1 100644 --- a/buying/doctype/purchase_order/test_purchase_order.py +++ b/buying/doctype/purchase_order/test_purchase_order.py @@ -32,7 +32,7 @@ class TestPurchaseOrder(unittest.TestCase): po = webnotes.bean("Purchase Order", po.doc.name) po.submit() pr = make_purchase_receipt(po.doc.name) - pr[0]["supplier_warehouse"] = "_Test Warehouse 1" + pr[0]["supplier_warehouse"] = "_Test Warehouse 1 - _TC" self.assertEquals(pr[0]["doctype"], "Purchase Receipt") self.assertEquals(len(pr), len(test_records[0])) @@ -100,7 +100,7 @@ test_records = [ "qty": 10.0, "import_rate": 500.0, "amount": 5000.0, - "warehouse": "_Test Warehouse", + "warehouse": "_Test Warehouse - _TC", "stock_uom": "Nos", "uom": "_Test UOM", "schedule_date": "2013-03-01" diff --git a/buying/doctype/supplier_quotation/supplier_quotation.py b/buying/doctype/supplier_quotation/supplier_quotation.py index 3e177a1d31..128cee2d65 100644 --- a/buying/doctype/supplier_quotation/supplier_quotation.py +++ b/buying/doctype/supplier_quotation/supplier_quotation.py @@ -34,7 +34,6 @@ class DocType(BuyingController): utilities.validate_status(self.doc.status, ["Draft", "Submitted", "Stopped", "Cancelled"]) - self.validate_fiscal_year() self.validate_common() self.validate_with_previous_doc() @@ -49,10 +48,6 @@ class DocType(BuyingController): def on_trash(self): pass - - def validate_fiscal_year(self): - get_obj(dt = 'Purchase Common').validate_fiscal_year( \ - self.doc.fiscal_year, self.doc.transaction_date, 'Quotation Date') def validate_with_previous_doc(self): super(DocType, self).validate_with_previous_doc(self.tname, { diff --git a/buying/doctype/supplier_quotation/test_supplier_quotation.py b/buying/doctype/supplier_quotation/test_supplier_quotation.py index 813b2f85b3..0615d6275f 100644 --- a/buying/doctype/supplier_quotation/test_supplier_quotation.py +++ b/buying/doctype/supplier_quotation/test_supplier_quotation.py @@ -70,7 +70,7 @@ test_records = [ "qty": 10.0, "import_rate": 500.0, "amount": 5000.0, - "warehouse": "_Test Warehouse", + "warehouse": "_Test Warehouse - _TC", "uom": "_Test UOM", } ], diff --git a/controllers/accounts_controller.py b/controllers/accounts_controller.py index 41b033bb0f..70151a6e3e 100644 --- a/controllers/accounts_controller.py +++ b/controllers/accounts_controller.py @@ -19,7 +19,7 @@ import webnotes from webnotes import _, msgprint from webnotes.utils import flt, cint, today from setup.utils import get_company_currency, get_price_list_currency -from accounts.utils import get_fiscal_year +from accounts.utils import get_fiscal_year, validate_fiscal_year from utilities.transaction_base import TransactionBase, validate_conversion_rate import json @@ -27,6 +27,8 @@ class AccountsController(TransactionBase): def validate(self): self.set_missing_values(for_validate=True) + self.validate_date_with_fiscal_year() + if self.meta.get_field("currency"): self.company_currency = get_company_currency(self.doc.company) @@ -43,6 +45,18 @@ class AccountsController(TransactionBase): self.doc.fields[fieldname] = today() if not self.doc.fiscal_year: self.doc.fiscal_year = get_fiscal_year(self.doc.fields[fieldname])[0] + + def validate_date_with_fiscal_year(self): + if self.meta.get_field("fiscal_year") : + date_field = "" + if self.meta.get_field("posting_date"): + date_field = "posting_date" + elif self.meta.get_field("transaction_date"): + date_field = "transaction_date" + + if date_field and self.doc.fields[date_field]: + validate_fiscal_year(self.doc.fields[date_field], self.doc.fiscal_year, + label=self.meta.get_label(date_field)) def set_price_list_currency(self, buying_or_selling): # TODO - change this, since price list now has only one currency allowed diff --git a/controllers/queries.py b/controllers/queries.py index e397420e3e..ab2e234f18 100644 --- a/controllers/queries.py +++ b/controllers/queries.py @@ -16,7 +16,6 @@ from __future__ import unicode_literals import webnotes -from webnotes.utils import cstr def get_filters_cond(doctype, filters, conditions): if filters: @@ -202,7 +201,7 @@ def bom(doctype, txt, searchfield, start, page_len, filters): from tabBOM where tabBOM.docstatus=1 and tabBOM.is_active=1 - and tabBOM.%(key)s like "%s" + and tabBOM.%(key)s like "%(txt)s" %(fcond)s %(mcond)s limit %(start)s, %(page_len)s """ % {'key': searchfield, 'txt': "%%%s%%" % txt, 'fcond': get_filters_cond(doctype, filters, conditions), diff --git a/hr/doctype/expense_claim/expense_claim.py b/hr/doctype/expense_claim/expense_claim.py index 0564d1d085..9317f87b8c 100644 --- a/hr/doctype/expense_claim/expense_claim.py +++ b/hr/doctype/expense_claim/expense_claim.py @@ -17,12 +17,8 @@ from __future__ import unicode_literals import webnotes -from webnotes.utils import add_days from webnotes.model.bean import getlist -from webnotes import form, msgprint -from webnotes.model.code import get_obj - -sql = webnotes.conn.sql +from webnotes import msgprint class DocType: def __init__(self, doc, doclist=[]): @@ -30,8 +26,6 @@ class DocType: self.doclist = doclist def validate(self): - # if self.doc.exp_approver == self.doc.owner: - # webnotes.msgprint("""Self Approval is not allowed.""", raise_exception=1) self.validate_fiscal_year() self.validate_exp_details() @@ -41,12 +35,8 @@ class DocType: 'Rejected' before submitting""", raise_exception=1) def validate_fiscal_year(self): - fy=sql("select year_start_date from `tabFiscal Year` where name='%s'"%self.doc.fiscal_year) - ysd=fy and fy[0][0] or "" - yed=add_days(str(ysd),365) - if str(self.doc.posting_date) < str(ysd) or str(self.doc.posting_date) > str(yed): - msgprint("Posting Date is not within the Fiscal Year selected") - raise Exception + from accounts.utils import validate_fiscal_year + validate_fiscal_year(self.doc.posting_date, self.doc.fiscal_year, "Posting Date") def validate_exp_details(self): if not getlist(self.doclist, 'expense_voucher_details'): diff --git a/manufacturing/doctype/bom/bom.js b/manufacturing/doctype/bom/bom.js index acb770d2f1..276e883f81 100644 --- a/manufacturing/doctype/bom/bom.js +++ b/manufacturing/doctype/bom/bom.js @@ -172,7 +172,7 @@ cur_frm.fields_dict['item'].get_query = function(doc) { return{ query:"controllers.queries.item_query", filters:{ - 'has_serial_no': 'Yes' + 'is_manufactured_item': 'Yes' } } } diff --git a/manufacturing/doctype/production_order/production_order.py b/manufacturing/doctype/production_order/production_order.py index 2d5b5fa3c5..95a82720cd 100644 --- a/manufacturing/doctype/production_order/production_order.py +++ b/manufacturing/doctype/production_order/production_order.py @@ -17,7 +17,7 @@ from __future__ import unicode_literals import webnotes -from webnotes.utils import cstr, flt, now, nowdate +from webnotes.utils import cstr, flt, nowdate from webnotes.model.code import get_obj from webnotes import msgprint @@ -65,6 +65,7 @@ class DocType: where production_item = %s and sales_order = %s and docstatus < 2""", (self.doc.production_item, self.doc.sales_order))[0][0] + total_qty = flt(ordered_qty_against_so) + flt(self.doc.qty) # get qty from Sales Order Item table so_item_qty = webnotes.conn.sql("""select sum(qty) from `tabSales Order Item` @@ -77,12 +78,12 @@ class DocType: # total qty in SO so_qty = flt(so_item_qty) + flt(dnpi_qty) - if ordered_qty_against_so > so_qty: + if total_qty > so_qty: webnotes.msgprint("""Total production order qty for item: %s against sales order: %s \ will be %s, which is greater than sales order qty (%s). Please reduce qty or remove the item.""" % (self.doc.production_item, self.doc.sales_order, - ordered_qty_against_so, so_qty), raise_exception=1) + total_qty, so_qty), raise_exception=1) def stop_unstop(self, status): diff --git a/manufacturing/doctype/production_order/production_order.txt b/manufacturing/doctype/production_order/production_order.txt index 5e665e7ef1..6e5e379a11 100644 --- a/manufacturing/doctype/production_order/production_order.txt +++ b/manufacturing/doctype/production_order/production_order.txt @@ -2,7 +2,7 @@ { "creation": "2013-01-10 16:34:16", "docstatus": 0, - "modified": "2013-07-05 14:51:12", + "modified": "2013-07-11 15:51:37", "modified_by": "Administrator", "owner": "Administrator" }, @@ -35,7 +35,6 @@ "permlevel": 0, "read": 1, "report": 1, - "role": "Manufacturing User", "submit": 1, "write": 1 }, @@ -248,6 +247,15 @@ "read_only": 1 }, { - "doctype": "DocPerm" + "doctype": "DocPerm", + "role": "System Manager" + }, + { + "doctype": "DocPerm", + "role": "Manufacturing Manager" + }, + { + "doctype": "DocPerm", + "role": "Manufacturing User" } ] \ No newline at end of file diff --git a/selling/doctype/installation_note/installation_note.py b/selling/doctype/installation_note/installation_note.py index 951f8619cb..a91db0ed5c 100644 --- a/selling/doctype/installation_note/installation_note.py +++ b/selling/doctype/installation_note/installation_note.py @@ -60,8 +60,8 @@ class DocType(TransactionBase): " delivery note details have already been pulled", raise_exception=1) def validate_fiscal_year(self): - get_obj('Sales Common').validate_fiscal_year(self.doc.fiscal_year, self.doc.inst_date, - 'Installation Date') + from accounts.utils import validate_fiscal_year + validate_fiscal_year(self.doc.inst_date, self.doc.fiscal_year, "Installation Date") def is_serial_no_added(self, item_code, serial_no): ar_required = webnotes.conn.get_value("Item", item_code, "has_serial_no") diff --git a/selling/doctype/lead/lead.py b/selling/doctype/lead/lead.py index 79b296b401..4ec213c7ae 100644 --- a/selling/doctype/lead/lead.py +++ b/selling/doctype/lead/lead.py @@ -99,7 +99,7 @@ class DocType(SellingController): @webnotes.whitelist() def make_customer(source_name, target_doclist=None): - _make_customer(source_name, target_doclist) + return _make_customer(source_name, target_doclist) def _make_customer(source_name, target_doclist=None, ignore_permissions=False): from webnotes.model.mapper import get_mapped_doclist diff --git a/selling/doctype/opportunity/opportunity.py b/selling/doctype/opportunity/opportunity.py index 92d391b2de..fe4042b6c8 100644 --- a/selling/doctype/opportunity/opportunity.py +++ b/selling/doctype/opportunity/opportunity.py @@ -17,7 +17,7 @@ from __future__ import unicode_literals import webnotes -from webnotes.utils import add_days, cstr, getdate, cint +from webnotes.utils import cstr, getdate, cint from webnotes.model.bean import getlist from webnotes import msgprint @@ -129,14 +129,6 @@ class DocType(TransactionBase): msgprint("Please select items for which enquiry needs to be made") raise Exception - def validate_fiscal_year(self): - fy=sql("select year_start_date from `tabFiscal Year` where name='%s'"%self.doc.fiscal_year) - ysd=fy and fy[0][0] or "" - yed=add_days(str(ysd),365) - if str(self.doc.transaction_date) < str(ysd) or str(self.doc.transaction_date) > str(yed): - msgprint("Opportunity Date is not within the Fiscal Year selected") - raise Exception - def validate_lead_cust(self): if self.doc.enquiry_from == 'Lead' and not self.doc.lead: msgprint("Lead Id is mandatory if 'Opportunity From' is selected as Lead", raise_exception=1) @@ -144,11 +136,13 @@ class DocType(TransactionBase): msgprint("Customer is mandatory if 'Opportunity From' is selected as Customer", raise_exception=1) def validate(self): - self.validate_fiscal_year() self.set_last_contact_date() self.validate_item_details() self.validate_lead_cust() + from accounts.utils import validate_fiscal_year + validate_fiscal_year(self.doc.transaction_date, self.doc.fiscal_year, "Opportunity Date") + if not self.doc.status: self.doc.status = "Draft" diff --git a/selling/doctype/quotation/quotation.py b/selling/doctype/quotation/quotation.py index 6020c933e5..ee4975d469 100644 --- a/selling/doctype/quotation/quotation.py +++ b/selling/doctype/quotation/quotation.py @@ -75,11 +75,6 @@ class DocType(SellingController): def get_rate(self,arg): return get_obj('Sales Common').get_rate(arg) - # Fiscal Year Validation - # ---------------------- - def validate_fiscal_year(self): - get_obj('Sales Common').validate_fiscal_year(self.doc.fiscal_year,self.doc.transaction_date,'Quotation Date') - # Does not allow same item code to be entered twice # ------------------------------------------------- def validate_for_items(self): @@ -137,7 +132,6 @@ class DocType(SellingController): utilities.validate_status(self.doc.status, ["Draft", "Submitted", "Order Confirmed", "Order Lost", "Cancelled"]) - self.validate_fiscal_year() self.set_last_contact_date() self.validate_order_type() self.validate_for_items() @@ -245,10 +239,6 @@ def _make_sales_order(source_name, target_doclist=None, ignore_permissions=False doclist = get_mapped_doclist("Quotation", source_name, { "Quotation": { "doctype": "Sales Order", - "field_map": { - "name": "quotation_no", - "transaction_date": "quotation_date" - }, "validation": { "docstatus": ["=", 1] } diff --git a/selling/doctype/sales_common/sales_common.py b/selling/doctype/sales_common/sales_common.py index 00825bb265..ab5cd0a274 100644 --- a/selling/doctype/sales_common/sales_common.py +++ b/selling/doctype/sales_common/sales_common.py @@ -17,7 +17,7 @@ from __future__ import unicode_literals import webnotes -from webnotes.utils import cint, cstr, flt, getdate, nowdate +from webnotes.utils import cint, cstr, flt from webnotes.model.doc import addchild from webnotes.model.bean import getlist from webnotes.model.code import get_obj @@ -30,26 +30,9 @@ from utilities.transaction_base import TransactionBase class DocType(TransactionBase): def __init__(self,d,dl): - self.doc, self.doclist = d,dl + self.doc, self.doclist = d, dl - self.doctype_dict = { - 'Sales Order' : 'Sales Order Item', - 'Delivery Note' : 'Delivery Note Item', - 'Sales Invoice':'Sales Invoice Item', - 'Installation Note' : 'Installation Note Item' - } - - self.ref_doctype_dict= {} - self.next_dt_detail = { - 'delivered_qty' : 'Delivery Note Item', - 'billed_qty' : 'Sales Invoice Item', - 'installed_qty' : 'Installation Note Item'} - - self.msg = [] - - # Get customer's contact person details - # ============================================================== def get_contact_details(self, obj = '', primary = 0): cond = " and contact_name = '"+cstr(obj.doc.contact_person)+"'" if primary: cond = " and is_primary_contact = 'Yes'" @@ -64,15 +47,11 @@ class DocType(TransactionBase): if c['contact_address']: obj.doc.customer_address = c['contact_address'] - - # get invoice details - # ==================== def get_invoice_details(self, obj = ''): if obj.doc.company: acc_head = webnotes.conn.sql("select name from `tabAccount` where name = '%s' and docstatus != 2" % (cstr(obj.doc.customer) + " - " + webnotes.conn.get_value('Company', obj.doc.company, 'abbr'))) obj.doc.debit_to = acc_head and acc_head[0][0] or '' -#---------------------------------------- Get Tax Details -------------------------------# def get_tax_details(self, item_code, obj): import json tax = webnotes.conn.sql("select tax_type, tax_rate from `tabItem Tax` where parent = %s" , item_code) @@ -83,8 +62,6 @@ class DocType(TransactionBase): } return ret - # Get Serial No Details - # ========================================================================== def get_serial_details(self, serial_no, obj): import json item = webnotes.conn.sql("select item_code, make, label,brand, description from `tabSerial No` where name = '%s' and docstatus != 2" %(serial_no), as_dict=1) @@ -339,8 +316,6 @@ class DocType(TransactionBase): webnotes.conn.set_value("Item", d.item_code, "default_income_account", d.income_account) -# ************************************************************************************************************************************************** - def check_credit(self,obj,grand_total): acc_head = webnotes.conn.sql("select name from `tabAccount` where company = '%s' and master_name = '%s'"%(obj.doc.company, obj.doc.customer)) if acc_head: @@ -352,10 +327,6 @@ class DocType(TransactionBase): exact_outstanding = flt(tot_outstanding) + flt(grand_total) get_obj('Account',acc_head[0][0]).check_credit_limit(acc_head[0][0], obj.doc.company, exact_outstanding) - def validate_fiscal_year(self, fiscal_year, transaction_date, label): - import accounts.utils - accounts.utils.validate_fiscal_year(transaction_date, fiscal_year, label) - def get_prevdoc_date(self, obj): for d in getlist(obj.doclist, obj.fname): if d.prevdoc_doctype and d.prevdoc_docname: diff --git a/selling/doctype/sales_order/sales_order.py b/selling/doctype/sales_order/sales_order.py index a65490b80b..38f7d7ba56 100644 --- a/selling/doctype/sales_order/sales_order.py +++ b/selling/doctype/sales_order/sales_order.py @@ -56,9 +56,6 @@ class DocType(SellingController): def get_rate(self,arg): return get_obj('Sales Common').get_rate(arg) - def validate_fiscal_year(self): - get_obj('Sales Common').validate_fiscal_year(self.doc.fiscal_year,self.doc.transaction_date,'Sales Order Date') - def validate_mandatory(self): # validate transaction date v/s delivery date if self.doc.delivery_date: @@ -156,7 +153,6 @@ class DocType(SellingController): def validate(self): super(DocType, self).validate() - self.validate_fiscal_year() self.validate_order_type() self.validate_delivery_date() self.validate_mandatory() @@ -398,7 +394,6 @@ def make_delivery_note(source_name, target_doclist=None): "Sales Order": { "doctype": "Delivery Note", "field_map": { - "name": "sales_order_no", "shipping_address": "address_display", "shipping_address_name": "customer_address", }, diff --git a/selling/doctype/sales_order/test_sales_order.py b/selling/doctype/sales_order/test_sales_order.py index f1579327e7..95f4be0cf2 100644 --- a/selling/doctype/sales_order/test_sales_order.py +++ b/selling/doctype/sales_order/test_sales_order.py @@ -303,7 +303,7 @@ test_records = [ "basic_rate": 100.0, "export_rate": 100.0, "amount": 1000.0, - "reserved_warehouse": "_Test Warehouse", + "reserved_warehouse": "_Test Warehouse - _TC", } ], ] \ No newline at end of file diff --git a/setup/doctype/company/test_company.py b/setup/doctype/company/test_company.py index 780605d4fc..e89731fe11 100644 --- a/setup/doctype/company/test_company.py +++ b/setup/doctype/company/test_company.py @@ -6,11 +6,13 @@ test_records = [ "company_name": "_Test Company", "abbr": "_TC", "default_currency": "INR", + "domain": "Manufacturing" }], [{ "doctype": "Company", "company_name": "_Test Company 1", "abbr": "_TC1", "default_currency": "USD", + "domain": "Retail" }], ] \ No newline at end of file diff --git a/setup/doctype/sales_person/test_sales_person.py b/setup/doctype/sales_person/test_sales_person.py index f4283de38c..86a268fdcb 100644 --- a/setup/doctype/sales_person/test_sales_person.py +++ b/setup/doctype/sales_person/test_sales_person.py @@ -3,21 +3,21 @@ test_records = [ [{ "doctype": "Sales Person", "sales_person_name": "_Test Sales Person", - "parent_sales_person": "All Sales Persons", + "parent_sales_person": "Sales Team", "is_group": "No", "employee": "_T-Employee-0001", }], [{ "doctype": "Sales Person", "sales_person_name": "_Test Sales Person 1", - "parent_sales_person": "All Sales Persons", + "parent_sales_person": "Sales Team", "is_group": "No", "employee": "_T-Employee-0002", }], [{ "doctype": "Sales Person", "sales_person_name": "_Test Sales Person 2", - "parent_sales_person": "All Sales Persons", + "parent_sales_person": "Sales Team", "is_group": "No", "employee": "_T-Employee-0003", }] diff --git a/stock/doctype/delivery_note/delivery_note.py b/stock/doctype/delivery_note/delivery_note.py index 6068da6f9a..502e30fa9f 100644 --- a/stock/doctype/delivery_note/delivery_note.py +++ b/stock/doctype/delivery_note/delivery_note.py @@ -50,10 +50,6 @@ class DocType(SellingController): 'keyword': 'Delivered' }] - def validate_fiscal_year(self): - get_obj('Sales Common').validate_fiscal_year(self.doc.fiscal_year,self.doc.posting_date,'Posting Date') - - def get_contact_details(self): return get_obj('Sales Common').get_contact_details(self,0) @@ -104,7 +100,6 @@ class DocType(SellingController): utilities.validate_status(self.doc.status, ["Draft", "Submitted", "Cancelled"]) self.so_required() - self.validate_fiscal_year() self.validate_proj_cust() sales_com_obj = get_obj(dt = 'Sales Common') sales_com_obj.check_stop_sales_order(self) @@ -122,7 +117,6 @@ class DocType(SellingController): self.validate_with_previous_doc() self.doc.status = 'Draft' - if not self.doc.billing_status: self.doc.billing_status = 'Not Billed' if not self.doc.installation_status: self.doc.installation_status = 'Not Installed' def validate_with_previous_doc(self): diff --git a/stock/doctype/delivery_note/test_delivery_note.py b/stock/doctype/delivery_note/test_delivery_note.py index e7e66ed30a..f4b9bbb276 100644 --- a/stock/doctype/delivery_note/test_delivery_note.py +++ b/stock/doctype/delivery_note/test_delivery_note.py @@ -140,7 +140,7 @@ test_records = [ "basic_rate": 100.0, "export_rate": 100.0, "amount": 500.0, - "warehouse": "_Test Warehouse", + "warehouse": "_Test Warehouse - _TC", "stock_uom": "No." } ] diff --git a/stock/doctype/item/test_item.py b/stock/doctype/item/test_item.py index 042363dc31..0ea8a5d398 100644 --- a/stock/doctype/item/test_item.py +++ b/stock/doctype/item/test_item.py @@ -19,6 +19,7 @@ import unittest import webnotes test_ignore = ["BOM"] +test_dependencies = ["Warehouse"] class TestItem(unittest.TestCase): def test_duplicate_price_list(self): @@ -41,7 +42,6 @@ class TestItem(unittest.TestCase): item.doc.is_stock_item = "Yes" item.doc.default_warehouse = None self.assertRaises(WarehouseNotSet, item.insert) - test_records = [ [{ @@ -63,11 +63,11 @@ test_records = [ "is_sub_contracted_item": "No", "stock_uom": "_Test UOM", "default_income_account": "Sales - _TC", - "default_warehouse": "_Test Warehouse", + "default_warehouse": "_Test Warehouse - _TC", }, { "doctype": "Item Reorder", "parentfield": "item_reorder", - "warehouse": "_Test Warehouse", + "warehouse": "_Test Warehouse - _TC", "warehouse_reorder_level": 20, "warehouse_reorder_qty": 20, "material_request_type": "Purchase" @@ -86,7 +86,7 @@ test_records = [ "item_name": "_Test Item Home Desktop 100", "description": "_Test Item Home Desktop 100", "item_group": "_Test Item Group Desktops", - "default_warehouse": "_Test Warehouse", + "default_warehouse": "_Test Warehouse - _TC", "default_income_account": "Sales - _TC", "is_stock_item": "Yes", "is_asset_item": "No", @@ -112,7 +112,7 @@ test_records = [ "item_name": "_Test Item Home Desktop 200", "description": "_Test Item Home Desktop 200", "item_group": "_Test Item Group Desktops", - "default_warehouse": "_Test Warehouse", + "default_warehouse": "_Test Warehouse - _TC", "default_income_account": "Sales - _TC", "is_stock_item": "Yes", "is_asset_item": "No", @@ -154,7 +154,7 @@ test_records = [ "description": "_Test FG Item", "item_group": "_Test Item Group Desktops", "is_stock_item": "Yes", - "default_warehouse": "_Test Warehouse", + "default_warehouse": "_Test Warehouse - _TC", "default_income_account": "Sales - _TC", "is_asset_item": "No", "has_batch_no": "No", @@ -194,7 +194,7 @@ test_records = [ "description": "_Test Serialized Item", "item_group": "_Test Item Group Desktops", "is_stock_item": "Yes", - "default_warehouse": "_Test Warehouse", + "default_warehouse": "_Test Warehouse - _TC", "is_asset_item": "No", "has_batch_no": "No", "has_serial_no": "Yes", diff --git a/stock/doctype/material_request/material_request.py b/stock/doctype/material_request/material_request.py index 71a9e13386..0830fd451d 100644 --- a/stock/doctype/material_request/material_request.py +++ b/stock/doctype/material_request/material_request.py @@ -24,8 +24,6 @@ class DocType(BuyingController): def check_if_already_pulled(self): pass#if self.[d.sales_order_no for d in getlist(self.doclist, 'indent_details')] - # Validate so items - # ---------------------------- def validate_qty_against_so(self): so_items = {} # Format --> {'SO/00001': {'Item/001': 120, 'Item/002': 24}} for d in getlist(self.doclist, 'indent_details'): @@ -49,14 +47,6 @@ class DocType(BuyingController): if flt(so_items[so_no][item]) + already_indented > actual_so_qty: msgprint("You can raise indent of maximum qty: %s for item: %s against sales order: %s\n Anyway, you can add more qty in new row for the same item." % (actual_so_qty - already_indented, item, so_no), raise_exception=1) - - # Validate fiscal year - # ---------------------------- - def validate_fiscal_year(self): - get_obj(dt = 'Purchase Common').validate_fiscal_year(self.doc.fiscal_year,self.doc.transaction_date,'Material Request Date') - - # Validate Schedule Date - #-------------------------------- def validate_schedule_date(self): #:::::::: validate schedule date v/s indent date :::::::::::: for d in getlist(self.doclist, 'indent_details'): @@ -70,7 +60,6 @@ class DocType(BuyingController): super(DocType, self).validate() self.validate_schedule_date() - self.validate_fiscal_year() if not self.doc.status: self.doc.status = "Draft" diff --git a/stock/doctype/material_request/test_material_request.py b/stock/doctype/material_request/test_material_request.py index 2dbc748ec8..f98dc54d15 100644 --- a/stock/doctype/material_request/test_material_request.py +++ b/stock/doctype/material_request/test_material_request.py @@ -63,9 +63,9 @@ class TestMaterialRequest(unittest.TestCase): def _test_requested_qty(self, qty1, qty2): self.assertEqual(flt(webnotes.conn.get_value("Bin", {"item_code": "_Test Item Home Desktop 100", - "warehouse": "_Test Warehouse"}, "indented_qty")), qty1) + "warehouse": "_Test Warehouse - _TC"}, "indented_qty")), qty1) self.assertEqual(flt(webnotes.conn.get_value("Bin", {"item_code": "_Test Item Home Desktop 200", - "warehouse": "_Test Warehouse"}, "indented_qty")), qty2) + "warehouse": "_Test Warehouse - _TC"}, "indented_qty")), qty2) def _insert_stock_entry(self, qty1, qty2): se = webnotes.bean([ @@ -87,7 +87,7 @@ class TestMaterialRequest(unittest.TestCase): "stock_uom": "_Test UOM", "transfer_qty": qty1, "uom": "_Test UOM", - "t_warehouse": "_Test Warehouse 1", + "t_warehouse": "_Test Warehouse 1 - _TC", }, { "conversion_factor": 1.0, @@ -99,7 +99,7 @@ class TestMaterialRequest(unittest.TestCase): "stock_uom": "_Test UOM", "transfer_qty": qty2, "uom": "_Test UOM", - "t_warehouse": "_Test Warehouse 1", + "t_warehouse": "_Test Warehouse 1 - _TC", }, ]) se.insert() @@ -148,7 +148,7 @@ class TestMaterialRequest(unittest.TestCase): po.cancel() # check if per complete is as expected mr.load_from_db() - self._test_expected(mr.doclist, [{"per_ordered": 0}, {"ordered_qty": 0}, {"ordered_qty": 0}]) + self._test_expected(mr.doclist, [{"per_ordered": None}, {"ordered_qty": None}, {"ordered_qty": None}]) self._test_requested_qty(54.0, 3.0) def test_completed_qty_for_transfer(self): @@ -178,13 +178,13 @@ class TestMaterialRequest(unittest.TestCase): se_doclist[1].update({ "qty": 27.0, "transfer_qty": 27.0, - "s_warehouse": "_Test Warehouse 1", + "s_warehouse": "_Test Warehouse 1 - _TC", "incoming_rate": 1.0 }) se_doclist[2].update({ "qty": 1.5, "transfer_qty": 1.5, - "s_warehouse": "_Test Warehouse 1", + "s_warehouse": "_Test Warehouse 1 - _TC", "incoming_rate": 1.0 }) @@ -241,13 +241,13 @@ class TestMaterialRequest(unittest.TestCase): se_doclist[1].update({ "qty": 60.0, "transfer_qty": 60.0, - "s_warehouse": "_Test Warehouse 1", + "s_warehouse": "_Test Warehouse 1 - _TC", "incoming_rate": 1.0 }) se_doclist[2].update({ "qty": 3.0, "transfer_qty": 3.0, - "s_warehouse": "_Test Warehouse 1", + "s_warehouse": "_Test Warehouse 1 - _TC", "incoming_rate": 1.0 }) @@ -296,14 +296,14 @@ class TestMaterialRequest(unittest.TestCase): se_doclist[1].update({ "qty": 60.0, "transfer_qty": 60.0, - "s_warehouse": "_Test Warehouse", - "t_warehouse": "_Test Warehouse 1", + "s_warehouse": "_Test Warehouse - _TC", + "t_warehouse": "_Test Warehouse 1 - _TC", "incoming_rate": 1.0 }) se_doclist[2].update({ "qty": 3.0, "transfer_qty": 3.0, - "s_warehouse": "_Test Warehouse 1", + "s_warehouse": "_Test Warehouse 1 - _TC", "incoming_rate": 1.0 }) @@ -336,7 +336,7 @@ test_records = [ "qty": 54.0, "schedule_date": "2013-02-18", "uom": "_Test UOM", - "warehouse": "_Test Warehouse" + "warehouse": "_Test Warehouse - _TC" }, { "description": "_Test Item Home Desktop 200", @@ -347,7 +347,7 @@ test_records = [ "qty": 3.0, "schedule_date": "2013-02-19", "uom": "_Test UOM", - "warehouse": "_Test Warehouse" + "warehouse": "_Test Warehouse - _TC" } ], ] \ No newline at end of file diff --git a/stock/doctype/purchase_receipt/purchase_receipt.py b/stock/doctype/purchase_receipt/purchase_receipt.py index 59c6c32d32..0ec73361c6 100644 --- a/stock/doctype/purchase_receipt/purchase_receipt.py +++ b/stock/doctype/purchase_receipt/purchase_receipt.py @@ -45,9 +45,6 @@ class DocType(BuyingController): 'percent_join_field': 'prevdoc_docname', }] - def validate_fiscal_year(self): - get_obj(dt = 'Purchase Common').validate_fiscal_year(self.doc.fiscal_year,self.doc.posting_date,'Transaction Date') - # get available qty at warehouse def get_bin_details(self, arg = ''): return get_obj(dt='Purchase Common').get_bin_details(arg) @@ -120,7 +117,6 @@ class DocType(BuyingController): super(DocType, self).validate() self.po_required() - self.validate_fiscal_year() if not self.doc.status: self.doc.status = "Draft" diff --git a/stock/doctype/purchase_receipt/test_purchase_receipt.py b/stock/doctype/purchase_receipt/test_purchase_receipt.py index 377f91d831..b7e27a1773 100644 --- a/stock/doctype/purchase_receipt/test_purchase_receipt.py +++ b/stock/doctype/purchase_receipt/test_purchase_receipt.py @@ -120,7 +120,7 @@ test_records = [ "rejected_qty": 0.0, "import_rate": 50.0, "amount": 500.0, - "warehouse": "_Test Warehouse", + "warehouse": "_Test Warehouse - _TC", "stock_uom": "Nos", "uom": "_Test UOM", }, @@ -168,7 +168,7 @@ test_records = [ "posting_date": "2013-02-12", "posting_time": "15:33:30", "is_subcontracted": "Yes", - "supplier_warehouse": "_Test Warehouse", + "supplier_warehouse": "_Test Warehouse - _TC", "supplier": "_Test Supplier", "net_total": 5000.0, "grand_total": 5000.0, @@ -185,7 +185,7 @@ test_records = [ "rejected_qty": 0.0, "import_rate": 500.0, "amount": 5000.0, - "warehouse": "_Test Warehouse", + "warehouse": "_Test Warehouse - _TC", "stock_uom": "Nos", "uom": "_Test UOM", } diff --git a/stock/doctype/serial_no/test_serial_no.py b/stock/doctype/serial_no/test_serial_no.py index 8ffaabcb10..58f6226943 100644 --- a/stock/doctype/serial_no/test_serial_no.py +++ b/stock/doctype/serial_no/test_serial_no.py @@ -22,7 +22,7 @@ class TestSerialNo(unittest.TestCase): where voucher_type = 'Serial No' and voucher_no = %s""", sr.doc.name, as_dict=1)[0] self.assertTrue(sle) self.assertEquals([sle.item_code, sle.warehouse, sle.actual_qty], - ["_Test Serialized Item", "_Test Warehouse", 1.0]) + ["_Test Serialized Item", "_Test Warehouse - _TC", 1.0]) # check gl entries gl_entries = webnotes.conn.sql("""select account, debit, credit @@ -92,7 +92,7 @@ test_records = [ "status": "In Store", "item_code": "_Test Serialized Item", "item_group": "_Test Item Group", - "warehouse": "_Test Warehouse", + "warehouse": "_Test Warehouse - _TC", "purchase_rate": 1000.0, "purchase_time": "11:37:39", "purchase_date": "2013-02-26", diff --git a/stock/doctype/stock_entry/test_stock_entry.py b/stock/doctype/stock_entry/test_stock_entry.py index fb045ced7e..9ff957d245 100644 --- a/stock/doctype/stock_entry/test_stock_entry.py +++ b/stock/doctype/stock_entry/test_stock_entry.py @@ -39,7 +39,7 @@ class TestStockEntry(unittest.TestCase): def test_warehouse_company_validation(self): from stock.doctype.stock_ledger_entry.stock_ledger_entry import InvalidWarehouseCompany st1 = webnotes.bean(copy=test_records[0]) - st1.doclist[1].t_warehouse="_Test Warehouse 2" + st1.doclist[1].t_warehouse="_Test Warehouse 2 - _TC1" st1.insert() self.assertRaises(InvalidWarehouseCompany, st1.submit) @@ -55,7 +55,7 @@ class TestStockEntry(unittest.TestCase): "stock_in_hand_account") self.check_stock_ledger_entries("Stock Entry", mr.doc.name, - [["_Test Item", "_Test Warehouse", 50.0]]) + [["_Test Item", "_Test Warehouse - _TC", 50.0]]) self.check_gl_entries("Stock Entry", mr.doc.name, sorted([ @@ -66,8 +66,8 @@ class TestStockEntry(unittest.TestCase): mr.cancel() self.check_stock_ledger_entries("Stock Entry", mr.doc.name, - sorted([["_Test Item", "_Test Warehouse", 50.0], - ["_Test Item", "_Test Warehouse", -50.0]])) + sorted([["_Test Item", "_Test Warehouse - _TC", 50.0], + ["_Test Item", "_Test Warehouse - _TC", -50.0]])) self.check_gl_entries("Stock Entry", mr.doc.name, sorted([ @@ -94,7 +94,7 @@ class TestStockEntry(unittest.TestCase): "stock_in_hand_account") self.check_stock_ledger_entries("Stock Entry", mi.doc.name, - [["_Test Item", "_Test Warehouse", -40.0]]) + [["_Test Item", "_Test Warehouse - _TC", -40.0]]) self.check_gl_entries("Stock Entry", mi.doc.name, sorted([ @@ -106,8 +106,8 @@ class TestStockEntry(unittest.TestCase): mi.cancel() self.check_stock_ledger_entries("Stock Entry", mi.doc.name, - sorted([["_Test Item", "_Test Warehouse", -40.0], - ["_Test Item", "_Test Warehouse", 40.0]])) + sorted([["_Test Item", "_Test Warehouse - _TC", -40.0], + ["_Test Item", "_Test Warehouse - _TC", 40.0]])) self.check_gl_entries("Stock Entry", mi.doc.name, sorted([ @@ -131,7 +131,7 @@ class TestStockEntry(unittest.TestCase): mtn.submit() self.check_stock_ledger_entries("Stock Entry", mtn.doc.name, - [["_Test Item", "_Test Warehouse", -45.0], ["_Test Item", "_Test Warehouse 1", 45.0]]) + [["_Test Item", "_Test Warehouse - _TC", -45.0], ["_Test Item", "_Test Warehouse 1 - _TC", 45.0]]) # no gl entry gl_entries = webnotes.conn.sql("""select * from `tabGL Entry` @@ -140,10 +140,10 @@ class TestStockEntry(unittest.TestCase): mtn.cancel() self.check_stock_ledger_entries("Stock Entry", mtn.doc.name, - sorted([["_Test Item", "_Test Warehouse", 45.0], - ["_Test Item", "_Test Warehouse 1", -45.0], - ["_Test Item", "_Test Warehouse", -45.0], - ["_Test Item", "_Test Warehouse 1", 45.0]])) + sorted([["_Test Item", "_Test Warehouse - _TC", 45.0], + ["_Test Item", "_Test Warehouse 1 - _TC", -45.0], + ["_Test Item", "_Test Warehouse - _TC", -45.0], + ["_Test Item", "_Test Warehouse 1 - _TC", 45.0]])) # no gl entry gl_entries = webnotes.conn.sql("""select * from `tabGL Entry` @@ -196,7 +196,7 @@ class TestStockEntry(unittest.TestCase): def _get_actual_qty(self): return flt(webnotes.conn.get_value("Bin", {"item_code": "_Test Item", - "warehouse": "_Test Warehouse"}, "actual_qty")) + "warehouse": "_Test Warehouse - _TC"}, "actual_qty")) def _test_sales_invoice_return(self, item_code, delivered_qty, returned_qty): from stock.doctype.stock_entry.stock_entry import NotUpdateStockError @@ -224,7 +224,7 @@ class TestStockEntry(unittest.TestCase): # insert a pos invoice with update stock si = webnotes.bean(copy=sales_invoice_test_records[1]) si.doc.is_pos = si.doc.update_stock = 1 - si.doclist[1].warehouse = "_Test Warehouse" + si.doclist[1].warehouse = "_Test Warehouse - _TC" si.doclist[1].item_code = item_code si.doclist[1].qty = 5.0 si.insert() @@ -456,7 +456,7 @@ class TestStockEntry(unittest.TestCase): se.doc.posting_date = "2013-03-01" se.doc.fiscal_year = "_Test Fiscal Year 2013" se.doclist[1].qty = se.doclist[1].transfer_qty = 5 - se.doclist[1].s_warehouse = "_Test Warehouse" + se.doclist[1].s_warehouse = "_Test Warehouse - _TC" se.insert() se.submit() @@ -481,7 +481,7 @@ class TestStockEntry(unittest.TestCase): se.doc.posting_date = "2013-03-01" se.doc.fiscal_year = "_Test Fiscal Year 2013" se.doclist[1].qty = se.doclist[1].transfer_qty = 6 - se.doclist[1].s_warehouse = "_Test Warehouse" + se.doclist[1].s_warehouse = "_Test Warehouse - _TC" self.assertRaises(StockOverReturnError, se.insert) @@ -556,7 +556,7 @@ class TestStockEntry(unittest.TestCase): se.doc.posting_date = "2013-03-01" se.doc.fiscal_year = "_Test Fiscal Year 2013" se.doclist[1].qty = se.doclist[1].transfer_qty = 5 - se.doclist[1].s_warehouse = "_Test Warehouse" + se.doclist[1].s_warehouse = "_Test Warehouse - _TC" se.insert() se.submit() @@ -589,7 +589,7 @@ test_records = [ "stock_uom": "_Test UOM", "transfer_qty": 50.0, "uom": "_Test UOM", - "t_warehouse": "_Test Warehouse", + "t_warehouse": "_Test Warehouse - _TC", }, ], [ @@ -612,7 +612,7 @@ test_records = [ "stock_uom": "_Test UOM", "transfer_qty": 40.0, "uom": "_Test UOM", - "s_warehouse": "_Test Warehouse", + "s_warehouse": "_Test Warehouse - _TC", }, ], [ @@ -635,8 +635,8 @@ test_records = [ "stock_uom": "_Test UOM", "transfer_qty": 45.0, "uom": "_Test UOM", - "s_warehouse": "_Test Warehouse", - "t_warehouse": "_Test Warehouse 1", + "s_warehouse": "_Test Warehouse - _TC", + "t_warehouse": "_Test Warehouse 1 - _TC", } ] ] \ No newline at end of file diff --git a/stock/doctype/stock_reconciliation/test_stock_reconciliation.py b/stock/doctype/stock_reconciliation/test_stock_reconciliation.py index 1e7e716f1b..bcd98a9503 100644 --- a/stock/doctype/stock_reconciliation/test_stock_reconciliation.py +++ b/stock/doctype/stock_reconciliation/test_stock_reconciliation.py @@ -34,14 +34,14 @@ class TestStockReconciliation(unittest.TestCase): # check stock value res = webnotes.conn.sql("""select stock_value from `tabStock Ledger Entry` - where item_code = '_Test Item' and warehouse = '_Test Warehouse' + where item_code = '_Test Item' and warehouse = '_Test Warehouse - _TC' and posting_date = %s and posting_time = %s order by name desc limit 1""", (d[2], d[3])) self.assertEqual(res and flt(res[0][0]) or 0, d[4]) # check bin qty and stock value bin = webnotes.conn.sql("""select actual_qty, stock_value from `tabBin` - where item_code = '_Test Item' and warehouse = '_Test Warehouse'""") + where item_code = '_Test Item' and warehouse = '_Test Warehouse - _TC'""") self.assertEqual(bin and [flt(bin[0][0]), flt(bin[0][1])] or [], [d[5], d[6]]) @@ -79,7 +79,7 @@ class TestStockReconciliation(unittest.TestCase): # check stock value in sle res = webnotes.conn.sql("""select stock_value from `tabStock Ledger Entry` - where item_code = '_Test Item' and warehouse = '_Test Warehouse' + where item_code = '_Test Item' and warehouse = '_Test Warehouse - _TC' and posting_date = %s and posting_time = %s order by name desc limit 1""", (d[2], d[3])) @@ -87,7 +87,7 @@ class TestStockReconciliation(unittest.TestCase): # bin qty and stock value bin = webnotes.conn.sql("""select actual_qty, stock_value from `tabBin` - where item_code = '_Test Item' and warehouse = '_Test Warehouse'""") + where item_code = '_Test Item' and warehouse = '_Test Warehouse - _TC'""") self.assertEqual(bin and [flt(bin[0][0]), flt(bin[0][1], 4)] or [], [flt(d[5]), flt(d[6])]) @@ -183,7 +183,7 @@ class TestStockReconciliation(unittest.TestCase): "expense_account": "Stock Adjustment - _TC", "reconciliation_json": json.dumps([ ["Item Code", "Warehouse", "Quantity", "Valuation Rate"], - ["_Test Item", "_Test Warehouse", qty, rate] + ["_Test Item", "_Test Warehouse - _TC", qty, rate] ]), }]) stock_reco.insert() @@ -226,7 +226,7 @@ class TestStockReconciliation(unittest.TestCase): { "doctype": "Stock Ledger Entry", "__islocal": 1, "voucher_type": "Stock Entry", "voucher_no": "TEST", - "item_code": "_Test Item", "warehouse": "_Test Warehouse", + "item_code": "_Test Item", "warehouse": "_Test Warehouse - _TC", "posting_date": "2012-12-12", "posting_time": "01:00", "actual_qty": 20, "incoming_rate": 1000, "company": "_Test Company", "fiscal_year": "_Test Fiscal Year 2012", @@ -234,7 +234,7 @@ class TestStockReconciliation(unittest.TestCase): { "doctype": "Stock Ledger Entry", "__islocal": 1, "voucher_type": "Stock Entry", "voucher_no": "TEST", - "item_code": "_Test Item", "warehouse": "_Test Warehouse", + "item_code": "_Test Item", "warehouse": "_Test Warehouse - _TC", "posting_date": "2012-12-15", "posting_time": "02:00", "actual_qty": 10, "incoming_rate": 700, "company": "_Test Company", "fiscal_year": "_Test Fiscal Year 2012", @@ -242,7 +242,7 @@ class TestStockReconciliation(unittest.TestCase): { "doctype": "Stock Ledger Entry", "__islocal": 1, "voucher_type": "Stock Entry", "voucher_no": "TEST", - "item_code": "_Test Item", "warehouse": "_Test Warehouse", + "item_code": "_Test Item", "warehouse": "_Test Warehouse - _TC", "posting_date": "2012-12-25", "posting_time": "03:00", "actual_qty": -15, "company": "_Test Company", "fiscal_year": "_Test Fiscal Year 2012", @@ -250,7 +250,7 @@ class TestStockReconciliation(unittest.TestCase): { "doctype": "Stock Ledger Entry", "__islocal": 1, "voucher_type": "Stock Entry", "voucher_no": "TEST", - "item_code": "_Test Item", "warehouse": "_Test Warehouse", + "item_code": "_Test Item", "warehouse": "_Test Warehouse - _TC", "posting_date": "2012-12-31", "posting_time": "08:00", "actual_qty": -20, "company": "_Test Company", "fiscal_year": "_Test Fiscal Year 2012", @@ -258,7 +258,7 @@ class TestStockReconciliation(unittest.TestCase): { "doctype": "Stock Ledger Entry", "__islocal": 1, "voucher_type": "Stock Entry", "voucher_no": "TEST", - "item_code": "_Test Item", "warehouse": "_Test Warehouse", + "item_code": "_Test Item", "warehouse": "_Test Warehouse - _TC", "posting_date": "2013-01-05", "posting_time": "07:00", "actual_qty": 15, "incoming_rate": 1200, "company": "_Test Company", "fiscal_year": "_Test Fiscal Year 2013", diff --git a/stock/doctype/warehouse/warehouse.py b/stock/doctype/warehouse/warehouse.py index 1f9a32a588..69d9d06b85 100644 --- a/stock/doctype/warehouse/warehouse.py +++ b/stock/doctype/warehouse/warehouse.py @@ -17,7 +17,7 @@ from __future__ import unicode_literals import webnotes -from webnotes.utils import cstr, flt, validate_email_add +from webnotes.utils import flt, validate_email_add from webnotes.model.code import get_obj from webnotes import msgprint diff --git a/utilities/cleanup_data.py b/utilities/cleanup_data.py index db6d3ecdec..3a712cee9a 100644 --- a/utilities/cleanup_data.py +++ b/utilities/cleanup_data.py @@ -50,7 +50,7 @@ def delete_masters(): 'Supplier Type': ['Default Supplier Type'], 'Supplier': '', 'Serial No': '', - 'Sales Person': ['All Sales Persons'], + 'Sales Person': ['Sales Team'], 'Sales Partner': '', 'Sales BOM': '', 'Salary Structure': '',