This commit is contained in:
Saurabh
2013-06-14 16:48:41 +05:30
19 changed files with 218 additions and 177 deletions

View File

@@ -160,13 +160,13 @@ class DocType:
def update_outstanding_amt(self):
# get final outstanding amt
bal = flt(sql("""select sum(debit) - sum(credit) from `tabGL Entry`
where against_voucher=%s and against_voucher_type=%s
and ifnull(is_cancelled,'No') = 'No'""",
(self.doc.against_voucher, self.doc.against_voucher_type))[0][0] or 0.0)
where against_voucher=%s and against_voucher_type=%s and account = %s
and ifnull(is_cancelled,'No') = 'No'""", (self.doc.against_voucher,
self.doc.against_voucher_type, self.doc.account))[0][0] or 0.0)
if self.doc.against_voucher_type == 'Purchase Invoice':
bal = -bal
elif self.doc.against_voucher_type == "Journal Voucher":
against_voucher_amount = flt(webnotes.conn.sql("""select sum(debit) - sum(credit)
from `tabGL Entry` where voucher_type = 'Journal Voucher' and voucher_no = %s

View File

@@ -466,9 +466,8 @@ class DocType(BuyingController):
# expense will be booked in sales invoice
stock_item_and_auto_inventory_accounting = True
valuation_amt = (flt(item.amount, self.precision.item.amount) +
flt(item.item_tax_amount, self.precision.item.item_tax_amount) +
flt(item.rm_supp_cost, self.precision.item.rm_supp_cost))
valuation_amt = (flt(item.amount) + flt(item.item_tax_amount) +
flt(item.rm_supp_cost))
gl_entries.append(
self.get_gl_dict({

View File

@@ -131,7 +131,7 @@ erpnext.AccountsChart = Class.extend({
if (wn.model.can_read(this.ctype) !== -1) {
node_links.push('<a onclick="erpnext.account_chart.open();">Edit</a>');
}
if (data.expandable) {
if (data.expandable && wn.boot.profile.in_create.indexOf(this.ctype) !== -1) {
node_links.push('<a onclick="erpnext.account_chart.new_node();">Add Child</a>');
} else if (this.ctype === 'Account' && wn.boot.profile.can_read.indexOf("GL Entry") !== -1) {
node_links.push('<a onclick="erpnext.account_chart.show_ledger();">View Ledger</a>');

View File

@@ -127,16 +127,6 @@ wn.module_page["Accounts"] = [
right: true,
icon: "icon-table",
items: [
{
"label":wn._("Customer Account Head"),
route: "query-report/Customer Account Head",
doctype: "Account"
},
{
"label":wn._("Supplier Account Head"),
route: "query-report/Supplier Account Head",
doctype: "Account"
},
{
"label":wn._("General Ledger"),
page: "general-ledger"
@@ -247,6 +237,11 @@ wn.module_page["Accounts"] = [
route: "query-report/Customer Account Head",
doctype: "Account"
},
{
"label":wn._("Supplier Account Head"),
route: "query-report/Supplier Account Head",
doctype: "Account"
},
{
"label":wn._("Item-wise Sales Register"),
route: "query-report/Item-wise Sales Register",

View File

@@ -59,7 +59,7 @@ def upload():
if not company_abbr:
webnotes.msgprint(_("Company is missing or entered incorrect value"), raise_exception=1)
data, start_idx = get_data(rows, company_abbr)
data, start_idx = get_data(rows, company_abbr, rows[0][0])
except Exception, e:
err_msg = webnotes.message_log and "<br>".join(webnotes.message_log) or cstr(e)
messages.append("""<p style='color: red'>%s</p>""" % (err_msg or "No message"))
@@ -213,10 +213,11 @@ def get_common_values(rows):
return common_values
def get_data(rows, company_abbr):
def get_data(rows, company_abbr, import_type):
start_row = 0
data = []
start_row_idx = 0
accounts = None
for i in xrange(len(rows)):
r = rows[i]
if r[0]:
@@ -257,17 +258,19 @@ def get_data(rows, company_abbr):
columns = [c.replace(" ", "_").lower() for c in rows[i+1]
if not c.endswith(" - " + company_abbr)]
accounts = [c for c in rows[i+1] if c.endswith(" - " + company_abbr)]
if import_type == "Voucher Import: Multiple Accounts":
accounts = [c for c in rows[i+1] if c.endswith(" - " + company_abbr)]
if not accounts:
webnotes.msgprint(_("""No Account found in csv file,
May be company abbreviation is not correct"""), raise_exception=1)
if not accounts:
webnotes.msgprint(_("""No Account found in csv file,
May be company abbreviation is not correct"""), raise_exception=1)
if accounts and (len(columns) != rows[i+1].index(accounts[0])):
webnotes.msgprint(_("""All account columns should be after \
standard columns and on the right.
If you entered it properly, next probable reason \
could be wrong account name.
Please rectify it in the file and try again."""), raise_exception=1)
if accounts and (len(columns) != rows[i+1].index(accounts[0])):
webnotes.msgprint(_("""All account columns should be after \
standard columns and on the right.
If you entered it properly, next probable reason \
could be wrong account name.
Please rectify it in the file and try again."""), raise_exception=1)
return data, start_row_idx

View File

@@ -59,7 +59,7 @@ def get_conditions(filters):
def get_items(filters):
conditions = get_conditions(filters)
return webnotes.conn.sql("""select si.name, si.posting_date, si.debit_to, si.project_name,
si.customer, si.remarks, si.territory, si_item.item_code, si_item.item_name,
si.customer, si.remarks, si.territory, si.company, si_item.item_code, si_item.item_name,
si_item.item_group, si_item.sales_order, si_item.delivery_note, si_item.income_account,
si_item.qty, si_item.basic_rate, si_item.amount
from `tabSales Invoice` si, `tabSales Invoice Item` si_item

View File

@@ -125,7 +125,6 @@ def add_ac(args=None):
ac.doc.doctype = "Account"
ac.doc.old_parent = ""
ac.doc.freeze_account = "No"
ac.ignore_permissions = 1
ac.insert()
return ac.doc.name
@@ -138,7 +137,6 @@ def add_cc(args=None):
cc = webnotes.bean(args)
cc.doc.doctype = "Cost Center"
cc.doc.old_parent = ""
cc.ignore_permissions = 1
cc.insert()
return cc.doc.name