Merge branch 'master' into edge

This commit is contained in:
Anand Doshi 2013-05-27 18:29:04 +05:30
commit 8c14789537
4 changed files with 41 additions and 27 deletions

View File

@ -326,7 +326,7 @@ class DocType(BuyingController):
against_accounts.append(stock_not_billed_account)
elif not item.expense_head:
msgprint(_("""Expense account is mandatory for item: """) + item.item_code,
msgprint(_("""Expense account is mandatory for item: """) + (item.item_code or item.item_name),
raise_exception=1)
elif item.expense_head not in against_accounts:

View File

@ -566,7 +566,7 @@ class DocType(SellingController):
def check_value(self, ref_dt, ref_dn, ref_item_dn, val, item_code):
ref_val = webnotes.conn.get_value(ref_dt + " Item", ref_item_dn, "export_rate")
if flt(ref_val) != flt(val):
if flt(ref_val, 2) != flt(val, 2):
msgprint(_("Rate is not matching with ") + ref_dt + ": " + ref_dn +
_(" for item: ") + item_code, raise_exception=True)

View File

@ -17,6 +17,7 @@
from __future__ import unicode_literals
import webnotes
from webnotes.utils import flt
from webnotes import msgprint, _
def execute(filters=None):
if not filters: filters = {}
@ -24,6 +25,11 @@ def execute(filters=None):
invoice_list = get_invoices(filters)
columns, expense_accounts, tax_accounts = get_columns(invoice_list)
if not invoice_list:
msgprint(_("No record found"))
return columns, invoice_list
invoice_expense_map = get_invoice_expense_map(invoice_list)
invoice_tax_map = get_invoice_tax_map(invoice_list)
invoice_po_pr_map = get_invoice_po_pr_map(invoice_list)
@ -64,7 +70,8 @@ def get_columns(invoice_list):
"Project:Link/Project:80", "Bill No::120", "Bill Date:Date:80", "Remarks::150",
"Purchase Order:Link/Purchase Order:100", "Purchase Receipt:Link/Purchase Receipt:100"
]
expense_accounts = tax_accounts = []
if invoice_list:
expense_accounts = webnotes.conn.sql_list("""select distinct expense_head
from `tabPurchase Invoice Item` where docstatus = 1 and ifnull(expense_head, '') != ''
and parent in (%s) order by expense_head""" %
@ -86,7 +93,7 @@ def get_conditions(filters):
conditions = ""
if filters.get("company"): conditions += " and company=%(company)s"
if filters.get("account"): conditions += " and account = %(account)s"
if filters.get("account"): conditions += " and credit_to = %(account)s"
if filters.get("from_date"): conditions += " and posting_date>=%(from_date)s"
if filters.get("to_date"): conditions += " and posting_date<=%(to_date)s"

View File

@ -17,6 +17,7 @@
from __future__ import unicode_literals
import webnotes
from webnotes.utils import flt
from webnotes import msgprint, _
def execute(filters=None):
if not filters: filters = {}
@ -24,6 +25,10 @@ def execute(filters=None):
invoice_list = get_invoices(filters)
columns, income_accounts, tax_accounts = get_columns(invoice_list)
if not invoice_list:
msgprint(_("No record found"))
return columns, invoice_list
invoice_income_map = get_invoice_income_map(invoice_list)
invoice_tax_map = get_invoice_tax_map(invoice_list)
@ -69,6 +74,8 @@ def get_columns(invoice_list):
"Remarks::150", "Sales Order:Link/Sales Order:100", "Delivery Note:Link/Delivery Note:100"
]
income_accounts = tax_accounts = []
if invoice_list:
income_accounts = webnotes.conn.sql_list("""select distinct income_account
from `tabSales Invoice Item` where docstatus = 1 and parent in (%s)
order by income_account""" %
@ -89,7 +96,7 @@ def get_conditions(filters):
conditions = ""
if filters.get("company"): conditions += " and company=%(company)s"
if filters.get("account"): conditions += " and account = %(account)s"
if filters.get("account"): conditions += " and debit_to = %(account)s"
if filters.get("from_date"): conditions += " and posting_date >= %(from_date)s"
if filters.get("to_date"): conditions += " and posting_date <= %(to_date)s"
@ -99,9 +106,9 @@ def get_conditions(filters):
def get_invoices(filters):
conditions = get_conditions(filters)
return webnotes.conn.sql("""select name, posting_date, debit_to, project_name, customer,
remarks, net_total, other_charges_total, grand_total
from `tabSales Invoice` where docstatus = 1 %s
order by posting_date desc, name desc""" % conditions, filters, as_dict=1)
remarks, net_total, other_charges_total, grand_total from `tabSales Invoice`
where docstatus = 1 %s order by posting_date desc, name desc""" %
conditions, filters, as_dict=1)
def get_invoice_income_map(invoice_list):
income_details = webnotes.conn.sql("""select parent, income_account, sum(amount) as amount