Merge branch 'master' of github.com:webnotes/erpnext into responsive

Conflicts:
	patches/patch_list.py
	projects/doctype/project/project.py
	utilities/transaction_base.py
This commit is contained in:
Anand Doshi
2013-06-10 15:25:07 +05:30
34 changed files with 989 additions and 114 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

@@ -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,11 +237,21 @@ 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",
doctype: "Sales Invoice"
},
{
"label":wn._("Item-wise Purchase Register"),
route: "query-report/Item-wise Purchase Register",
doctype: "Purchase Invoice"
},
]
}
]

View File

@@ -0,0 +1,39 @@
wn.query_reports["Item-wise Purchase Register"] = {
"filters": [
{
"fieldname":"from_date",
"label": "From Date",
"fieldtype": "Date",
"default": wn.defaults.get_user_default("year_start_date"),
"width": "80"
},
{
"fieldname":"to_date",
"label": "To Date",
"fieldtype": "Date",
"default": get_today()
},
{
"fieldname": "item_code",
"label": "Item",
"fieldtype": "Link",
"options": "Item",
},
{
"fieldname":"account",
"label": "Account",
"fieldtype": "Link",
"options": "Account",
"get_query": function() {
return {
"query": "accounts.utils.get_account_list",
"filters": {
"is_pl_account": "No",
"debit_or_credit": "Credit",
"master_type": "Supplier"
}
}
}
}
]
}

View File

@@ -0,0 +1,74 @@
# ERPNext - web based ERP (http://erpnext.com)
# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from __future__ import unicode_literals
import webnotes
def execute(filters=None):
if not filters: filters = {}
columns = get_columns()
item_list = get_items(filters)
aii_account_map = get_aii_accounts()
webnotes.errprint(aii_account_map)
data = []
for d in item_list:
expense_head = d.expense_head or aii_account_map.get(d.company)
data.append([d.item_code, d.item_name, d.item_group, d.name, d.posting_date, d.supplier,
d.credit_to, d.project_name, d.company, d.purchase_order, d.purchase_receipt,
expense_head, d.qty, d.rate, d.amount])
return columns, data
def get_columns():
return ["Item Code:Link/Item:120", "Item Name::120", "Item Group:Link/Item Group:100",
"Invoice:Link/Purchase Invoice:120", "Posting Date:Date:80", "Supplier:Link/Customer:120",
"Supplier Account:Link/Account:120", "Project:Link/Project:80", "Company:Link/Company:100",
"Purchase Order:Link/Purchase Order:100", "Purchase Receipt:Link/Purchase Receipt:100",
"Expense Account:Link/Account:140", "Qty:Float:120", "Rate:Currency:120",
"Amount:Currency:120"]
def get_conditions(filters):
conditions = ""
if filters.get("account"): conditions += " and pi.credit_to = %(account)s"
if filters.get("item_code"): conditions += " and pi_item.item_code = %(item_code)s"
if filters.get("from_date"): conditions += " and pi.posting_date>=%(from_date)s"
if filters.get("to_date"): conditions += " and pi.posting_date<=%(to_date)s"
return conditions
def get_items(filters):
conditions = get_conditions(filters)
return webnotes.conn.sql("""select pi.name, pi.posting_date, pi.credit_to, pi.company,
pi.supplier, pi.remarks, pi_item.item_code, pi_item.item_name, pi_item.item_group,
pi_item.project_name, pi_item.purchase_order, pi_item.purchase_receipt,
pi_item.expense_head, pi_item.qty, pi_item.rate, pi_item.amount
from `tabPurchase Invoice` pi, `tabPurchase Invoice Item` pi_item
where pi.name = pi_item.parent and pi.docstatus = 1 %s
order by pi.posting_date desc, pi_item.item_code desc""" % conditions, filters, as_dict=1)
def get_aii_accounts():
aii_account_map = {}
for d in webnotes.conn.sql("select name, stock_received_but_not_billed from tabCompany",
as_dict=1):
aii_account_map.setdefault(d.name, d.stock_received_but_not_billed)
return aii_account_map

