mirror of
https://github.com/frappe/erpnext.git
synced 2026-03-22 11:44:11 +00:00
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:
@@ -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'") % {
|
||||
|
||||
Reference in New Issue
Block a user