[cleanup] UI Fixes, minor

This commit is contained in:
Rushabh Mehta
2013-11-06 11:29:47 +05:30
48 changed files with 162 additions and 131 deletions

View File

@@ -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

View File

@@ -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,

View File

@@ -2,7 +2,7 @@
{
"creation": "2013-05-21 16:16:39",
"docstatus": 0,
"modified": "2013-11-03 14:11:34",
"modified": "2013-11-05 23:09:38",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -85,7 +85,7 @@
"depends_on": "supplier",
"doctype": "DocField",
"fieldname": "supplier_name",
"fieldtype": "Text",
"fieldtype": "Data",
"hidden": 0,
"in_list_view": 1,
"label": "Name",
@@ -248,7 +248,6 @@
"read_only": 0
},
{
"depends_on": "buying_price_list",
"doctype": "DocField",
"fieldname": "price_list_currency",
"fieldtype": "Link",
@@ -258,7 +257,6 @@
"read_only": 1
},
{
"depends_on": "buying_price_list",
"doctype": "DocField",
"fieldname": "plc_conversion_rate",
"fieldtype": "Float",
@@ -320,7 +318,6 @@
"read_only": 1
},
{
"description": "Add / Edit Taxes and Charges",
"doctype": "DocField",
"fieldname": "taxes",
"fieldtype": "Section Break",
@@ -333,7 +330,7 @@
"doctype": "DocField",
"fieldname": "purchase_other_charges",
"fieldtype": "Link",
"label": "Purchase Taxes and Charges",
"label": "Tax Master",
"oldfieldname": "purchase_other_charges",
"oldfieldtype": "Link",
"options": "Purchase Taxes and Charges Master",

View File

@@ -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,

View File

@@ -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) {

View File

@@ -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
},
{

View File

@@ -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"
}

View File

@@ -3,6 +3,6 @@
$.extend(cur_frm.cscript, {
onload: function() {
erpnext.add_for_territory();
erpnext.add_applicable_territory();
}
});

View File

@@ -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
},
{

View File

@@ -62,7 +62,7 @@ test_records = [
"shipping_amount": 0.0
},
{
"doctype": "For Territory",
"doctype": "Applicable Territory",
"parentfield": "valid_for_territories",
"territory": "_Test Territory"
}