View File

@@ -0,0 +1,22 @@
[
{
"creation": "2013-06-05 15:37:30",
"docstatus": 0,
"modified": "2013-06-05 15:37:30",
"modified_by": "Administrator",
"owner": "Administrator"
},
{
"add_total_row": 1,
"doctype": "Report",
"is_standard": "Yes",
"name": "__common__",
"ref_doctype": "Purchase Invoice",
"report_name": "Item-wise Purchase Register",
"report_type": "Script Report"
},
{
"doctype": "Report",
"name": "Item-wise Purchase Register"
}
]

View File

@@ -0,0 +1,39 @@
wn.query_reports["Item-wise Sales Register"] = {
"filters": [
{
"fieldname":"from_date",
"label": "From Date",
"fieldtype": "Date",
"default": wn.defaults.get_user_default("year_start_date"),
"width": "80"
},
{
"fieldname":"to_date",
"label": "To Date",
"fieldtype": "Date",
"default": get_today()
},
{
"fieldname": "item_code",
"label": "Item",
"fieldtype": "Link",
"options": "Item",
},
{
"fieldname":"account",
"label": "Account",
"fieldtype": "Link",
"options": "Account",
"get_query": function() {
return {
"query": "accounts.utils.get_account_list",
"filters": {
"is_pl_account": "No",
"debit_or_credit": "Debit",
"master_type": "Customer"
}
}
}
}
]
}

View File

@@ -0,0 +1,67 @@
# ERPNext - web based ERP (http://erpnext.com)
# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from __future__ import unicode_literals
import webnotes
from webnotes.utils import flt
def execute(filters=None):
if not filters: filters = {}
columns = get_columns()
item_list = get_items(filters)
data = []
for d in item_list:
data.append([d.item_code, d.item_name, d.item_group, d.name, d.posting_date, d.customer,
d.debit_to, d.territory, d.project_name, d.company, d.sales_order, d.delivery_note,
d.income_account, d.qty, d.basic_rate, d.amount])
return columns, data
def get_columns():
return [
"Item Code:Link/Item:120", "Item Name::120", "Item Group:Link/Item Group:100",
"Invoice:Link/Sales Invoice:120", "Posting Date:Date:80", "Customer:Link/Customer:120",
"Customer Account:Link/Account:120", "Territory:Link/Territory:80",
"Project:Link/Project:80", "Company:Link/Company:100", "Sales Order:Link/Sales Order:100",
"Delivery Note:Link/Delivery Note:100", "Income Account:Link/Account:140",
"Qty:Float:120", "Rate:Currency:120", "Amount:Currency:120"
]
def get_conditions(filters):
conditions = ""
if filters.get("account"): conditions += " and si.debit_to = %(account)s"
if filters.get("item_code"): conditions += " and si_item.item_code = %(item_code)s"
if filters.get("from_date"): conditions += " and si.posting_date>=%(from_date)s"
if filters.get("to_date"): conditions += " and si.posting_date<=%(to_date)s"
return conditions
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.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
where si.name = si_item.parent and si.docstatus = 1 %s
order by si.posting_date desc, si_item.item_code desc""" % conditions, filters, as_dict=1)

View File

@@ -0,0 +1,22 @@
[
{
"creation": "2013-05-13 17:50:55",
"docstatus": 0,
"modified": "2013-05-13 17:50:55",
"modified_by": "Administrator",
"owner": "Administrator"
},
{
"add_total_row": 1,
"doctype": "Report",
"is_standard": "Yes",
"name": "__common__",
"ref_doctype": "Sales Invoice",
"report_name": "Item-wise Sales Register",
"report_type": "Script Report"
},
{
"doctype": "Report",
"name": "Item-wise Sales Register"
}
]