mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-15 19:19:17 +00:00
Merge branch '1310' of github.com:webnotes/erpnext
Conflicts: setup/doctype/setup_control/setup_control.py stock/doctype/stock_entry/stock_entry.py utilities/demo/demo_docs/Price_List.csv
This commit is contained in:
@@ -135,17 +135,18 @@ def check_freezing_date(posting_date, adv_adj=False):
|
||||
|
||||
def update_outstanding_amt(account, against_voucher_type, against_voucher, on_cancel=False):
|
||||
# get final outstanding amt
|
||||
bal = flt(webnotes.conn.sql("""select sum(debit) - sum(credit) from `tabGL Entry`
|
||||
bal = flt(webnotes.conn.sql("""select sum(ifnull(debit, 0)) - sum(ifnull(credit, 0))
|
||||
from `tabGL Entry`
|
||||
where against_voucher_type=%s and against_voucher=%s and account = %s""",
|
||||
(against_voucher_type, against_voucher, account))[0][0] or 0.0)
|
||||
|
||||
if against_voucher_type == 'Purchase Invoice':
|
||||
bal = -bal
|
||||
elif against_voucher_type == "Journal Voucher":
|
||||
against_voucher_amount = flt(webnotes.conn.sql("""select sum(debit) - sum(credit)
|
||||
against_voucher_amount = flt(webnotes.conn.sql("""
|
||||
select sum(ifnull(debit, 0)) - sum(ifnull(credit, 0))
|
||||
from `tabGL Entry` where voucher_type = 'Journal Voucher' and voucher_no = %s
|
||||
and account = %s""", (against_voucher, account))[0][0])
|
||||
|
||||
bal = against_voucher_amount + bal
|
||||
if against_voucher_amount < 0:
|
||||
bal = -bal
|
||||
|
||||
@@ -456,12 +456,17 @@ class DocType(BuyingController):
|
||||
@webnotes.whitelist()
|
||||
def get_expense_account(doctype, txt, searchfield, start, page_len, filters):
|
||||
from controllers.queries import get_match_cond
|
||||
|
||||
|
||||
# expense account can be any Debit account,
|
||||
# but can also be a Liability account with account_type='Expense Account' in special circumstances.
|
||||
# Hence the first condition is an "OR"
|
||||
return webnotes.conn.sql("""select tabAccount.name from `tabAccount`
|
||||
where (tabAccount.debit_or_credit="Debit"
|
||||
or tabAccount.account_type = "Expense Account")
|
||||
or tabAccount.account_type = "Expense Account")
|
||||
and tabAccount.group_or_ledger="Ledger"
|
||||
and tabAccount.docstatus!=2
|
||||
and ifnull(tabAccount.master_type, "")=""
|
||||
and ifnull(tabAccount.master_name, "")=""
|
||||
and tabAccount.company = '%(company)s'
|
||||
and tabAccount.%(key)s LIKE '%(txt)s'
|
||||
%(mcond)s""" % {'company': filters['company'], 'key': searchfield,
|
||||
|
||||
@@ -897,11 +897,16 @@ def get_bank_cash_account(mode_of_payment):
|
||||
def get_income_account(doctype, txt, searchfield, start, page_len, filters):
|
||||
from controllers.queries import get_match_cond
|
||||
|
||||
# income account can be any Credit account,
|
||||
# but can also be a Asset account with account_type='Income Account' in special circumstances.
|
||||
# Hence the first condition is an "OR"
|
||||
return webnotes.conn.sql("""select tabAccount.name from `tabAccount`
|
||||
where (tabAccount.debit_or_credit="Credit"
|
||||
or tabAccount.account_type = "Income Account")
|
||||
and tabAccount.group_or_ledger="Ledger"
|
||||
and tabAccount.docstatus!=2
|
||||
and tabAccount.docstatus!=2
|
||||
and ifnull(tabAccount.master_type, "")=""
|
||||
and ifnull(tabAccount.master_name, "")=""
|
||||
and tabAccount.company = '%(company)s'
|
||||
and tabAccount.%(key)s LIKE '%(txt)s'
|
||||
%(mcond)s""" % {'company': filters['company'], 'key': searchfield,
|
||||
|
||||
@@ -7,7 +7,7 @@ wn.require("app/js/controllers/accounts.js");
|
||||
|
||||
cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
||||
if(doc.doctype === "Sales Taxes and Charges Master")
|
||||
erpnext.add_for_territory();
|
||||
erpnext.add_applicable_territory();
|
||||
}
|
||||
|
||||
cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-01-10 16:34:09",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-07-22 15:22:14",
|
||||
"modified": "2013-10-31 19:25:09",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@@ -94,7 +94,7 @@
|
||||
"fieldname": "valid_for_territories",
|
||||
"fieldtype": "Table",
|
||||
"label": "Valid for Territories",
|
||||
"options": "For Territory",
|
||||
"options": "Applicable Territory",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
|
||||
@@ -25,7 +25,7 @@ test_records = [
|
||||
"rate": 6.36,
|
||||
},
|
||||
{
|
||||
"doctype": "For Territory",
|
||||
"doctype": "Applicable Territory",
|
||||
"parentfield": "valid_for_territories",
|
||||
"territory": "All Territories"
|
||||
}
|
||||
@@ -113,7 +113,7 @@ test_records = [
|
||||
"row_id": 7
|
||||
},
|
||||
{
|
||||
"doctype": "For Territory",
|
||||
"doctype": "Applicable Territory",
|
||||
"parentfield": "valid_for_territories",
|
||||
"territory": "_Test Territory India"
|
||||
}
|
||||
@@ -141,7 +141,7 @@ test_records = [
|
||||
"rate": 4,
|
||||
},
|
||||
{
|
||||
"doctype": "For Territory",
|
||||
"doctype": "Applicable Territory",
|
||||
"parentfield": "valid_for_territories",
|
||||
"territory": "All Territories"
|
||||
}
|
||||
|
||||
@@ -3,6 +3,6 @@
|
||||
|
||||
$.extend(cur_frm.cscript, {
|
||||
onload: function() {
|
||||
erpnext.add_for_territory();
|
||||
erpnext.add_applicable_territory();
|
||||
}
|
||||
});
|
||||
@@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-06-25 11:48:03",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-07-05 14:55:00",
|
||||
"modified": "2013-10-31 19:24:50",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@@ -87,7 +87,7 @@
|
||||
"fieldname": "valid_for_territories",
|
||||
"fieldtype": "Table",
|
||||
"label": "Valid For Territories",
|
||||
"options": "For Territory",
|
||||
"options": "Applicable Territory",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
|
||||
@@ -62,7 +62,7 @@ test_records = [
|
||||
"shipping_amount": 0.0
|
||||
},
|
||||
{
|
||||
"doctype": "For Territory",
|
||||
"doctype": "Applicable Territory",
|
||||
"parentfield": "valid_for_territories",
|
||||
"territory": "_Test Territory"
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ def get_tax_accounts(item_list, columns):
|
||||
item_wise_tax_detail = json.loads(item_wise_tax_detail)
|
||||
for item, tax_amount in item_wise_tax_detail.items():
|
||||
item_tax.setdefault(parent, {}).setdefault(item, {})[account_head] = \
|
||||
flt(tax_amount[1])
|
||||
flt(tax_amount[1]) if isinstance(tax_amount, list) else flt(tax_amount)
|
||||
|
||||
except ValueError:
|
||||
continue
|
||||
|
||||
@@ -83,7 +83,7 @@ def get_tax_accounts(item_list, columns):
|
||||
item_wise_tax_detail = json.loads(item_wise_tax_detail)
|
||||
for item, tax_amount in item_wise_tax_detail.items():
|
||||
item_tax.setdefault(parent, {}).setdefault(item, {})[account_head] = \
|
||||
flt(tax_amount[1])
|
||||
flt(tax_amount[1]) if isinstance(tax_amount, list) else flt(tax_amount)
|
||||
except ValueError:
|
||||
continue
|
||||
|
||||
|
||||
Reference in New Issue
Block a user