Merge branch 'responsive' of github.com:webnotes/erpnext into responsive
Conflicts: accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.py
This commit is contained in:
commit
34736c8d87
@ -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()
|
||||
|
@ -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})
|
||||
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
|
||||
})
|
||||
|
@ -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",
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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",
|
||||
|
@ -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'") % {
|
||||
|
@ -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 ''
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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"
|
||||
|
@ -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, {
|
||||
|
@ -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",
|
||||
}
|
||||
],
|
||||
|
@ -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
|
||||
|
@ -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),
|
||||
|
@ -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'):
|
||||
|
@ -33,16 +33,12 @@ class DocType(TransactionBase):
|
||||
self.doc = doc
|
||||
self.doclist = doclist
|
||||
|
||||
|
||||
def autoname(self):
|
||||
self.doc.name = make_autoname('Sal Slip/' +self.doc.employee + '/.#####')
|
||||
|
||||
|
||||
def get_emp_and_leave_details(self):
|
||||
if self.doc.employee:
|
||||
self.get_leave_details()
|
||||
|
||||
# check sal structure
|
||||
struct = self.check_sal_struct()
|
||||
if struct:
|
||||
self.pull_sal_struct(struct)
|
||||
@ -91,16 +87,18 @@ class DocType(TransactionBase):
|
||||
where name = %s", self.doc.employee, as_dict=1)[0]
|
||||
|
||||
if emp['relieving_date']:
|
||||
if getdate(emp['relieving_date']) > m['month_start_date'] and getdate(emp['relieving_date']) < m['month_end_date']:
|
||||
payment_days = getdate(emp['relieving_date']).day
|
||||
if getdate(emp['relieving_date']) > m['month_start_date'] and \
|
||||
getdate(emp['relieving_date']) < m['month_end_date']:
|
||||
payment_days = getdate(emp['relieving_date']).day
|
||||
elif getdate(emp['relieving_date']) < m['month_start_date']:
|
||||
webnotes.msgprint(_("Relieving Date of employee is ") + cstr(emp['relieving_date']
|
||||
+ _(". Please set status of the employee as 'Left'")), raise_exception=1)
|
||||
|
||||
|
||||
if emp['date_of_joining']:
|
||||
if getdate(emp['date_of_joining']) > m['month_start_date'] and getdate(emp['date_of_joining']) < m['month_end_date']:
|
||||
payment_days = payment_days - getdate(emp['date_of_joining']).day + 1
|
||||
if getdate(emp['date_of_joining']) > m['month_start_date'] and \
|
||||
getdate(emp['date_of_joining']) < m['month_end_date']:
|
||||
payment_days = payment_days - getdate(emp['date_of_joining']).day + 1
|
||||
elif getdate(emp['date_of_joining']) > m['month_end_date']:
|
||||
payment_days = 0
|
||||
|
||||
@ -110,9 +108,16 @@ class DocType(TransactionBase):
|
||||
|
||||
|
||||
def calculate_lwp(self, m):
|
||||
holidays = sql("select t1.holiday_date from `tabHoliday` t1, tabEmployee t2 where t1.parent = t2.holiday_list and t2.name = '%s' and t1.holiday_date between '%s' and '%s'" % (self.doc.employee, m['month_start_date'], m['month_end_date']))
|
||||
holidays = sql("""select t1.holiday_date
|
||||
from `tabHoliday` t1, tabEmployee t2
|
||||
where t1.parent = t2.holiday_list and t2.name = %s
|
||||
and t1.holiday_date between %s and %s""",
|
||||
(self.doc.employee, m['month_start_date'], m['month_end_date']))
|
||||
if not holidays:
|
||||
holidays = sql("select t1.holiday_date from `tabHoliday` t1, `tabHoliday List` t2 where t1.parent = t2.name and ifnull(t2.is_default, 0) = 1 and t2.fiscal_year = '%s'" % self.doc.fiscal_year)
|
||||
holidays = sql("""select t1.holiday_date
|
||||
from `tabHoliday` t1, `tabHoliday List` t2
|
||||
where t1.parent = t2.name and ifnull(t2.is_default, 0) = 1
|
||||
and t2.fiscal_year = %s""", self.doc.fiscal_year)
|
||||
holidays = [cstr(i[0]) for i in holidays]
|
||||
lwp = 0
|
||||
for d in range(m['month_days']):
|
||||
@ -124,20 +129,22 @@ class DocType(TransactionBase):
|
||||
where t2.name = t1.leave_type
|
||||
and ifnull(t2.is_lwp, 0) = 1
|
||||
and t1.docstatus = 1
|
||||
and t1.employee = '%s'
|
||||
and '%s' between from_date and to_date
|
||||
"""%(self.doc.employee, dt))
|
||||
and t1.employee = %s
|
||||
and %s between from_date and to_date
|
||||
""", (self.doc.employee, dt))
|
||||
if leave:
|
||||
lwp = cint(leave[0][1]) and lwp + 0.5 or lwp + 1
|
||||
return lwp
|
||||
|
||||
|
||||
def check_existing(self):
|
||||
ret_exist = sql("select name from `tabSalary Slip` where month = '%s' and fiscal_year = '%s' and docstatus != 2 and employee = '%s' and name !='%s'" % (self.doc.month,self.doc.fiscal_year,self.doc.employee,self.doc.name))
|
||||
ret_exist = sql("""select name from `tabSalary Slip`
|
||||
where month = %s and fiscal_year = %s and docstatus != 2
|
||||
and employee = %s and name != %s""",
|
||||
(self.doc.month, self.doc.fiscal_year, self.doc.employee, self.doc.name))
|
||||
if ret_exist:
|
||||
msgprint("Salary Slip of employee '%s' already created for this month" % self.doc.employee)
|
||||
self.doc.employee = ''
|
||||
raise Exception
|
||||
msgprint("Salary Slip of employee '%s' already created for this month"
|
||||
% self.doc.employee, raise_exception=1)
|
||||
|
||||
|
||||
def validate(self):
|
||||
@ -146,41 +153,32 @@ class DocType(TransactionBase):
|
||||
company_currency = get_company_currency(self.doc.company)
|
||||
self.doc.total_in_words = money_in_words(self.doc.rounded_total, company_currency)
|
||||
|
||||
|
||||
def calculate_earning_total(self):
|
||||
"""
|
||||
Calculates total earnings considering lwp
|
||||
"""
|
||||
self.doc.gross_pay = flt(self.doc.arrear_amount) + flt(self.doc.leave_encashment_amount)
|
||||
for d in getlist(self.doclist, 'earning_details'):
|
||||
if cint(d.e_depends_on_lwp) == 1:
|
||||
d.e_modified_amount = round(flt(d.e_amount)*flt(self.doc.payment_days)/cint(self.doc.total_days_in_month), 2)
|
||||
d.e_modified_amount = round(flt(d.e_amount) * flt(self.doc.payment_days)
|
||||
/ cint(self.doc.total_days_in_month), 2)
|
||||
elif not self.doc.payment_days:
|
||||
d.e_modified_amount = 0
|
||||
self.doc.gross_pay += flt(d.e_modified_amount)
|
||||
|
||||
def calculate_ded_total(self):
|
||||
"""
|
||||
Calculates total deduction considering lwp
|
||||
"""
|
||||
self.doc.total_deduction = 0
|
||||
for d in getlist(self.doclist, 'deduction_details'):
|
||||
if cint(d.d_depends_on_lwp) == 1:
|
||||
d.d_modified_amount = round(flt(d.d_amount)*flt(self.doc.payment_days)/cint(self.doc.total_days_in_month), 2)
|
||||
d.d_modified_amount = round(flt(d.d_amount) * flt(self.doc.payment_days)
|
||||
/ cint(self.doc.total_days_in_month), 2)
|
||||
elif not self.doc.payment_days:
|
||||
d.d_modified_amount = 0
|
||||
|
||||
self.doc.total_deduction += flt(d.d_modified_amount)
|
||||
|
||||
def calculate_net_pay(self):
|
||||
"""
|
||||
Calculate net payment
|
||||
"""
|
||||
self.calculate_earning_total()
|
||||
self.calculate_ded_total()
|
||||
self.doc.net_pay = flt(self.doc.gross_pay) - flt(self.doc.total_deduction)
|
||||
self.doc.rounded_total = round(self.doc.net_pay)
|
||||
|
||||
self.doc.rounded_total = round(self.doc.net_pay)
|
||||
|
||||
def on_submit(self):
|
||||
if(self.doc.email_check == 1):
|
||||
@ -189,12 +187,13 @@ class DocType(TransactionBase):
|
||||
|
||||
def send_mail_funct(self):
|
||||
from webnotes.utils.email_lib import sendmail
|
||||
emailid_ret=sql("select company_email from `tabEmployee` where name = '%s'"%self.doc.employee)
|
||||
if emailid_ret:
|
||||
receiver = cstr(emailid_ret[0][0])
|
||||
receiver = webnotes.conn.get_value("Employee", self.doc.employee, "company_email")
|
||||
if receiver:
|
||||
subj = 'Salary Slip - ' + cstr(self.doc.month) +'/'+cstr(self.doc.fiscal_year)
|
||||
earn_ret=sql("select e_type,e_modified_amount from `tabSalary Slip Earning` where parent = '%s'"%self.doc.name)
|
||||
ded_ret=sql("select d_type,d_modified_amount from `tabSalary Slip Deduction` where parent = '%s'"%self.doc.name)
|
||||
earn_ret=sql("""select e_type, e_modified_amount from `tabSalary Slip Earning`
|
||||
where parent = %s""", self.doc.name)
|
||||
ded_ret=sql("""select d_type, d_modified_amount from `tabSalary Slip Deduction`
|
||||
where parent = %s""", self.doc.name)
|
||||
|
||||
earn_table = ''
|
||||
ded_table = ''
|
||||
@ -203,9 +202,10 @@ class DocType(TransactionBase):
|
||||
|
||||
for e in earn_ret:
|
||||
if not e[1]:
|
||||
earn_table +='<tr><td>%s</td><td align="right">0.00</td></tr>'%(cstr(e[0]))
|
||||
earn_table += '<tr><td>%s</td><td align="right">0.00</td></tr>' % cstr(e[0])
|
||||
else:
|
||||
earn_table +='<tr><td>%s</td><td align="right">%s</td></tr>'%(cstr(e[0]),cstr(e[1]))
|
||||
earn_table += '<tr><td>%s</td><td align="right">%s</td></tr>' \
|
||||
% (cstr(e[0]), cstr(e[1]))
|
||||
earn_table += '</table>'
|
||||
|
||||
if ded_ret:
|
||||
@ -214,15 +214,14 @@ class DocType(TransactionBase):
|
||||
|
||||
for d in ded_ret:
|
||||
if not d[1]:
|
||||
ded_table +='<tr><td">%s</td><td align="right">0.00</td></tr>'%(cstr(d[0]))
|
||||
ded_table +='<tr><td">%s</td><td align="right">0.00</td></tr>' % cstr(d[0])
|
||||
else:
|
||||
ded_table +='<tr><td>%s</td><td align="right">%s</td></tr>'%(cstr(d[0]),cstr(d[1]))
|
||||
ded_table +='<tr><td>%s</td><td align="right">%s</td></tr>' \
|
||||
% (cstr(d[0]), cstr(d[1]))
|
||||
ded_table += '</table>'
|
||||
|
||||
letter_head = sql("select value from `tabSingles` where field = 'letter_head' and doctype = 'Control Panel'")
|
||||
|
||||
if not letter_head:
|
||||
letter_head = ''
|
||||
letter_head = webnotes.conn.get_value("Letter Head", {"is_default": 1, "disabled": 0},
|
||||
"content")
|
||||
|
||||
msg = '''<div> %s <br>
|
||||
<table cellspacing= "5" cellpadding="5" width = "100%%">
|
||||
@ -258,8 +257,10 @@ class DocType(TransactionBase):
|
||||
</table>
|
||||
<table border="1px solid #CCC" width="100%%" cellpadding="0px" cellspacing="0px">
|
||||
<tr>
|
||||
<td colspan = 2 width = "50%%" bgcolor="#CCC" align="center"><b>Earnings</b></td>
|
||||
<td colspan = 2 width = "50%%" bgcolor="#CCC" align="center"><b>Deductions</b></td>
|
||||
<td colspan = 2 width = "50%%" bgcolor="#CCC" align="center">
|
||||
<b>Earnings</b></td>
|
||||
<td colspan = 2 width = "50%%" bgcolor="#CCC" align="center">
|
||||
<b>Deductions</b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan = 2 width = "50%%" valign= "top">%s</td>
|
||||
@ -268,17 +269,28 @@ class DocType(TransactionBase):
|
||||
</table>
|
||||
<table cellspacing= "5" cellpadding="5" width = '100%%'>
|
||||
<tr>
|
||||
<td width = '25%%'><b>Gross Pay :</b> </td><td width = '25%%' align='right'>%s</td>
|
||||
<td width = '25%%'><b>Total Deduction :</b></td><td width = '25%%' align='right'> %s</td>
|
||||
<td width = '25%%'><b>Gross Pay :</b> </td>
|
||||
<td width = '25%%' align='right'>%s</td>
|
||||
<td width = '25%%'><b>Total Deduction :</b></td>
|
||||
<td width = '25%%' align='right'> %s</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<tdwidth='25%%'><b>Net Pay : </b></td><td width = '25%%' align='right'><b>%s</b></td>
|
||||
<tdwidth='25%%'><b>Net Pay : </b></td>
|
||||
<td width = '25%%' align='right'><b>%s</b></td>
|
||||
<td colspan = '2' width = '50%%'></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width='25%%'><b>Net Pay(in words) : </td><td colspan = '3' width = '50%%'>%s</b></td>
|
||||
<td width='25%%'><b>Net Pay(in words) : </td>
|
||||
<td colspan = '3' width = '50%%'>%s</b></td>
|
||||
</tr>
|
||||
</table></div>'''%(cstr(letter_head[0][0]),cstr(self.doc.employee), cstr(self.doc.employee_name), cstr(self.doc.month), cstr(self.doc.fiscal_year), cstr(self.doc.department), cstr(self.doc.branch), cstr(self.doc.designation), cstr(self.doc.grade), cstr(self.doc.bank_account_no), cstr(self.doc.bank_name), cstr(self.doc.arrear_amount), cstr(self.doc.payment_days), earn_table, ded_table, cstr(flt(self.doc.gross_pay)), cstr(flt(self.doc.total_deduction)), cstr(flt(self.doc.net_pay)), cstr(self.doc.total_in_words))
|
||||
</table></div>''' % (cstr(letter_head), cstr(self.doc.employee),
|
||||
cstr(self.doc.employee_name), cstr(self.doc.month), cstr(self.doc.fiscal_year),
|
||||
cstr(self.doc.department), cstr(self.doc.branch), cstr(self.doc.designation),
|
||||
cstr(self.doc.grade), cstr(self.doc.bank_account_no), cstr(self.doc.bank_name),
|
||||
cstr(self.doc.arrear_amount), cstr(self.doc.payment_days), earn_table, ded_table,
|
||||
cstr(flt(self.doc.gross_pay)), cstr(flt(self.doc.total_deduction)),
|
||||
cstr(flt(self.doc.net_pay)), cstr(self.doc.total_in_words))
|
||||
|
||||
sendmail([receiver], subject=subj, msg = msg)
|
||||
else:
|
||||
msgprint("Company Email ID not found, hence mail not sent")
|
||||
|
@ -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'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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):
|
||||
|
@ -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"
|
||||
}
|
||||
]
|
@ -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")
|
||||
|
@ -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
|
||||
|
@ -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"
|
||||
|
||||
|
@ -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]
|
||||
}
|
||||
|
@ -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:
|
||||
|
@ -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",
|
||||
},
|
||||
|
@ -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",
|
||||
}
|
||||
],
|
||||
]
|
@ -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"
|
||||
}],
|
||||
]
|
@ -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",
|
||||
}]
|
||||
|
@ -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):
|
||||
|
@ -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."
|
||||
}
|
||||
]
|
||||
|
@ -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",
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
}
|
||||
],
|
||||
]
|
@ -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"
|
||||
|
@ -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",
|
||||
}
|
||||
|
@ -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",
|
||||
|
@ -313,23 +313,14 @@ cur_frm.fields_dict['mtn_details'].grid.onrowadd = function(doc, cdt, cdn){
|
||||
cur_frm.fields_dict['mtn_details'].grid.get_field('batch_no').get_query = function(doc, cdt, cdn) {
|
||||
var d = locals[cdt][cdn];
|
||||
if(d.item_code) {
|
||||
if (d.s_warehouse) {
|
||||
return{
|
||||
query: "stock.doctype.stock_entry.stock_entry.get_batch_no",
|
||||
filters:{
|
||||
'item_code': d.item_code,
|
||||
's_warehouse': d.s_warehouse,
|
||||
'posting_date': doc.posting_date
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return{
|
||||
filters:[
|
||||
['Batch', 'item', '=', d.item_code],
|
||||
['Batch', 'expiry_date', '>=', doc.posting_date]
|
||||
]
|
||||
return{
|
||||
query: "stock.doctype.stock_entry.stock_entry.get_batch_no",
|
||||
filters:{
|
||||
'item_code': d.item_code,
|
||||
's_warehouse': d.s_warehouse,
|
||||
'posting_date': doc.posting_date
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
msgprint("Please enter Item Code to get batch no");
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ from __future__ import unicode_literals
|
||||
import webnotes
|
||||
import webnotes.defaults
|
||||
|
||||
from webnotes.utils import cstr, cint, flt, comma_or
|
||||
from webnotes.utils import cstr, cint, flt, comma_or, nowdate
|
||||
from webnotes.model.doc import Document, addchild
|
||||
from webnotes.model.bean import getlist
|
||||
from webnotes.model.code import get_obj
|
||||
@ -719,7 +719,6 @@ def get_production_order_details(production_order):
|
||||
return result and result[0] or {}
|
||||
|
||||
def query_sales_return_doc(doctype, txt, searchfield, start, page_len, filters):
|
||||
from controllers.queries import get_match_cond
|
||||
conditions = ""
|
||||
if doctype == "Sales Invoice":
|
||||
conditions = "and update_stock=1"
|
||||
@ -735,7 +734,6 @@ def query_sales_return_doc(doctype, txt, searchfield, start, page_len, filters):
|
||||
as_list=True)
|
||||
|
||||
def query_purchase_return_doc(doctype, txt, searchfield, start, page_len, filters):
|
||||
from controllers.queries import get_match_cond
|
||||
return webnotes.conn.sql("""select name, supplier, supplier_name
|
||||
from `tab%s` where docstatus = 1
|
||||
and (`%s` like %%(txt)s
|
||||
@ -770,24 +768,50 @@ def query_return_item(doctype, txt, searchfield, start, page_len, filters):
|
||||
return result[start:start+page_len]
|
||||
|
||||
def get_batch_no(doctype, txt, searchfield, start, page_len, filters):
|
||||
from controllers.queries import get_match_cond
|
||||
|
||||
return webnotes.conn.sql("""select batch_no from `tabStock Ledger Entry` sle
|
||||
if not filters.get("posting_date"):
|
||||
filters["posting_date"] = nowdate()
|
||||
|
||||
batch_nos = None
|
||||
args = {
|
||||
'item_code': filters['item_code'],
|
||||
's_warehouse': filters['s_warehouse'],
|
||||
'posting_date': filters['posting_date'],
|
||||
'txt': "%%%s%%" % txt,
|
||||
'mcond':get_match_cond(doctype, searchfield),
|
||||
"start": start,
|
||||
"page_len": page_len
|
||||
}
|
||||
|
||||
if filters.get("s_warehouse"):
|
||||
batch_nos = webnotes.conn.sql("""select batch_no
|
||||
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
|
||||
and expiry_date >= %(posting_date)s
|
||||
and docstatus != 2)
|
||||
where name = sle.batch_no
|
||||
and (ifnull(expiry_date, '2099-12-31') >= %(posting_date)s
|
||||
or expiry_date = '')
|
||||
and docstatus != 2)
|
||||
%(mcond)s
|
||||
group by batch_no having sum(actual_qty) > 0
|
||||
order by batch_no desc
|
||||
limit %(start)s, %(page_len)s """ % {'item_code': filters['item_code'],
|
||||
's_warehouse': filters['s_warehouse'], 'posting_date': filters['posting_date'],
|
||||
'txt': "%%%s%%" % txt, 'mcond':get_match_cond(doctype, searchfield),
|
||||
"start": start, "page_len": page_len})
|
||||
limit %(start)s, %(page_len)s """
|
||||
% args)
|
||||
|
||||
if batch_nos:
|
||||
return batch_nos
|
||||
else:
|
||||
return webnotes.conn.sql("""select name from `tabBatch`
|
||||
where item = '%(item_code)s'
|
||||
and docstatus < 2
|
||||
and (ifnull(expiry_date, '2099-12-31') >= %(posting_date)s
|
||||
or expiry_date = '' or expiry_date = "0000-00-00")
|
||||
%(mcond)s
|
||||
order by name desc
|
||||
limit %(start)s, %(page_len)s
|
||||
""" % args)
|
||||
|
||||
def get_stock_items_for_return(ref_doclist, parentfields):
|
||||
"""return item codes filtered from doclist, which are stock items"""
|
||||
|
@ -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",
|
||||
}
|
||||
]
|
||||
]
|
@ -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",
|
||||
|
@ -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
|
||||
|
||||
|
@ -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': '',
|
||||
|
Loading…
Reference in New Issue
Block a user