Merge branch 'master' into pos_fetch

This commit is contained in:
Anand Doshi
2013-05-01 13:07:42 +05:30
63 changed files with 1026 additions and 569 deletions

View File

@@ -1,6 +1,6 @@
[ [
{ {
"creation": "2013-01-30 12:49:46", "creation": "2013-03-07 14:48:29",
"docstatus": 0, "docstatus": 0,
"modified": "2013-02-13 11:29:18", "modified": "2013-02-13 11:29:18",
"modified_by": "Administrator", "modified_by": "Administrator",
@@ -24,17 +24,13 @@
"permlevel": 0 "permlevel": 0
}, },
{ {
"create": 1,
"doctype": "DocPerm", "doctype": "DocPerm",
"name": "__common__", "name": "__common__",
"parent": "C-Form", "parent": "C-Form",
"parentfield": "permissions", "parentfield": "permissions",
"parenttype": "DocType", "parenttype": "DocType",
"permlevel": 0,
"read": 1, "read": 1,
"report": 1, "submit": 0
"submit": 0,
"write": 1
}, },
{ {
"doctype": "DocType", "doctype": "DocType",
@@ -156,15 +152,6 @@
"print_hide": 0, "print_hide": 0,
"read_only": 1 "read_only": 1
}, },
{
"doctype": "DocField",
"fieldname": "file_list",
"fieldtype": "Text",
"hidden": 1,
"label": "File List",
"print_hide": 1,
"read_only": 0
},
{ {
"doctype": "DocField", "doctype": "DocField",
"fieldname": "amended_from", "fieldname": "amended_from",
@@ -176,11 +163,28 @@
"read_only": 1 "read_only": 1
}, },
{ {
"create": 1,
"doctype": "DocPerm", "doctype": "DocPerm",
"role": "Accounts User" "permlevel": 0,
"report": 1,
"role": "Accounts User",
"write": 1
}, },
{ {
"create": 1,
"doctype": "DocPerm", "doctype": "DocPerm",
"role": "Accounts Manager" "permlevel": 0,
"report": 1,
"role": "Accounts Manager",
"write": 1
},
{
"amend": 0,
"cancel": 0,
"create": 0,
"doctype": "DocPerm",
"match": "",
"permlevel": 1,
"role": "All"
} }
] ]

View File

@@ -81,7 +81,7 @@ class DocType(DocTypeNestedSet):
""" """
Cost Center name must be unique Cost Center name must be unique
""" """
if (self.doc.__islocal or not self.doc.name) and webnotes.conn.sql("select name from `tabCost Center` where cost_center_name = %s and company_name=%s", (self.doc.cost_center_name, self.doc.company_name)): if (self.doc.fields.get("__islocal") or not self.doc.name) and webnotes.conn.sql("select name from `tabCost Center` where cost_center_name = %s and company_name=%s", (self.doc.cost_center_name, self.doc.company_name)):
msgprint("Cost Center Name already exists, please rename", raise_exception=1) msgprint("Cost Center Name already exists, please rename", raise_exception=1)
self.validate_mandatory() self.validate_mandatory()

View File

@@ -109,7 +109,7 @@ class DocType:
msgprint(_("Account") + ": " + self.doc.account + _(" has been freezed. \ msgprint(_("Account") + ": " + self.doc.account + _(" has been freezed. \
Only Accounts Manager can do transaction against this account"), raise_exception=1) Only Accounts Manager can do transaction against this account"), raise_exception=1)
if ret and ret[0]["company"] != self.doc.company: if self.doc.is_cancelled in ("No", None) and ret and ret[0]["company"] != self.doc.company:
msgprint(_("Account") + ": " + self.doc.account + _(" does not belong to the company") \ msgprint(_("Account") + ": " + self.doc.account + _(" does not belong to the company") \
+ ": " + self.doc.company, raise_exception=1) + ": " + self.doc.company, raise_exception=1)
@@ -124,9 +124,10 @@ class DocType:
return self.cost_center_company[self.doc.cost_center] return self.cost_center_company[self.doc.cost_center]
if self.doc.cost_center and _get_cost_center_company() != self.doc.company: if self.doc.is_cancelled in ("No", None) and \
msgprint(_("Cost Center") + ": " + self.doc.cost_center \ self.doc.cost_center and _get_cost_center_company() != self.doc.company:
+ _(" does not belong to the company") + ": " + self.doc.company, raise_exception=True) msgprint(_("Cost Center") + ": " + self.doc.cost_center \
+ _(" does not belong to the company") + ": " + self.doc.company, raise_exception=True)
def check_freezing_date(self, adv_adj): def check_freezing_date(self, adv_adj):
""" """

View File

@@ -1,6 +1,6 @@
[ [
{ {
"creation": "2013-03-07 13:16:13", "creation": "2013-04-09 10:18:10",
"docstatus": 0, "docstatus": 0,
"modified": "2013-03-22 18:17:14", "modified": "2013-03-22 18:17:14",
"modified_by": "Administrator", "modified_by": "Administrator",
@@ -30,9 +30,7 @@
"parent": "Purchase Invoice", "parent": "Purchase Invoice",
"parentfield": "permissions", "parentfield": "permissions",
"parenttype": "DocType", "parenttype": "DocType",
"permlevel": 0, "read": 1
"read": 1,
"report": 1
}, },
{ {
"doctype": "DocType", "doctype": "DocType",
@@ -758,19 +756,69 @@
"reqd": 0 "reqd": 0
}, },
{ {
"doctype": "DocField", "amend": 0,
"fieldname": "file_list", "cancel": 0,
"fieldtype": "Text", "create": 0,
"hidden": 1, "doctype": "DocPerm",
"label": "File List", "match": "",
"no_copy": 1, "permlevel": 1,
"print_hide": 1 "report": 0,
"role": "Accounts Manager",
"submit": 0,
"write": 0
}, },
{ {
"amend": 1, "amend": 1,
"cancel": 1, "cancel": 1,
"create": 1, "create": 1,
"doctype": "DocPerm", "doctype": "DocPerm",
"permlevel": 0,
"report": 1,
"role": "Accounts Manager",
"submit": 1,
"write": 1
},
{
"amend": 0,
"cancel": 0,
"create": 0,
"doctype": "DocPerm",
"match": "",
"permlevel": 1,
"report": 0,
"role": "Accounts User",
"submit": 0,
"write": 0
},
{
"amend": 0,
"cancel": 0,
"create": 0,
"doctype": "DocPerm",
"match": "",
"permlevel": 1,
"role": "Purchase User",
"submit": 0
},
{
"amend": 0,
"cancel": 0,
"create": 1,
"doctype": "DocPerm",
"match": "",
"permlevel": 0,
"report": 1,
"role": "Purchase User",
"submit": 0,
"write": 1
},
{
"amend": 1,
"cancel": 1,
"create": 1,
"doctype": "DocPerm",
"permlevel": 0,
"report": 1,
"role": "Accounts User", "role": "Accounts User",
"submit": 1, "submit": 1,
"write": 1 "write": 1
@@ -778,6 +826,8 @@
{ {
"doctype": "DocPerm", "doctype": "DocPerm",
"match": "supplier", "match": "supplier",
"permlevel": 0,
"report": 1,
"role": "Supplier" "role": "Supplier"
} }
] ]

View File

@@ -30,9 +30,7 @@
"parent": "Sales Invoice", "parent": "Sales Invoice",
"parentfield": "permissions", "parentfield": "permissions",
"parenttype": "DocType", "parenttype": "DocType",
"permlevel": 0, "read": 1
"read": 1,
"report": 1
}, },
{ {
"doctype": "DocType", "doctype": "DocType",
@@ -1285,21 +1283,13 @@
"read_only": 0, "read_only": 0,
"report_hide": 1 "report_hide": 1
}, },
{
"doctype": "DocField",
"fieldname": "file_list",
"fieldtype": "Text",
"hidden": 1,
"label": "File List",
"no_copy": 1,
"print_hide": 1,
"read_only": 0
},
{ {
"amend": 1, "amend": 1,
"cancel": 1, "cancel": 1,
"create": 1, "create": 1,
"doctype": "DocPerm", "doctype": "DocPerm",
"permlevel": 0,
"report": 1,
"role": "Accounts User", "role": "Accounts User",
"submit": 1, "submit": 1,
"write": 1 "write": 1
@@ -1307,6 +1297,8 @@
{ {
"doctype": "DocPerm", "doctype": "DocPerm",
"match": "customer", "match": "customer",
"permlevel": 0,
"report": 1,
"role": "Customer" "role": "Customer"
} },
] ]

View File

@@ -154,6 +154,11 @@ wn.module_page["Accounts"] = [
route: "query-report/Sales Register", route: "query-report/Sales Register",
doctype: "Sales Invoice" doctype: "Sales Invoice"
}, },
{
"label":wn._("Purchase Register"),
route: "query-report/Purchase Register",
doctype: "Purchase Invoice"
},
] ]
}, },
{ {

View File

@@ -186,7 +186,6 @@ erpnext.GeneralLedger = wn.views.GridReport.extend({
var totals = this.make_summary_row("Totals", this.account); var totals = this.make_summary_row("Totals", this.account);
var grouped_ledgers = {}; var grouped_ledgers = {};
$.each(data, function(i, item) { $.each(data, function(i, item) {
if((me.is_default("company") ? true : me.apply_filter(item, "company")) && if((me.is_default("company") ? true : me.apply_filter(item, "company")) &&
(me.account ? me.is_child_account(me.account, item.account) (me.account ? me.is_child_account(me.account, item.account)
@@ -217,8 +216,7 @@ erpnext.GeneralLedger = wn.views.GridReport.extend({
grouped_ledgers[item.account].totals.debit += item.debit; grouped_ledgers[item.account].totals.debit += item.debit;
grouped_ledgers[item.account].totals.credit += item.credit; grouped_ledgers[item.account].totals.credit += item.credit;
} }
if(item.account) {
if(me.account) {
item.against_account = me.voucher_accounts[item.voucher_type + ":" item.against_account = me.voucher_accounts[item.voucher_type + ":"
+ item.voucher_no][(item.debit > 0 ? "credits" : "debits")].join(", "); + item.voucher_no][(item.debit > 0 ? "credits" : "debits")].join(", ");
} }

View File

@@ -19,7 +19,6 @@ def execute(filters=None):
and nowdate() or filters.get("report_date") and nowdate() or filters.get("report_date")
data = [] data = []
total_invoiced_amount = total_paid = total_outstanding = 0
for gle in entries: for gle in entries:
if cstr(gle.against_voucher) == gle.voucher_no or not gle.against_voucher \ if cstr(gle.against_voucher) == gle.voucher_no or not gle.against_voucher \
or [gle.against_voucher_type, gle.against_voucher] in entries_after_report_date: or [gle.against_voucher_type, gle.against_voucher] in entries_after_report_date:
@@ -47,16 +46,9 @@ def execute(filters=None):
ageing_based_on_date = due_date ageing_based_on_date = due_date
else: else:
ageing_based_on_date = gle.posting_date ageing_based_on_date = gle.posting_date
row += get_ageing_data(ageing_based_on_date, age_on, outstanding_amount)
# Add to total row += get_ageing_data(ageing_based_on_date, age_on, outstanding_amount)
total_invoiced_amount += flt(invoiced_amount)
total_paid += flt(paid_amount)
total_outstanding += flt(outstanding_amount)
data.append(row) data.append(row)
if data:
data.append(["", "", "", "", "", "", "", "Total", "", total_invoiced_amount, total_paid,
total_outstanding, "", "", "", ""])
return columns, data return columns, data

View File

@@ -2,11 +2,12 @@
{ {
"creation": "2013-04-22 16:16:03", "creation": "2013-04-22 16:16:03",
"docstatus": 0, "docstatus": 0,
"modified": "2013-04-23 14:54:27", "modified": "2013-04-30 17:55:54",
"modified_by": "Administrator", "modified_by": "Administrator",
"owner": "Administrator" "owner": "Administrator"
}, },
{ {
"add_total_row": 1,
"doctype": "Report", "doctype": "Report",
"is_standard": "Yes", "is_standard": "Yes",
"name": "__common__", "name": "__common__",

View File

@@ -18,7 +18,6 @@ def execute(filters=None):
and nowdate() or filters.get("report_date") and nowdate() or filters.get("report_date")
data = [] data = []
total_invoiced_amount = total_payment = total_outstanding = 0
for gle in entries: for gle in entries:
if cstr(gle.against_voucher) == gle.voucher_no or not gle.against_voucher \ if cstr(gle.against_voucher) == gle.voucher_no or not gle.against_voucher \
or [gle.against_voucher_type, gle.against_voucher] in entries_after_report_date: or [gle.against_voucher_type, gle.against_voucher] in entries_after_report_date:
@@ -42,15 +41,7 @@ def execute(filters=None):
ageing_based_on_date = gle.posting_date ageing_based_on_date = gle.posting_date
row += get_ageing_data(ageing_based_on_date, age_on, outstanding_amount) row += get_ageing_data(ageing_based_on_date, age_on, outstanding_amount)
# Add to total
total_invoiced_amount += flt(invoiced_amount)
total_payment += flt(payment_amount)
total_outstanding += flt(outstanding_amount)
data.append(row) data.append(row)
if data:
data.append(["", "", "", "", "", "", "Total", total_invoiced_amount, total_payment,
total_outstanding, "", "", "", ""])
return columns, data return columns, data

View File

@@ -2,11 +2,12 @@
{ {
"creation": "2013-04-16 11:31:13", "creation": "2013-04-16 11:31:13",
"docstatus": 0, "docstatus": 0,
"modified": "2013-04-16 11:31:13", "modified": "2013-04-30 17:54:47",
"modified_by": "Administrator", "modified_by": "Administrator",
"owner": "Administrator" "owner": "Administrator"
}, },
{ {
"add_total_row": 1,
"doctype": "Report", "doctype": "Report",
"is_standard": "Yes", "is_standard": "Yes",
"name": "__common__", "name": "__common__",

View File

@@ -0,0 +1,42 @@
wn.query_reports["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":"account",
"label": "Account",
"fieldtype": "Link",
"options": "Account",
"get_query": function() {
var company = wn.query_report.filters_by_name.company.get_value();
return {
"query": "accounts.utils.get_account_list",
"filters": {
"is_pl_account": "No",
"debit_or_credit": "Credit",
"company": company,
"master_type": "Supplier"
}
}
}
},
{
"fieldname":"company",
"label": "Company",
"fieldtype": "Link",
"options": "Company",
"default": sys_defaults.company
}
]
}

View File

@@ -0,0 +1,147 @@
# 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, expense_accounts, tax_accounts = get_columns()
invoice_list = get_invoices(filters)
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)
account_map = get_account_details(invoice_list)
data = []
for inv in invoice_list:
# invoice details
purchase_order = ", ".join(invoice_po_pr_map.get(inv.name, {}).get("purchase_order", []))
purchase_receipt = ", ".join(invoice_po_pr_map.get(inv.name, {}).get("purchase_receipt", []))
row = [inv.name, inv.posting_date, inv.supplier, inv.credit_to,
account_map.get(inv.credit_to), inv.project_name, inv.bill_no, inv.bill_date,
inv.remarks, purchase_order, purchase_receipt]
# map expense values
for expense_acc in expense_accounts:
row.append(invoice_expense_map.get(inv.name, {}).get(expense_acc))
# net total
row.append(inv.net_total)
# tax account
for tax_acc in tax_accounts:
row.append(invoice_tax_map.get(inv.name, {}).get(tax_acc))
# total tax, grand total
row += [inv.total_tax, inv.grand_total]
data.append(row)
return columns, data
def get_columns():
"""return columns based on filters"""
columns = [
"Invoice:Link/Purchase Invoice:120", "Posting Date:Date:80", "Supplier:Link/Supplier:120",
"Supplier Account:Link/Account:120", "Account Group:LInk/Account:120",
"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 = webnotes.conn.sql_list("""select distinct expense_head
from `tabPurchase Invoice Item` where docstatus = 1 and ifnull(expense_head, '') != ''
order by expense_head""")
tax_accounts = webnotes.conn.sql_list("""select distinct account_head
from `tabPurchase Taxes and Charges` where parenttype = 'Purchase Invoice'
and docstatus = 1 and ifnull(account_head, '') != '' order by account_head""")
columns = columns + [(account + ":Currency:120") for account in expense_accounts] + \
["Net Total:Currency:120"] + [(account + ":Currency:120") for account in tax_accounts] + \
["Total Tax:Currency:120"] + ["Grand Total:Currency:120"]
return columns, expense_accounts, tax_accounts
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("from_date"): conditions += " and posting_date>=%(from_date)s"
if filters.get("to_date"): conditions += " and posting_date<=%(to_date)s"
return conditions
def get_invoices(filters):
conditions = get_conditions(filters)
return webnotes.conn.sql("""select name, posting_date, credit_to, project_name, supplier,
bill_no, bill_date, remarks, net_total, total_tax, grand_total
from `tabPurchase Invoice` where docstatus = 1 %s
order by posting_date desc, name desc""" % conditions, filters, as_dict=1)
def get_invoice_expense_map(invoice_list):
expense_details = webnotes.conn.sql("""select parent, expense_head, sum(amount) as amount
from `tabPurchase Invoice Item` where parent in (%s) group by parent, expense_head""" %
', '.join(['%s']*len(invoice_list)), tuple([inv.name for inv in invoice_list]), as_dict=1)
invoice_expense_map = {}
for d in expense_details:
invoice_expense_map.setdefault(d.parent, webnotes._dict()).setdefault(d.expense_head, [])
invoice_expense_map[d.parent][d.expense_head] = flt(d.amount)
return invoice_expense_map
def get_invoice_tax_map(invoice_list):
tax_details = webnotes.conn.sql("""select parent, account_head, sum(tax_amount) as tax_amount
from `tabPurchase Taxes and Charges` where parent in (%s) group by parent, account_head""" %
', '.join(['%s']*len(invoice_list)), tuple([inv.name for inv in invoice_list]), as_dict=1)
invoice_tax_map = {}
for d in tax_details:
invoice_tax_map.setdefault(d.parent, webnotes._dict()).setdefault(d.account_head, [])
invoice_tax_map[d.parent][d.account_head] = flt(d.tax_amount)
return invoice_tax_map
def get_invoice_po_pr_map(invoice_list):
pi_items = webnotes.conn.sql("""select parent, purchase_order, purchase_receipt
from `tabPurchase Invoice Item` where parent in (%s)
and (ifnull(purchase_order, '') != '' or ifnull(purchase_receipt, '') != '')""" %
', '.join(['%s']*len(invoice_list)), tuple([inv.name for inv in invoice_list]), as_dict=1)
invoice_po_pr_map = {}
for d in pi_items:
if d.purchase_order:
invoice_po_pr_map.setdefault(d.parent, webnotes._dict()).setdefault(
"purchase_order", []).append(d.purchase_order)
if d.purchase_receipt:
invoice_po_pr_map.setdefault(d.parent, webnotes._dict()).setdefault(
"purchase_receipt", []).append(d.purchase_receipt)
return invoice_po_pr_map
def get_account_details(invoice_list):
account_map = {}
accounts = list(set([inv.credit_to for inv in invoice_list]))
for acc in webnotes.conn.sql("""select name, parent_account from tabAccount
where name in (%s)""" % ", ".join(["%s"]*len(accounts)), tuple(accounts), as_dict=1):
account_map.setdefault(acc.name, "")
account_map[acc.name] = acc.parent_account
return account_map

View File

@@ -0,0 +1,22 @@
[
{
"creation": "2013-04-29 16:13:11",
"docstatus": 0,
"modified": "2013-04-30 17:51:19",
"modified_by": "Administrator",
"owner": "Administrator"
},
{
"add_total_row": 1,
"doctype": "Report",
"is_standard": "Yes",
"name": "__common__",
"ref_doctype": "Purchase Invoice",
"report_name": "Purchase Register",
"report_type": "Script Report"
},
{
"doctype": "Report",
"name": "Purchase Register"
}
]

View File

@@ -94,8 +94,8 @@ def get_conditions(filters):
def get_invoices(filters): def get_invoices(filters):
conditions = get_conditions(filters) conditions = get_conditions(filters)
return webnotes.conn.sql("""select name, posting_date, territory, debit_to, territory, return webnotes.conn.sql("""select name, posting_date, debit_to, project_name, customer,
project_name, customer, remarks, net_total, other_charges_total, grand_total remarks, net_total, other_charges_total, grand_total
from `tabSales Invoice` where docstatus = 1 %s from `tabSales Invoice` where docstatus = 1 %s
order by posting_date desc, name desc""" % conditions, filters, as_dict=1) order by posting_date desc, name desc""" % conditions, filters, as_dict=1)

View File

@@ -2,11 +2,12 @@
{ {
"creation": "2013-04-23 18:15:29", "creation": "2013-04-23 18:15:29",
"docstatus": 0, "docstatus": 0,
"modified": "2013-04-23 18:15:29", "modified": "2013-04-30 17:53:10",
"modified_by": "Administrator", "modified_by": "Administrator",
"owner": "Administrator" "owner": "Administrator"
}, },
{ {
"add_total_row": 1,
"doctype": "Report", "doctype": "Report",
"is_standard": "Yes", "is_standard": "Yes",
"name": "__common__", "name": "__common__",

View File

@@ -1,29 +1,32 @@
[ [
{ {
"owner": "Administrator", "creation": "2012-05-14 18:05:41",
"docstatus": 0, "docstatus": 0,
"creation": "2012-04-03 12:49:50", "modified": "2013-04-30 14:49:06",
"modified_by": "Administrator", "modified_by": "Administrator",
"modified": "2012-04-03 12:49:50" "owner": "Administrator"
}, },
{ {
"description": "Bank Clearance report", "columns": "Journal Voucher\u0001ID,Journal Voucher Detail\u0001Account,Journal Voucher Detail\u0001Debit,Journal Voucher Detail\u0001Credit,Journal Voucher\u0001Clearance Date,Journal Voucher\u0001Cheque No,Journal Voucher\u0001Cheque Date,Journal Voucher\u0001Voucher Date,Journal Voucher\u0001Posting Date,Journal Voucher Detail\u0001Against Payable,Journal Voucher Detail\u0001Against Receivable",
"parent_doc_type": "Journal Voucher",
"module": "Accounts",
"standard": "Yes",
"sort_order": "DESC",
"filters": "{'Journal Voucher\u0001Submitted':1,'Journal Voucher\u0001Voucher Type':'','Journal Voucher\u0001Is Opening':'','Journal Voucher\u0001Fiscal Year':'','Journal Voucher\u0001Company':'','Journal Voucher\u0001TDS Applicable':'','Journal Voucher\u0001TDS Category':''}",
"dis_filters": "fiscal_year",
"doc_type": "Journal Voucher Detail",
"name": "__common__",
"doctype": "Search Criteria",
"sort_by": "ID",
"page_len": 50,
"criteria_name": "Bank Clearance report", "criteria_name": "Bank Clearance report",
"columns": "Journal Voucher\u0001ID,Journal Voucher Detail\u0001Account,Journal Voucher Detail\u0001Debit,Journal Voucher Detail\u0001Credit,Journal Voucher\u0001Clearance Date,Journal Voucher\u0001Cheque No,Journal Voucher\u0001Cheque Date,Journal Voucher\u0001Voucher Date,Journal Voucher\u0001Posting Date,Journal Voucher Detail\u0001Against Payable,Journal Voucher Detail\u0001Against Receivable" "custom_query": "",
"description": "Bank Clearance report",
"dis_filters": "fiscal_year",
"disabled": 0,
"doc_type": "Journal Voucher Detail",
"doctype": "Search Criteria",
"filters": "{'Journal Voucher\u0001Submitted':1,'Journal Voucher\u0001Voucher Type':'','Journal Voucher\u0001Is Opening':'','Journal Voucher\u0001Fiscal Year':'','Journal Voucher\u0001Company':'','Journal Voucher\u0001TDS Applicable':'','Journal Voucher\u0001TDS Category':''}",
"module": "Accounts",
"name": "__common__",
"page_len": 50,
"parent_doc_type": "Journal Voucher",
"report_script": null,
"sort_by": "ID",
"sort_order": "DESC",
"standard": "Yes"
}, },
{ {
"name": "bank_clearance_report", "doctype": "Search Criteria",
"doctype": "Search Criteria" "name": "bank_clearance_report"
} }
] ]

View File

@@ -1,6 +1,6 @@
[ [
{ {
"creation": "2013-01-29 19:25:50", "creation": "2013-03-25 16:01:24",
"docstatus": 0, "docstatus": 0,
"modified": "2013-02-18 13:37:11", "modified": "2013-02-18 13:37:11",
"modified_by": "Administrator", "modified_by": "Administrator",
@@ -803,20 +803,12 @@
"print_hide": 1, "print_hide": 1,
"read_only": 1 "read_only": 1
}, },
{
"doctype": "DocField",
"fieldname": "file_list",
"fieldtype": "Text",
"hidden": 1,
"label": "File List",
"no_copy": 1,
"print_hide": 1
},
{ {
"amend": 0, "amend": 0,
"cancel": 0, "cancel": 0,
"create": 0, "create": 0,
"doctype": "DocPerm", "doctype": "DocPerm",
"match": "",
"permlevel": 1, "permlevel": 1,
"report": 0, "report": 0,
"role": "Material User", "role": "Material User",
@@ -839,6 +831,7 @@
"cancel": 0, "cancel": 0,
"create": 0, "create": 0,
"doctype": "DocPerm", "doctype": "DocPerm",
"match": "",
"permlevel": 1, "permlevel": 1,
"report": 0, "report": 0,
"role": "Purchase Manager", "role": "Purchase Manager",
@@ -861,6 +854,7 @@
"cancel": 1, "cancel": 1,
"create": 1, "create": 1,
"doctype": "DocPerm", "doctype": "DocPerm",
"match": "",
"permlevel": 0, "permlevel": 0,
"report": 1, "report": 1,
"role": "Purchase User", "role": "Purchase User",
@@ -872,6 +866,7 @@
"cancel": 0, "cancel": 0,
"create": 0, "create": 0,
"doctype": "DocPerm", "doctype": "DocPerm",
"match": "",
"permlevel": 1, "permlevel": 1,
"role": "All", "role": "All",
"submit": 0 "submit": 0

View File

@@ -1,6 +1,6 @@
[ [
{ {
"creation": "2013-01-29 19:25:54", "creation": "2013-03-25 16:01:25",
"docstatus": 0, "docstatus": 0,
"modified": "2013-02-18 13:40:17", "modified": "2013-02-18 13:40:17",
"modified_by": "Administrator", "modified_by": "Administrator",
@@ -663,15 +663,6 @@
"print_hide": 1, "print_hide": 1,
"read_only": 1 "read_only": 1
}, },
{
"doctype": "DocField",
"fieldname": "file_list",
"fieldtype": "Text",
"hidden": 1,
"label": "File List",
"no_copy": 1,
"print_hide": 1
},
{ {
"amend": 1, "amend": 1,
"cancel": 1, "cancel": 1,
@@ -732,6 +723,7 @@
"cancel": 0, "cancel": 0,
"create": 0, "create": 0,
"doctype": "DocPerm", "doctype": "DocPerm",
"match": "",
"permlevel": 1, "permlevel": 1,
"report": 0, "report": 0,
"role": "All", "role": "All",

View File

@@ -45,12 +45,13 @@ class BuyingController(StockController):
def validate_stock_or_nonstock_items(self): def validate_stock_or_nonstock_items(self):
items = [d.item_code for d in self.doclist.get({"parentfield": self.fname})] items = [d.item_code for d in self.doclist.get({"parentfield": self.fname})]
if self.stock_items and len(items) > len(self.stock_items): if self.stock_items:
nonstock_items = list(set(items) - set(self.stock_items)) nonstock_items = list(set(items) - set(self.stock_items))
webnotes.msgprint(_("Stock and non-stock items can not be entered at the same ") + if nonstock_items:
self.doc.doctype + _(""". You should make separate documents for them. webnotes.msgprint(_("Stock and non-stock items can not be entered in the same ") +
Stock Items: """) + ", ".join(self.stock_items) + _(""" self.doc.doctype + _(""". You should make separate documents for them.
Non-stock Items: """) + ", ".join(nonstock_items), raise_exception=1) Stock Items: """) + ", ".join(self.stock_items) + _("""
Non-stock Items: """) + ", ".join(nonstock_items), raise_exception=1)
elif items and not self.stock_items: elif items and not self.stock_items:
tax_for_valuation = [d.account_head for d in tax_for_valuation = [d.account_head for d in

View File

@@ -1,5 +1,8 @@
erpnext.updates = [ erpnext.updates = [
["18th April", ["Cost Center: Set a default Cost Center for a Company"]],
["12th April", ["Employee: List of Leave Approvers who can approve the Employee's Leave Applications"]], ["12th April", ["Employee: List of Leave Approvers who can approve the Employee's Leave Applications"]],
["10th April", ["Redesigned File Uploads and added File Manager in Setup"]],
["3rd April", ["Update Manager: Open source users can update their ERPNext instance from Setup > Update Manager"]],
["27th March", ["Rename multiple items together. Go to Setup > Rename Tool"]], ["27th March", ["Rename multiple items together. Go to Setup > Rename Tool"]],
["26th March", ["Added project to Stock Ledger and Balance", ["26th March", ["Added project to Stock Ledger and Balance",
"Added Default Cash Account in Company."]], "Added Default Cash Account in Company."]],

View File

@@ -101,18 +101,19 @@ class DocType:
if self.doc.gender: if self.doc.gender:
profile_wrapper.doc.gender = self.doc.gender profile_wrapper.doc.gender = self.doc.gender
if self.doc.image and self.doc.file_list: if self.doc.image:
# add to file list and user_image if not profile_wrapper.doc.user_image == self.doc.image:
for file_args in self.doc.file_list.split("\n"): profile_wrapper.doc.user_image = self.doc.image
fname, fid = file_args.split(",") try:
if self.doc.image == fname: webnotes.doc({
new_file_args = fname + "," + fid "doctype": "File Data",
file_list = cstr(profile_wrapper.doc.file_list).split("\n") "file_name": self.doc.image,
if new_file_args not in file_list: "attached_to_doctype": "Profile",
file_list += [new_file_args] "attached_to_name": self.doc.user_id
profile_wrapper.doc.file_list = "\n".join(file_list) }).insert()
profile_wrapper.doc.user_image = fname except webnotes.DuplicateEntryError, e:
break # already exists
pass
profile_wrapper.save() profile_wrapper.save()

View File

@@ -30,9 +30,7 @@
"parent": "Employee", "parent": "Employee",
"parentfield": "permissions", "parentfield": "permissions",
"parenttype": "DocType", "parenttype": "DocType",
"permlevel": 0,
"read": 1, "read": 1,
"report": 1,
"submit": 0 "submit": 0
}, },
{ {
@@ -741,14 +739,6 @@
"oldfieldname": "feedback", "oldfieldname": "feedback",
"oldfieldtype": "Text" "oldfieldtype": "Text"
}, },
{
"doctype": "DocField",
"fieldname": "file_list",
"fieldtype": "Text",
"hidden": 1,
"label": "File List",
"print_hide": 1
},
{ {
"doctype": "DocField", "doctype": "DocField",
"fieldname": "trash_reason", "fieldname": "trash_reason",
@@ -763,6 +753,18 @@
"create": 0, "create": 0,
"doctype": "DocPerm", "doctype": "DocPerm",
"match": "employee", "match": "employee",
"permlevel": 0,
"report": 1,
"role": "Employee",
"write": 0
},
{
"cancel": 0,
"create": 0,
"doctype": "DocPerm",
"match": "",
"permlevel": 1,
"report": 0,
"role": "Employee", "role": "Employee",
"write": 0 "write": 0
}, },
@@ -771,6 +773,8 @@
"create": 1, "create": 1,
"doctype": "DocPerm", "doctype": "DocPerm",
"match": "company", "match": "company",
"permlevel": 0,
"report": 1,
"role": "HR User", "role": "HR User",
"write": 1 "write": 1
}, },
@@ -778,7 +782,29 @@
"cancel": 1, "cancel": 1,
"create": 1, "create": 1,
"doctype": "DocPerm", "doctype": "DocPerm",
"permlevel": 0,
"report": 1,
"role": "HR Manager", "role": "HR Manager",
"write": 1 "write": 1
},
{
"cancel": 0,
"create": 0,
"doctype": "DocPerm",
"match": "",
"permlevel": 1,
"report": 0,
"role": "HR User",
"write": 0
},
{
"cancel": 0,
"create": 0,
"doctype": "DocPerm",
"match": "",
"permlevel": 1,
"report": 0,
"role": "HR Manager",
"write": 0
} }
] ]

View File

@@ -1,6 +1,6 @@
[ [
{ {
"creation": "2013-01-15 16:32:13", "creation": "2013-01-29 19:25:37",
"docstatus": 0, "docstatus": 0,
"modified": "2013-01-29 17:44:52", "modified": "2013-01-29 17:44:52",
"modified_by": "Administrator", "modified_by": "Administrator",
@@ -88,16 +88,6 @@
"fieldtype": "HTML", "fieldtype": "HTML",
"label": "Thread HTML" "label": "Thread HTML"
}, },
{
"doctype": "DocField",
"fieldname": "file_list",
"fieldtype": "Text",
"hidden": 1,
"in_list_view": 1,
"label": "File List",
"no_copy": 1,
"print_hide": 1
},
{ {
"doctype": "DocPerm" "doctype": "DocPerm"
} }

View File

@@ -1,6 +1,6 @@
[ [
{ {
"creation": "2013-02-18 18:37:56", "creation": "2013-02-20 11:18:11",
"docstatus": 0, "docstatus": 0,
"modified": "2013-02-19 16:30:05", "modified": "2013-02-19 16:30:05",
"modified_by": "Administrator", "modified_by": "Administrator",
@@ -8,7 +8,6 @@
}, },
{ {
"allow_attach": 1, "allow_attach": 1,
"allow_import": 1,
"autoname": "LAP/.#####", "autoname": "LAP/.#####",
"description": "Apply / Approve Leaves", "description": "Apply / Approve Leaves",
"doctype": "DocType", "doctype": "DocType",
@@ -227,16 +226,6 @@
"print_hide": 1, "print_hide": 1,
"read_only": 1 "read_only": 1
}, },
{
"doctype": "DocField",
"fieldname": "file_list",
"fieldtype": "Text",
"hidden": 1,
"label": "File List",
"no_copy": 1,
"permlevel": 0,
"print_hide": 1
},
{ {
"create": 1, "create": 1,
"doctype": "DocPerm", "doctype": "DocPerm",
@@ -251,6 +240,7 @@
"cancel": 0, "cancel": 0,
"create": 0, "create": 0,
"doctype": "DocPerm", "doctype": "DocPerm",
"match": "",
"permlevel": 1, "permlevel": 1,
"role": "All", "role": "All",
"submit": 0 "submit": 0
@@ -260,7 +250,6 @@
"cancel": 1, "cancel": 1,
"create": 1, "create": 1,
"doctype": "DocPerm", "doctype": "DocPerm",
"match": "company",
"permlevel": 0, "permlevel": 0,
"report": 1, "report": 1,
"role": "HR User", "role": "HR User",
@@ -269,8 +258,8 @@
}, },
{ {
"amend": 1, "amend": 1,
"cancel": 1, "cancel": 0,
"create": 1, "create": 0,
"doctype": "DocPerm", "doctype": "DocPerm",
"match": "leave_approver:user", "match": "leave_approver:user",
"permlevel": 0, "permlevel": 0,
@@ -284,6 +273,7 @@
"cancel": 0, "cancel": 0,
"create": 0, "create": 0,
"doctype": "DocPerm", "doctype": "DocPerm",
"match": "",
"permlevel": 1, "permlevel": 1,
"report": 1, "report": 1,
"role": "HR User", "role": "HR User",
@@ -295,6 +285,7 @@
"cancel": 0, "cancel": 0,
"create": 0, "create": 0,
"doctype": "DocPerm", "doctype": "DocPerm",
"match": "",
"permlevel": 1, "permlevel": 1,
"report": 1, "report": 1,
"role": "Leave Approver", "role": "Leave Approver",

View File

@@ -59,27 +59,22 @@ cur_frm.fields_dict["bom_operations"].grid.on_row_delete = function(cdt, cdn){
set_operation_no(doc); set_operation_no(doc);
} }
cur_frm.cscript.item = function(doc, dt, dn) { cur_frm.add_fetch("item", "description", "description");
if (doc.item) { cur_frm.add_fetch("item", "stock_uom", "uom");
get_server_fields('get_item_details', doc.item, '', doc, dt, dn, 1);
}
}
cur_frm.cscript.workstation = function(doc,dt,dn) { cur_frm.cscript.workstation = function(doc,dt,dn) {
var d = locals[dt][dn]; var d = locals[dt][dn];
if (d.workstation) { wn.model.with_doc("Workstation", d.workstation, function(i, v) {
var callback = function(r, rt) { d.hour_rate = v.hour_rate;
calculate_op_cost(doc, dt, dn); refresh_field("hour_rate");
calculate_total(doc); calculate_op_cost(doc);
} calculate_total(doc);
get_server_fields('get_workstation_details', d.workstation, });
'bom_operations', doc, dt, dn, 1, callback);
}
} }
cur_frm.cscript.hour_rate = function(doc, dt, dn) { cur_frm.cscript.hour_rate = function(doc, dt, dn) {
calculate_op_cost(doc, dt, dn); calculate_op_cost(doc);
calculate_total(doc); calculate_total(doc);
} }
@@ -114,7 +109,7 @@ var get_bom_material_detail= function(doc, cdt, cdn) {
$.extend(d, r.message); $.extend(d, r.message);
refresh_field("bom_materials"); refresh_field("bom_materials");
doc = locals[doc.doctype][doc.name]; doc = locals[doc.doctype][doc.name];
calculate_rm_cost(doc, cdt, cdn); calculate_rm_cost(doc);
calculate_total(doc); calculate_total(doc);
}, },
freeze: true freeze: true
@@ -124,7 +119,7 @@ var get_bom_material_detail= function(doc, cdt, cdn) {
cur_frm.cscript.qty = function(doc, cdt, cdn) { cur_frm.cscript.qty = function(doc, cdt, cdn) {
calculate_rm_cost(doc, cdt, cdn); calculate_rm_cost(doc);
calculate_total(doc); calculate_total(doc);
} }
@@ -134,12 +129,12 @@ cur_frm.cscript.rate = function(doc, cdt, cdn) {
msgprint("You can not change rate if BOM mentioned agianst any item"); msgprint("You can not change rate if BOM mentioned agianst any item");
get_bom_material_detail(doc, cdt, cdn); get_bom_material_detail(doc, cdt, cdn);
} else { } else {
calculate_rm_cost(doc, cdt, cdn); calculate_rm_cost(doc);
calculate_total(doc); calculate_total(doc);
} }
} }
var calculate_op_cost = function(doc, dt, dn) { var calculate_op_cost = function(doc) {
var op = getchildren('BOM Operation', doc.name, 'bom_operations'); var op = getchildren('BOM Operation', doc.name, 'bom_operations');
total_op_cost = 0; total_op_cost = 0;
for(var i=0;i<op.length;i++) { for(var i=0;i<op.length;i++) {
@@ -151,7 +146,7 @@ var calculate_op_cost = function(doc, dt, dn) {
refresh_field('operating_cost'); refresh_field('operating_cost');
} }
var calculate_rm_cost = function(doc, dt, dn) { var calculate_rm_cost = function(doc) {
var rm = getchildren('BOM Item', doc.name, 'bom_materials'); var rm = getchildren('BOM Item', doc.name, 'bom_materials');
total_rm_cost = 0; total_rm_cost = 0;
for(var i=0;i<rm.length;i++) { for(var i=0;i<rm.length;i++) {
@@ -201,7 +196,7 @@ cur_frm.fields_dict['bom_materials'].grid.get_field('bom_no').get_query = functi
} }
cur_frm.cscript.validate = function(doc, dt, dn) { cur_frm.cscript.validate = function(doc, dt, dn) {
calculate_op_cost(doc, dt, dn); calculate_op_cost(doc);
calculate_rm_cost(doc, dt, dn); calculate_rm_cost(doc);
calculate_total(doc); calculate_total(doc);
} }

View File

@@ -44,10 +44,11 @@ class DocType:
self.validate_main_item() self.validate_main_item()
self.validate_operations() self.validate_operations()
self.validate_materials() self.validate_materials()
self.set_bom_material_details()
self.calculate_cost()
def on_update(self): def on_update(self):
self.check_recursion() self.check_recursion()
self.calculate_cost()
self.update_exploded_items() self.update_exploded_items()
self.doc.save() self.doc.save()
@@ -74,14 +75,6 @@ class DocType:
return item return item
def get_item_details(self, item_code):
res = webnotes.conn.sql("""select description, stock_uom as uom
from `tabItem` where name=%s""", item_code, as_dict = 1)
return res and res[0] or {}
def get_workstation_details(self,workstation):
return {'hour_rate': webnotes.conn.get_value("Workstation", workstation, "hour_rate")}
def validate_rm_item(self, item): def validate_rm_item(self, item):
if item[0]['name'] == self.doc.item: if item[0]['name'] == self.doc.item:
msgprint("Item_code: %s in materials tab cannot be same as FG Item", msgprint("Item_code: %s in materials tab cannot be same as FG Item",
@@ -90,31 +83,41 @@ class DocType:
if not item or item[0]['docstatus'] == 2: if not item or item[0]['docstatus'] == 2:
msgprint("Item %s does not exist in system" % item[0]['item_code'], raise_exception = 1) msgprint("Item %s does not exist in system" % item[0]['item_code'], raise_exception = 1)
def get_bom_material_detail(self): def set_bom_material_details(self):
for item in self.doclist.get({"parentfield": "bom_materials"}):
ret = self.get_bom_material_detail({ "item_code": item.item_code, "bom_no": item.bom_no,
"qty": item.qty })
for r in ret:
if not item.fields.get(r):
item.fields[r] = ret[r]
def get_bom_material_detail(self, args=None):
""" Get raw material details like uom, desc and rate""" """ Get raw material details like uom, desc and rate"""
arg = webnotes.form_dict.get('args') if not args:
import json args = webnotes.form_dict.get('args')
arg = json.loads(arg) import json
args = json.loads(args)
item = self.get_item_det(arg['item_code']) item = self.get_item_det(args['item_code'])
self.validate_rm_item(item) self.validate_rm_item(item)
arg['bom_no'] = arg['bom_no'] or item and cstr(item[0]['default_bom']) or '' args['bom_no'] = args['bom_no'] or item and cstr(item[0]['default_bom']) or ''
arg.update(item[0]) args.update(item[0])
rate = self.get_rm_rate(arg) rate = self.get_rm_rate(args)
ret_item = { ret_item = {
'description' : item and arg['description'] or '', 'description' : item and args['description'] or '',
'stock_uom' : item and arg['stock_uom'] or '', 'stock_uom' : item and args['stock_uom'] or '',
'bom_no' : arg['bom_no'], 'bom_no' : args['bom_no'],
'rate' : rate 'rate' : rate
} }
return ret_item return ret_item
def get_rm_rate(self, arg): def get_rm_rate(self, arg):
""" Get raw material rate as per selected method, if bom exists takes bom cost """ """ Get raw material rate as per selected method, if bom exists takes bom cost """
rate = 0
if arg['bom_no']: if arg['bom_no']:
rate = self.get_bom_unitcost(arg['bom_no']) rate = self.get_bom_unitcost(arg['bom_no'])
elif arg and (arg['is_purchase_item'] == 'Yes' or arg['is_sub_contracted_item'] == 'Yes'): elif arg and (arg['is_purchase_item'] == 'Yes' or arg['is_sub_contracted_item'] == 'Yes'):
@@ -183,11 +186,14 @@ class DocType:
if not item: if not item:
msgprint("Item %s does not exists in the system or expired." % msgprint("Item %s does not exists in the system or expired." %
self.doc.item, raise_exception = 1) self.doc.item, raise_exception = 1)
elif item[0]['is_manufactured_item'] != 'Yes' \ elif item[0]['is_manufactured_item'] != 'Yes' \
and item[0]['is_sub_contracted_item'] != 'Yes': and item[0]['is_sub_contracted_item'] != 'Yes':
msgprint("""As Item: %s is not a manufactured / sub-contracted item, \ msgprint("""As Item: %s is not a manufactured / sub-contracted item, \
you can not make BOM for it""" % self.doc.item, raise_exception = 1) you can not make BOM for it""" % self.doc.item, raise_exception = 1)
else:
ret = webnotes.conn.get_value("Item", self.doc.item, ["description", "stock_uom"])
self.doc.description = ret[0]
self.doc.uom = ret[1]
def validate_operations(self): def validate_operations(self):
""" Check duplicate operation no""" """ Check duplicate operation no"""
@@ -293,9 +299,10 @@ class DocType:
"""Update workstation rate and calculates totals""" """Update workstation rate and calculates totals"""
total_op_cost = 0 total_op_cost = 0
for d in getlist(self.doclist, 'bom_operations'): for d in getlist(self.doclist, 'bom_operations'):
if d.workstation and not d.hour_rate:
d.hour_rate = webnotes.conn.get_value("Workstation", d.workstation, "hour_rate")
if d.hour_rate and d.time_in_mins: if d.hour_rate and d.time_in_mins:
d.operating_cost = flt(d.hour_rate) * flt(d.time_in_mins) / 60.0 d.operating_cost = flt(d.hour_rate) * flt(d.time_in_mins) / 60.0
d.save()
total_op_cost += flt(d.operating_cost) total_op_cost += flt(d.operating_cost)
self.doc.operating_cost = total_op_cost self.doc.operating_cost = total_op_cost
@@ -307,7 +314,6 @@ class DocType:
d.rate = self.get_bom_unitcost(d.bom_no) d.rate = self.get_bom_unitcost(d.bom_no)
d.amount = flt(d.rate) * flt(d.qty) d.amount = flt(d.rate) * flt(d.qty)
d.qty_consumed_per_unit = flt(d.qty) / flt(self.doc.quantity) d.qty_consumed_per_unit = flt(d.qty) / flt(self.doc.quantity)
d.save()
total_rm_cost += d.amount total_rm_cost += d.amount
self.doc.raw_material_cost = total_rm_cost self.doc.raw_material_cost = total_rm_cost

View File

@@ -0,0 +1,75 @@
import webnotes, webnotes.utils, os
from webnotes.modules.export_file import export_to_files
def execute():
webnotes.reload_doc("core", "doctype", "file_data")
webnotes.reset_perms("File Data")
singles = get_single_doctypes()
for doctype in webnotes.conn.sql_list("""select parent from tabDocField where
fieldname='file_list'"""):
update_file_list(doctype, singles)
webnotes.conn.sql("""delete from tabDocField where fieldname='file_list'
and parent=%s""", doctype)
# export_to_files([["DocType", doctype]])
def get_single_doctypes():
return webnotes.conn.sql_list("""select name from tabDocType
where ifnull(issingle,0)=1""")
def update_file_list(doctype, singles):
if doctype in singles:
doc = webnotes.doc(doctype, doctype)
if doc.file_list:
update_for_doc(doctype, doc)
webnotes.conn.set_value(doctype, None, "file_list", None)
else:
try:
for doc in webnotes.conn.sql("""select name, file_list from `tab%s` where
ifnull(file_list, '')!=''""" % doctype, as_dict=True):
update_for_doc(doctype, doc)
webnotes.conn.commit()
webnotes.conn.sql("""alter table `tab%s` drop column `file_list`""" % doctype)
except Exception, e:
print webnotes.getTraceback()
if (e.args and e.args[0]!=1054) or not e.args:
raise e
def update_for_doc(doctype, doc):
for filedata in doc.file_list.split("\n"):
if not filedata:
continue
filedata = filedata.split(",")
if len(filedata)==2:
filename, fileid = filedata[0], filedata[1]
else:
continue
exists = True
if not (filename.startswith("http://") or filename.startswith("https://")):
if not os.path.exists(webnotes.utils.get_path("public", "files", filename)):
exists = False
if exists:
if webnotes.conn.exists("File Data", fileid):
try:
fd = webnotes.bean("File Data", fileid)
if not (fd.doc.attached_to_doctype and fd.doc.attached_to_name):
fd.doc.attached_to_doctype = doctype
fd.doc.attached_to_name = doc.name
fd.save()
else:
fd = webnotes.bean("File Data", copy=fd.doclist)
fd.doc.attached_to_doctype = doctype
fd.doc.attached_to_name = doc.name
fd.doc.name = None
fd.insert()
except webnotes.DuplicateEntryError:
pass
else:
webnotes.conn.sql("""delete from `tabFile Data` where name=%s""",
fileid)

View File

@@ -0,0 +1,12 @@
import webnotes, os, webnotes.utils
def execute():
files_path = webnotes.utils.get_path("public", "files")
for f in webnotes.conn.sql("""select name, file_name from
`tabFile Data`""", as_dict=True):
if f.file_name:
filepath = os.path.join(files_path, f.file_name)
if os.path.exists(filepath):
webnotes.conn.set_value("File Data", f.name, "file_size", os.stat(filepath).st_size)

View File

@@ -0,0 +1,18 @@
import webnotes
def execute():
from patches.april_2013.p05_update_file_data import update_file_list, get_single_doctypes
singles = get_single_doctypes()
for doctype in webnotes.conn.sql_list("""select table_name from `information_schema`.`columns`
where table_schema=%s and column_name='file_list'""", webnotes.conn.cur_db_name):
doctype = doctype[3:]
if not webnotes.conn.exists("DocType", doctype): continue
update_file_list(doctype, singles)
webnotes.conn.sql("""delete from `tabCustom Field` where fieldname='file_list'
and parent=%s""", doctype)
webnotes.conn.sql("""delete from `tabDocField` where fieldname='file_list'
and parent=%s""", doctype)

View File

@@ -0,0 +1,4 @@
import webnotes
def execute():
from patches.january_2013 import rebuild_tree
rebuild_tree.execute()

View File

@@ -240,8 +240,13 @@ patch_list = [
"patches.april_2013.p04_reverse_modules_list", "patches.april_2013.p04_reverse_modules_list",
"execute:webnotes.delete_doc('Search Criteria', 'time_log_summary')", "execute:webnotes.delete_doc('Search Criteria', 'time_log_summary')",
"patches.april_2013.p04_update_role_in_pages", "patches.april_2013.p04_update_role_in_pages",
"patches.april_2013.p05_update_file_data",
"patches.april_2013.p06_update_file_size",
"patches.april_2013.p05_fixes_in_reverse_modules", "patches.april_2013.p05_fixes_in_reverse_modules",
"execute:webnotes.delete_doc('DocType Mapper', 'Delivery Note-Packing Slip')", "execute:webnotes.delete_doc('DocType Mapper', 'Delivery Note-Packing Slip')",
"execute:webnotes.reload_doc('Stock', 'DocType', 'Delivery Note Item')", "execute:webnotes.reload_doc('Stock', 'DocType', 'Delivery Note Item')",
"patches.april_2013.p06_default_cost_center", "patches.april_2013.p06_default_cost_center",
"execute:webnotes.reset_perms('File Data')",
"patches.april_2013.p07_update_file_data_2",
"patches.april_2013.rebuild_sales_browser",
] ]

View File

@@ -1,6 +1,6 @@
[ [
{ {
"creation": "2013-01-10 16:34:17", "creation": "2013-01-29 19:25:50",
"docstatus": 0, "docstatus": 0,
"modified": "2013-01-29 16:27:52", "modified": "2013-01-29 16:27:52",
"modified_by": "Administrator", "modified_by": "Administrator",
@@ -249,15 +249,6 @@
"label": "Company", "label": "Company",
"options": "Company" "options": "Company"
}, },
{
"doctype": "DocField",
"fieldname": "file_list",
"fieldtype": "Text",
"hidden": 1,
"label": "File List",
"no_copy": 1,
"print_hide": 1
},
{ {
"doctype": "DocPerm" "doctype": "DocPerm"
} }

View File

@@ -1,6 +1,6 @@
[ [
{ {
"creation": "2013-03-06 14:08:07", "creation": "2013-04-03 16:38:41",
"docstatus": 0, "docstatus": 0,
"modified": "2013-04-03 15:51:32", "modified": "2013-04-03 15:51:32",
"modified_by": "Administrator", "modified_by": "Administrator",
@@ -185,17 +185,6 @@
"permlevel": 0, "permlevel": 0,
"read_only": 0 "read_only": 0
}, },
{
"doctype": "DocField",
"fieldname": "file_list",
"fieldtype": "Text",
"hidden": 1,
"label": "File List",
"no_copy": 1,
"permlevel": 0,
"print_hide": 1,
"read_only": 0
},
{ {
"doctype": "DocField", "doctype": "DocField",
"fieldname": "amended_from", "fieldname": "amended_from",

View File

@@ -5,4 +5,4 @@ import webnotes
@webnotes.whitelist() @webnotes.whitelist()
def get_time_log_list(doctype, txt, searchfield, start, page_len, filters): def get_time_log_list(doctype, txt, searchfield, start, page_len, filters):
return webnotes.conn.get_values("Time Log", filters, ["name", "activity_type", "owner"], debug=True) return webnotes.conn.get_values("Time Log", filters, ["name", "activity_type", "owner"])

View File

@@ -1,6 +1,6 @@
[ [
{ {
"creation": "2013-01-22 15:24:17", "creation": "2013-03-07 14:48:34",
"docstatus": 0, "docstatus": 0,
"modified": "2013-01-29 17:14:58", "modified": "2013-01-29 17:14:58",
"modified_by": "Administrator", "modified_by": "Administrator",
@@ -32,7 +32,6 @@
"parent": "Sales Order", "parent": "Sales Order",
"parentfield": "permissions", "parentfield": "permissions",
"parenttype": "DocType", "parenttype": "DocType",
"permlevel": 0,
"read": 1 "read": 1
}, },
{ {
@@ -952,21 +951,25 @@
"print_hide": 1 "print_hide": 1
}, },
{ {
"doctype": "DocField", "amend": 0,
"fieldname": "file_list", "cancel": 0,
"fieldtype": "Text", "create": 0,
"hidden": 1, "doctype": "DocPerm",
"label": "File List", "match": "",
"no_copy": 1, "permlevel": 1,
"print_hide": 1 "report": 0,
"role": "Sales Manager",
"submit": 0,
"write": 0
}, },
{ {
"amend": 1, "amend": 1,
"cancel": 1, "cancel": 1,
"create": 1, "create": 1,
"doctype": "DocPerm", "doctype": "DocPerm",
"permlevel": 0,
"report": 1, "report": 1,
"role": "Sales User", "role": "Sales Manager",
"submit": 1, "submit": 1,
"write": 1 "write": 1
}, },
@@ -975,6 +978,52 @@
"cancel": 1, "cancel": 1,
"create": 1, "create": 1,
"doctype": "DocPerm", "doctype": "DocPerm",
"match": "",
"permlevel": 0,
"report": 1,
"role": "Sales User",
"submit": 1,
"write": 1
},
{
"amend": 0,
"cancel": 0,
"create": 0,
"doctype": "DocPerm",
"match": "",
"permlevel": 1,
"report": 0,
"role": "Sales User",
"submit": 0,
"write": 0
},
{
"amend": 1,
"cancel": 1,
"create": 1,
"doctype": "DocPerm",
"permlevel": 0,
"report": 1,
"role": "Maintenance Manager",
"submit": 1,
"write": 1
},
{
"amend": 0,
"cancel": 0,
"create": 0,
"doctype": "DocPerm",
"match": "",
"permlevel": 1,
"role": "Maintenance Manager",
"submit": 0
},
{
"amend": 1,
"cancel": 1,
"create": 1,
"doctype": "DocPerm",
"permlevel": 0,
"report": 1, "report": 1,
"role": "Maintenance User", "role": "Maintenance User",
"submit": 1, "submit": 1,
@@ -984,11 +1033,21 @@
"amend": 0, "amend": 0,
"cancel": 0, "cancel": 0,
"create": 0, "create": 0,
"doctype": "DocPerm",
"match": "",
"permlevel": 1,
"role": "Maintenance User",
"submit": 0
},
{
"doctype": "DocPerm",
"permlevel": 0,
"role": "Accounts User"
},
{
"doctype": "DocPerm", "doctype": "DocPerm",
"match": "customer", "match": "customer",
"report": 0, "permlevel": 0,
"role": "Customer", "role": "Customer"
"submit": 0,
"write": 0
} }
] ]

View File

@@ -173,15 +173,6 @@
"report_hide": 1, "report_hide": 1,
"search_index": 0 "search_index": 0
}, },
{
"doctype": "DocField",
"fieldname": "file_list",
"fieldtype": "Text",
"hidden": 1,
"label": "File List",
"no_copy": 1,
"print_hide": 1
},
{ {
"amend": 0, "amend": 0,
"cancel": 0, "cancel": 0,

View File

@@ -1,6 +1,6 @@
[ [
{ {
"creation": "2013-01-10 16:34:23", "creation": "2013-01-25 11:35:09",
"docstatus": 0, "docstatus": 0,
"modified": "2013-01-22 14:56:41", "modified": "2013-01-22 14:56:41",
"modified_by": "Administrator", "modified_by": "Administrator",
@@ -60,13 +60,6 @@
"label": "How to upload", "label": "How to upload",
"options": "<div class=\"help\">Use the <a href=\"#data-import-tool\">Data Import Tool</a> to upload, update Item Prices in bulk:\n<ol> \n<li>Go to Data Import Tool.\n<li>Select \"Item\"\n<li>Check on \"With Data\"\n<li>Download \"Item Price\" from Child Tables.\n<li>Update the prices required and add new rows if required.\n<li>Check on \"Overwrite\"\n<li>Upload the modified sheet.\n</div>\n" "options": "<div class=\"help\">Use the <a href=\"#data-import-tool\">Data Import Tool</a> to upload, update Item Prices in bulk:\n<ol> \n<li>Go to Data Import Tool.\n<li>Select \"Item\"\n<li>Check on \"With Data\"\n<li>Download \"Item Price\" from Child Tables.\n<li>Update the prices required and add new rows if required.\n<li>Check on \"Overwrite\"\n<li>Upload the modified sheet.\n</div>\n"
}, },
{
"doctype": "DocField",
"fieldname": "file_list",
"fieldtype": "Text",
"hidden": 1,
"label": "File List"
},
{ {
"cancel": 0, "cancel": 0,
"create": 0, "create": 0,
@@ -85,6 +78,7 @@
"cancel": 1, "cancel": 1,
"create": 1, "create": 1,
"doctype": "DocPerm", "doctype": "DocPerm",
"match": "",
"role": "Sales Master Manager", "role": "Sales Master Manager",
"write": 1 "write": 1
} }

View File

@@ -82,6 +82,12 @@ wn.module_page["Setup"] = [
label: wn._("Rename Tool"), label: wn._("Rename Tool"),
"description":wn._("Rename multiple items in one go") "description":wn._("Rename multiple items in one go")
}, },
{
"route":"List/File Data",
doctype: "File Data",
label: wn._("File Manager"),
"description":wn._("List, delete uploaded files.")
},
] ]
}, },
{ {

View File

@@ -1,6 +1,6 @@
[ [
{ {
"creation": "2013-03-01 08:21:54", "creation": "2013-03-01 19:09:43",
"docstatus": 0, "docstatus": 0,
"modified": "2013-03-01 08:22:16", "modified": "2013-03-01 08:22:16",
"modified_by": "Administrator", "modified_by": "Administrator",
@@ -24,19 +24,14 @@
"permlevel": 0 "permlevel": 0
}, },
{ {
"cancel": 1,
"create": 1,
"doctype": "DocPerm", "doctype": "DocPerm",
"name": "__common__", "name": "__common__",
"parent": "Batch", "parent": "Batch",
"parentfield": "permissions", "parentfield": "permissions",
"parenttype": "DocType", "parenttype": "DocType",
"permlevel": 0,
"read": 1, "read": 1,
"report": 1,
"role": "Material Master Manager", "role": "Material Master Manager",
"submit": 0, "submit": 0
"write": 1
}, },
{ {
"doctype": "DocType", "doctype": "DocType",
@@ -108,15 +103,19 @@
"read_only": 1 "read_only": 1
}, },
{ {
"doctype": "DocField", "cancel": 1,
"fieldname": "file_list", "create": 1,
"fieldtype": "Text", "doctype": "DocPerm",
"hidden": 1, "permlevel": 0,
"label": "File List", "report": 1,
"no_copy": 1, "write": 1
"print_hide": 1
}, },
{ {
"doctype": "DocPerm" "amend": 0,
"cancel": 0,
"create": 0,
"doctype": "DocPerm",
"match": "",
"permlevel": 1
} }
] ]

View File

@@ -326,6 +326,17 @@ if (sys_defaults.auto_inventory_accounting) {
} }
// cost center // cost center
cur_frm.cscript.cost_center = function(doc, cdt, cdn){
var d = locals[cdt][cdn];
if(d.cost_center) {
var cl = getchildren('Delivery Note Item', doc.name, cur_frm.cscript.fname, doc.doctype);
for(var i = 0; i < cl.length; i++){
if(!cl[i].cost_center) cl[i].cost_center = d.cost_center;
}
}
refresh_field(cur_frm.cscript.fname);
}
cur_frm.fields_dict.delivery_note_details.grid.get_field("cost_center").get_query = function(doc) { cur_frm.fields_dict.delivery_note_details.grid.get_field("cost_center").get_query = function(doc) {
return { return {
query: "accounts.utils.get_cost_center_list", query: "accounts.utils.get_cost_center_list",

View File

@@ -1,6 +1,6 @@
[ [
{ {
"creation": "2013-01-29 17:54:12", "creation": "2013-04-02 10:50:50",
"docstatus": 0, "docstatus": 0,
"modified": "2013-02-02 19:18:38", "modified": "2013-02-02 19:18:38",
"modified_by": "Administrator", "modified_by": "Administrator",
@@ -32,9 +32,7 @@
"parent": "Delivery Note", "parent": "Delivery Note",
"parentfield": "permissions", "parentfield": "permissions",
"parenttype": "DocType", "parenttype": "DocType",
"permlevel": 0, "read": 1
"read": 1,
"report": 1
}, },
{ {
"doctype": "DocType", "doctype": "DocType",
@@ -1123,20 +1121,25 @@
"read_only": 0 "read_only": 0
}, },
{ {
"doctype": "DocField", "amend": 1,
"fieldname": "file_list", "cancel": 1,
"fieldtype": "Text", "create": 1,
"hidden": 1, "doctype": "DocPerm",
"label": "File List", "permlevel": 0,
"no_copy": 1, "report": 1,
"print_hide": 1, "role": "Material User",
"read_only": 0 "submit": 1,
"write": 1
}, },
{ {
"amend": 0,
"cancel": 0, "cancel": 0,
"create": 0, "create": 0,
"doctype": "DocPerm", "doctype": "DocPerm",
"role": "Accounts User", "match": "",
"permlevel": 1,
"report": 0,
"role": "Material User",
"submit": 0, "submit": 0,
"write": 0 "write": 0
}, },
@@ -1145,31 +1148,73 @@
"cancel": 1, "cancel": 1,
"create": 1, "create": 1,
"doctype": "DocPerm", "doctype": "DocPerm",
"role": "Sales User", "permlevel": 0,
"submit": 1, "report": 1,
"write": 1
},
{
"doctype": "DocPerm",
"match": "customer_name",
"role": "Customer"
},
{
"amend": 1,
"cancel": 1,
"create": 1,
"doctype": "DocPerm",
"role": "Material Manager", "role": "Material Manager",
"submit": 1, "submit": 1,
"write": 1 "write": 1
}, },
{
"amend": 0,
"cancel": 0,
"create": 0,
"doctype": "DocPerm",
"match": "",
"permlevel": 1,
"report": 0,
"role": "Material Manager",
"submit": 0,
"write": 0
},
{ {
"amend": 1, "amend": 1,
"cancel": 1, "cancel": 1,
"create": 1, "create": 1,
"doctype": "DocPerm", "doctype": "DocPerm",
"role": "Material User", "match": "",
"permlevel": 0,
"report": 1,
"role": "Sales User",
"submit": 1, "submit": 1,
"write": 1 "write": 1
},
{
"amend": 0,
"cancel": 0,
"create": 0,
"doctype": "DocPerm",
"match": "",
"permlevel": 1,
"report": 0,
"role": "Sales User",
"submit": 0,
"write": 0
},
{
"cancel": 0,
"create": 0,
"doctype": "DocPerm",
"permlevel": 0,
"report": 1,
"role": "Accounts User",
"submit": 0,
"write": 0
},
{
"amend": 0,
"cancel": 0,
"create": 0,
"doctype": "DocPerm",
"match": "",
"permlevel": 1,
"role": "Accounts User",
"submit": 0
},
{
"doctype": "DocPerm",
"match": "customer_name",
"permlevel": 0,
"report": 1,
"role": "Customer"
} }
] ]

View File

@@ -55,12 +55,13 @@ class DocType(DocListController):
ch.conversion_factor = 1 ch.conversion_factor = 1
def check_stock_uom_with_bin(self): def check_stock_uom_with_bin(self):
bin = webnotes.conn.sql("select stock_uom from `tabBin` where item_code = %s", if not self.doc.fields.get("__islocal"):
self.doc.item_code) bin = webnotes.conn.sql("select stock_uom from `tabBin` where item_code = %s",
if self.doc.stock_uom and bin and cstr(bin[0][0]) \ self.doc.name)
and cstr(bin[0][0]) != cstr(self.doc.stock_uom): if self.doc.stock_uom and bin and cstr(bin[0][0]) \
msgprint(_("Please Update Stock UOM with the help of Stock UOM Replace Utility."), and cstr(bin[0][0]) != cstr(self.doc.stock_uom):
raise_exception=1) msgprint(_("Please Update Stock UOM with the help of Stock UOM Replace Utility."),
raise_exception=1)
def validate_conversion_factor(self): def validate_conversion_factor(self):
check_list = [] check_list = []
@@ -154,13 +155,14 @@ class DocType(DocListController):
def validate_barcode(self): def validate_barcode(self):
if self.doc.barcode: if self.doc.barcode:
duplicate = webnotes.conn.sql("select name from tabItem where barcode = %s and name != %s", (self.doc.barcode, self.doc.name)) duplicate = webnotes.conn.sql("""select name from tabItem where barcode = %s
and name != %s""", (self.doc.barcode, self.doc.name))
if duplicate: if duplicate:
msgprint("Barcode: %s already used in item: %s" % msgprint("Barcode: %s already used in item: %s" %
(self.doc.barcode, cstr(duplicate[0][0])), raise_exception = 1) (self.doc.barcode, cstr(duplicate[0][0])), raise_exception = 1)
def check_non_asset_warehouse(self): def check_non_asset_warehouse(self):
if self.doc.is_asset_item == "Yes": if not self.doc.__islocal and self.doc.is_asset_item == "Yes":
existing_qty = webnotes.conn.sql("select t1.warehouse, t1.actual_qty from tabBin t1, tabWarehouse t2 where t1.item_code=%s and (t2.warehouse_type!='Fixed Asset' or t2.warehouse_type is null) and t1.warehouse=t2.name and t1.actual_qty > 0", self.doc.name) existing_qty = webnotes.conn.sql("select t1.warehouse, t1.actual_qty from tabBin t1, tabWarehouse t2 where t1.item_code=%s and (t2.warehouse_type!='Fixed Asset' or t2.warehouse_type is null) and t1.warehouse=t2.name and t1.actual_qty > 0", self.doc.name)
for e in existing_qty: for e in existing_qty:
msgprint("%s Units exist in Warehouse %s, which is not an Asset Warehouse." % msgprint("%s Units exist in Warehouse %s, which is not an Asset Warehouse." %

View File

@@ -28,6 +28,7 @@
"permlevel": 0 "permlevel": 0
}, },
{ {
"amend": 0,
"doctype": "DocPerm", "doctype": "DocPerm",
"name": "__common__", "name": "__common__",
"parent": "Item", "parent": "Item",
@@ -35,7 +36,6 @@
"parenttype": "DocType", "parenttype": "DocType",
"permlevel": 0, "permlevel": 0,
"read": 1, "read": 1,
"report": 1,
"submit": 0 "submit": 0
}, },
{ {
@@ -746,16 +746,6 @@
"read_only": 0, "read_only": 0,
"reqd": 1 "reqd": 1
}, },
{
"doctype": "DocField",
"fieldname": "file_list",
"fieldtype": "Text",
"hidden": 1,
"label": "File List",
"no_copy": 1,
"print_hide": 1,
"read_only": 0
},
{ {
"doctype": "DocField", "doctype": "DocField",
"fieldname": "customer_code", "fieldname": "customer_code",
@@ -895,7 +885,6 @@
"write": 1 "write": 1
}, },
{ {
"amend": 0,
"cancel": 0, "cancel": 0,
"create": 0, "create": 0,
"doctype": "DocPerm", "doctype": "DocPerm",
@@ -903,7 +892,6 @@
"write": 0 "write": 0
}, },
{ {
"amend": 0,
"cancel": 0, "cancel": 0,
"create": 0, "create": 0,
"doctype": "DocPerm", "doctype": "DocPerm",

View File

@@ -1,6 +1,6 @@
[ [
{ {
"creation": "2013-02-21 14:15:25", "creation": "2013-03-07 14:48:38",
"docstatus": 0, "docstatus": 0,
"modified": "2013-02-25 15:38:02", "modified": "2013-02-25 15:38:02",
"modified_by": "Administrator", "modified_by": "Administrator",
@@ -331,15 +331,6 @@
"options": "Print Heading", "options": "Print Heading",
"print_hide": 1 "print_hide": 1
}, },
{
"doctype": "DocField",
"fieldname": "file_list",
"fieldtype": "Text",
"hidden": 1,
"label": "File List",
"no_copy": 1,
"print_hide": 1
},
{ {
"amend": 0, "amend": 0,
"cancel": 0, "cancel": 0,

View File

@@ -1,6 +1,6 @@
[ [
{ {
"creation": "2013-01-22 15:24:18", "creation": "2013-03-25 16:01:29",
"docstatus": 0, "docstatus": 0,
"modified": "2013-02-02 19:09:37", "modified": "2013-02-02 19:09:37",
"modified_by": "Administrator", "modified_by": "Administrator",
@@ -31,9 +31,7 @@
"parent": "Purchase Receipt", "parent": "Purchase Receipt",
"parentfield": "permissions", "parentfield": "permissions",
"parenttype": "DocType", "parenttype": "DocType",
"permlevel": 0, "read": 1
"read": 1,
"report": 1
}, },
{ {
"doctype": "DocType", "doctype": "DocType",
@@ -886,44 +884,78 @@
"read_only": 1 "read_only": 1
}, },
{ {
"doctype": "DocField", "amend": 0,
"fieldname": "file_list", "cancel": 0,
"fieldtype": "Text", "create": 0,
"hidden": 1, "doctype": "DocPerm",
"label": "File List", "match": "",
"no_copy": 1, "permlevel": 1,
"print_hide": 1 "report": 0,
}, "role": "Material Manager",
{ "submit": 0,
"amend": 1, "write": 0
"cancel": 1,
"create": 1,
"doctype": "DocPerm",
"role": "Purchase User",
"submit": 1,
"write": 1
},
{
"doctype": "DocPerm",
"match": "supplier",
"role": "Supplier"
}, },
{ {
"amend": 1, "amend": 1,
"cancel": 1, "cancel": 1,
"create": 1, "create": 1,
"doctype": "DocPerm", "doctype": "DocPerm",
"permlevel": 0,
"report": 1,
"role": "Material Manager", "role": "Material Manager",
"submit": 1, "submit": 1,
"write": 1 "write": 1
}, },
{
"amend": 0,
"cancel": 0,
"create": 0,
"doctype": "DocPerm",
"match": "",
"permlevel": 1,
"report": 0,
"role": "Material User",
"submit": 0,
"write": 0
},
{ {
"amend": 1, "amend": 1,
"cancel": 1, "cancel": 1,
"create": 1, "create": 1,
"doctype": "DocPerm", "doctype": "DocPerm",
"permlevel": 0,
"report": 1,
"role": "Material User", "role": "Material User",
"submit": 1, "submit": 1,
"write": 1 "write": 1
},
{
"amend": 1,
"cancel": 1,
"create": 1,
"doctype": "DocPerm",
"match": "",
"permlevel": 0,
"report": 1,
"role": "Purchase User",
"submit": 1,
"write": 1
},
{
"amend": 0,
"cancel": 0,
"create": 0,
"doctype": "DocPerm",
"match": "",
"permlevel": 1,
"role": "Purchase User",
"submit": 0
},
{
"doctype": "DocPerm",
"match": "supplier",
"permlevel": 0,
"report": 1,
"role": "Supplier"
} }
] ]

View File

@@ -1,6 +1,6 @@
[ [
{ {
"creation": "2013-01-10 16:34:29", "creation": "2013-01-29 19:25:41",
"docstatus": 0, "docstatus": 0,
"modified": "2013-01-29 16:27:57", "modified": "2013-01-29 16:27:57",
"modified_by": "Administrator", "modified_by": "Administrator",
@@ -31,8 +31,8 @@
"parent": "Serial No", "parent": "Serial No",
"parentfield": "permissions", "parentfield": "permissions",
"parenttype": "DocType", "parenttype": "DocType",
"permlevel": 0, "read": 1,
"read": 1 "submit": 0
}, },
{ {
"doctype": "DocType", "doctype": "DocType",
@@ -476,15 +476,6 @@
"oldfieldtype": "Small Text", "oldfieldtype": "Small Text",
"read_only": 1 "read_only": 1
}, },
{
"doctype": "DocField",
"fieldname": "file_list",
"fieldtype": "Text",
"hidden": 1,
"label": "File List",
"no_copy": 1,
"print_hide": 1
},
{ {
"doctype": "DocField", "doctype": "DocField",
"fieldname": "sle_exists", "fieldname": "sle_exists",
@@ -496,25 +487,82 @@
"read_only": 1, "read_only": 1,
"report_hide": 1 "report_hide": 1
}, },
{
"amend": 0,
"cancel": 0,
"create": 0,
"doctype": "DocPerm",
"match": "",
"permlevel": 1,
"report": 0,
"role": "Material Manager",
"write": 0
},
{
"amend": 0,
"cancel": 0,
"create": 0,
"doctype": "DocPerm",
"permlevel": 0,
"report": 1,
"role": "Material Manager",
"write": 0
},
{
"amend": 0,
"cancel": 0,
"create": 0,
"doctype": "DocPerm",
"match": "",
"permlevel": 1,
"report": 0,
"role": "Material User",
"write": 0
},
{
"amend": 0,
"cancel": 0,
"create": 0,
"doctype": "DocPerm",
"permlevel": 0,
"report": 1,
"role": "Material User",
"write": 0
},
{ {
"cancel": 1, "cancel": 1,
"create": 1, "create": 1,
"doctype": "DocPerm", "doctype": "DocPerm",
"permlevel": 0,
"report": 1, "report": 1,
"role": "Material User", "role": "System Manager",
"submit": 0,
"write": 1 "write": 1
}, },
{ {
"cancel": 1,
"create": 1,
"doctype": "DocPerm", "doctype": "DocPerm",
"role": "Sales User" "permlevel": 0,
"report": 1,
"role": "Material Master Manager",
"write": 1
}, },
{ {
"amend": 0,
"cancel": 0,
"create": 0,
"doctype": "DocPerm", "doctype": "DocPerm",
"role": "Purchase User" "match": "",
"permlevel": 1,
"role": "System Manager"
}, },
{ {
"amend": 0,
"cancel": 0,
"create": 0,
"doctype": "DocPerm", "doctype": "DocPerm",
"role": "Accounts User" "match": "",
"permlevel": 1,
"role": "Sales Master Manager"
} }
] ]

View File

@@ -1,8 +1,8 @@
[ [
{ {
"creation": "2013-03-26 06:51:17", "creation": "2013-03-28 10:35:31",
"docstatus": 0, "docstatus": 0,
"modified": "2013-03-26 08:32:03", "modified": "2013-04-10 13:44:19",
"modified_by": "Administrator", "modified_by": "Administrator",
"owner": "Administrator" "owner": "Administrator"
}, },
@@ -52,6 +52,7 @@
"fieldname": "posting_date", "fieldname": "posting_date",
"fieldtype": "Date", "fieldtype": "Date",
"in_filter": 0, "in_filter": 0,
"in_list_view": 1,
"label": "Posting Date", "label": "Posting Date",
"oldfieldname": "reconciliation_date", "oldfieldname": "reconciliation_date",
"oldfieldtype": "Date", "oldfieldtype": "Date",
@@ -63,6 +64,7 @@
"fieldname": "posting_time", "fieldname": "posting_time",
"fieldtype": "Time", "fieldtype": "Time",
"in_filter": 0, "in_filter": 0,
"in_list_view": 1,
"label": "Posting Time", "label": "Posting Time",
"oldfieldname": "reconciliation_time", "oldfieldname": "reconciliation_time",
"oldfieldtype": "Time", "oldfieldtype": "Time",
@@ -148,6 +150,7 @@
"fieldname": "stock_value_difference", "fieldname": "stock_value_difference",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 1, "hidden": 1,
"in_list_view": 1,
"label": "Stock Value Difference", "label": "Stock Value Difference",
"print_hide": 1 "print_hide": 1
}, },

View File

@@ -95,6 +95,8 @@ erpnext.StockAgeing = erpnext.StockGridReport.extend({
this.data = [].concat(this._data); this.data = [].concat(this._data);
this.serialized_buying_rates = this.get_serialized_buying_rates();
$.each(this.data, function(i, d) { $.each(this.data, function(i, d) {
me.reset_item_values(d); me.reset_item_values(d);
}); });

View File

@@ -29,17 +29,13 @@ $.extend(cur_frm.cscript, {
erpnext.hide_naming_series(); erpnext.hide_naming_series();
cur_frm.cscript.make_listing(doc); cur_frm.cscript.make_listing(doc);
if(!doc.__islocal) { if(!doc.__islocal) {
if(in_list(user_roles,'System Manager')) { if(user_roles.indexOf("Support Manager")!==-1) {
if(doc.status!='Closed') cur_frm.add_custom_button('Close Ticket', cur_frm.cscript['Close Ticket']); if(doc.status!='Closed') cur_frm.add_custom_button('Close Ticket', cur_frm.cscript['Close Ticket']);
if(doc.status=='Closed') cur_frm.add_custom_button('Re-Open Ticket', cur_frm.cscript['Re-Open Ticket']); if(doc.status=='Closed') cur_frm.add_custom_button('Re-Open Ticket', cur_frm.cscript['Re-Open Ticket']);
}else if(doc.allocated_to) {
cur_frm.set_df_property('status','read_only', 1);
if(user==doc.allocated_to && doc.status!='Closed') cur_frm.add_custom_button('Close Ticket', cur_frm.cscript['Close Ticket']);
} }
cur_frm.set_df_property('subject','read_only', 1); cur_frm.toggle_enable(["subject", "raised_by"], false);
cur_frm.set_df_property('description','hidden', 1); cur_frm.toggle_display("description", false);
cur_frm.set_df_property('raised_by','read_only', 1);
} }
refresh_field('status'); refresh_field('status');
}, },

View File

@@ -45,6 +45,10 @@ class DocType(TransactionBase):
def validate(self): def validate(self):
self.update_status() self.update_status()
if self.doc.status == "Closed":
from webnotes.widgets.form.assign_to import clear
clear(self.doc.doctype, self.doc.name)
def on_communication_sent(self, comm): def on_communication_sent(self, comm):
webnotes.conn.set(self.doc, 'status', 'Waiting for Customer') webnotes.conn.set(self.doc, 'status', 'Waiting for Customer')
if comm.lead and not self.doc.lead: if comm.lead and not self.doc.lead:

View File

@@ -1,6 +1,6 @@
[ [
{ {
"creation": "2013-01-10 16:34:31", "creation": "2013-01-31 22:22:27",
"docstatus": 0, "docstatus": 0,
"modified": "2013-01-31 22:17:24", "modified": "2013-01-31 22:17:24",
"modified_by": "Administrator", "modified_by": "Administrator",
@@ -23,18 +23,13 @@
"permlevel": 0 "permlevel": 0
}, },
{ {
"amend": 0,
"create": 1,
"doctype": "DocPerm", "doctype": "DocPerm",
"name": "__common__", "name": "__common__",
"parent": "Support Ticket", "parent": "Support Ticket",
"parentfield": "permissions", "parentfield": "permissions",
"parenttype": "DocType", "parenttype": "DocType",
"permlevel": 0,
"read": 1, "read": 1,
"report": 1, "submit": 0
"submit": 0,
"write": 1
}, },
{ {
"doctype": "DocType", "doctype": "DocType",
@@ -242,27 +237,51 @@
"label": "Content Type" "label": "Content Type"
}, },
{ {
"doctype": "DocField", "amend": 0,
"fieldname": "file_list", "cancel": 0,
"fieldtype": "Text", "create": 1,
"hidden": 1, "doctype": "DocPerm",
"label": "File List", "permlevel": 0,
"no_copy": 1, "report": 1,
"print_hide": 1 "role": "Guest",
"write": 1
}, },
{ {
"cancel": 0, "create": 1,
"doctype": "DocPerm", "doctype": "DocPerm",
"role": "Guest" "match": "customer",
}, "permlevel": 0,
{ "report": 1,
"cancel": 0, "role": "Customer",
"doctype": "DocPerm", "write": 1
"role": "Customer"
}, },
{ {
"cancel": 1, "cancel": 1,
"create": 1,
"doctype": "DocPerm", "doctype": "DocPerm",
"permlevel": 0,
"report": 1,
"role": "Support Team",
"write": 1
},
{
"amend": 0,
"cancel": 0,
"create": 0,
"doctype": "DocPerm",
"match": "",
"permlevel": 1,
"report": 1,
"role": "Support Team",
"write": 1
},
{
"amend": 0,
"cancel": 0,
"create": 0,
"doctype": "DocPerm",
"match": "",
"permlevel": 2,
"role": "Support Team" "role": "Support Team"
} }
] ]

View File

@@ -1,75 +1,76 @@
[ [
{ {
"owner": "Administrator", "creation": "2013-01-02 17:08:46",
"docstatus": 0, "docstatus": 0,
"creation": "2012-07-03 13:30:42", "modified": "2013-01-01 18:58:55",
"modified_by": "Administrator", "modified_by": "Administrator",
"modified": "2013-01-01 18:58:55" "owner": "Administrator"
}, },
{ {
"read_only": 1, "allow_attach": 0,
"in_create": 1,
"autoname": "QUES.#######", "autoname": "QUES.#######",
"name": "__common__",
"module": "Utilities",
"doctype": "DocType", "doctype": "DocType",
"allow_attach": 0 "in_create": 1,
"module": "Utilities",
"name": "__common__",
"read_only": 1
}, },
{ {
"name": "__common__",
"parent": "Question",
"doctype": "DocField", "doctype": "DocField",
"name": "__common__",
"parent": "Question",
"parentfield": "fields",
"parenttype": "DocType", "parenttype": "DocType",
"permlevel": 0, "permlevel": 0
"parentfield": "fields"
}, },
{ {
"parent": "Question",
"read": 1,
"report": 1,
"cancel": 1, "cancel": 1,
"name": "__common__",
"create": 1, "create": 1,
"doctype": "DocPerm", "doctype": "DocPerm",
"write": 1, "name": "__common__",
"parent": "Question",
"parentfield": "permissions",
"parenttype": "DocType", "parenttype": "DocType",
"role": "All",
"permlevel": 0, "permlevel": 0,
"parentfield": "permissions" "read": 1,
"report": 1,
"role": "All",
"submit": 0,
"write": 1
}, },
{ {
"name": "Question", "doctype": "DocType",
"doctype": "DocType" "name": "Question"
}, },
{ {
"oldfieldtype": "Text",
"doctype": "DocField", "doctype": "DocField",
"fieldname": "question",
"fieldtype": "Text",
"label": "Question", "label": "Question",
"oldfieldname": "question", "oldfieldname": "question",
"fieldname": "question", "oldfieldtype": "Text"
"fieldtype": "Text"
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
"label": "Points",
"fieldname": "points", "fieldname": "points",
"fieldtype": "Int", "fieldtype": "Int",
"hidden": 1 "hidden": 1,
"label": "Points"
}, },
{ {
"oldfieldtype": "Text Editor",
"doctype": "DocField", "doctype": "DocField",
"fieldname": "answer",
"fieldtype": "Text Editor",
"label": "Answer", "label": "Answer",
"oldfieldname": "answer", "oldfieldname": "answer",
"fieldname": "answer", "oldfieldtype": "Text Editor"
"fieldtype": "Text Editor"
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
"label": "User Tags",
"fieldname": "_user_tags", "fieldname": "_user_tags",
"fieldtype": "Data", "fieldtype": "Data",
"hidden": 1 "hidden": 1,
"label": "User Tags"
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
@@ -77,15 +78,6 @@
"fieldtype": "Text", "fieldtype": "Text",
"label": "Users Voted" "label": "Users Voted"
}, },
{
"oldfieldtype": "Text",
"doctype": "DocField",
"label": "File List",
"oldfieldname": "file_list",
"fieldname": "file_list",
"fieldtype": "Text",
"hidden": 1
},
{ {
"doctype": "DocPerm" "doctype": "DocPerm"
} }

View File

@@ -34,7 +34,8 @@ def upload(select_doctype=None, rows=None):
rename_log = [] rename_log = []
for row in rows: for row in rows:
if len(row) > 2: # if row has some content
if len(row) > 1 and row[0] and row[1]:
try: try:
if rename_doc(select_doctype, row[0], row[1]): if rename_doc(select_doctype, row[0], row[1]):
rename_log.append(_("Successful: ") + row[0] + " -> " + row[1]) rename_log.append(_("Successful: ") + row[0] + " -> " + row[1])

View File

@@ -1,6 +1,6 @@
[ [
{ {
"creation": "2013-03-07 15:53:15", "creation": "2013-03-26 12:48:00",
"docstatus": 0, "docstatus": 0,
"modified": "2013-03-12 14:48:34", "modified": "2013-03-12 14:48:34",
"modified_by": "Administrator", "modified_by": "Administrator",
@@ -102,15 +102,6 @@
"fieldtype": "Text Editor", "fieldtype": "Text Editor",
"label": "Footer" "label": "Footer"
}, },
{
"doctype": "DocField",
"fieldname": "file_list",
"fieldtype": "Text",
"hidden": 1,
"label": "File List",
"no_copy": 1,
"print_hide": 1
},
{ {
"doctype": "DocPerm" "doctype": "DocPerm"
} }

View File

@@ -1,6 +1,6 @@
[ [
{ {
"creation": "2013-03-08 11:36:50", "creation": "2013-03-28 10:35:30",
"docstatus": 0, "docstatus": 0,
"modified": "2013-03-18 13:55:53", "modified": "2013-03-18 13:55:53",
"modified_by": "Administrator", "modified_by": "Administrator",
@@ -114,15 +114,6 @@
"hidden": 1, "hidden": 1,
"label": "Email Sent" "label": "Email Sent"
}, },
{
"doctype": "DocField",
"fieldname": "file_list",
"fieldtype": "Text",
"hidden": 1,
"label": "File List",
"no_copy": 1,
"print_hide": 1
},
{ {
"create": 1, "create": 1,
"doctype": "DocPerm", "doctype": "DocPerm",

View File

@@ -82,15 +82,6 @@
"label": "Posts", "label": "Posts",
"read_only": 1 "read_only": 1
}, },
{
"doctype": "DocField",
"fieldname": "file_list",
"fieldtype": "Text",
"hidden": 1,
"label": "File List",
"no_copy": 1,
"print_hide": 1
},
{ {
"create": 1, "create": 1,
"doctype": "DocPerm", "doctype": "DocPerm",

View File

@@ -1,6 +1,6 @@
[ [
{ {
"creation": "2013-03-08 11:36:53", "creation": "2013-03-25 16:01:33",
"docstatus": 0, "docstatus": 0,
"modified": "2013-03-14 11:57:20", "modified": "2013-03-14 11:57:20",
"modified_by": "Administrator", "modified_by": "Administrator",
@@ -184,15 +184,6 @@
"label": "Custom CSS", "label": "Custom CSS",
"read_only": 1 "read_only": 1
}, },
{
"doctype": "DocField",
"fieldname": "file_list",
"fieldtype": "Text",
"hidden": 1,
"label": "File List",
"no_copy": 1,
"print_hide": 1
},
{ {
"create": 1, "create": 1,
"doctype": "DocPerm", "doctype": "DocPerm",

View File

@@ -1,6 +1,6 @@
[ [
{ {
"creation": "2013-02-12 13:19:11", "creation": "2013-03-28 10:35:30",
"docstatus": 0, "docstatus": 0,
"modified": "2013-03-11 17:41:11", "modified": "2013-03-11 17:41:11",
"modified_by": "Administrator", "modified_by": "Administrator",
@@ -24,14 +24,12 @@
"permlevel": 0 "permlevel": 0
}, },
{ {
"amend": 0,
"doctype": "DocPerm", "doctype": "DocPerm",
"name": "__common__", "name": "__common__",
"parent": "Web Page", "parent": "Web Page",
"parentfield": "permissions", "parentfield": "permissions",
"parenttype": "DocType", "parenttype": "DocType",
"read": 1, "read": 1,
"report": 1,
"role": "Website Manager", "role": "Website Manager",
"submit": 0 "submit": 0
}, },
@@ -139,26 +137,18 @@
"options": "CSS" "options": "CSS"
}, },
{ {
"doctype": "DocField",
"fieldname": "file_list",
"fieldtype": "Text",
"hidden": 1,
"label": "File List",
"no_copy": 1,
"print_hide": 1
},
{
"cancel": 1,
"create": 1, "create": 1,
"doctype": "DocPerm", "doctype": "DocPerm",
"permlevel": 0, "permlevel": 0,
"report": 1,
"write": 1 "write": 1
}, },
{ {
"amend": 0,
"cancel": 0, "cancel": 0,
"create": 0, "create": 0,
"doctype": "DocPerm", "doctype": "DocPerm",
"permlevel": 1, "match": "",
"write": 0 "permlevel": 1
} }
] ]

View File

@@ -2,7 +2,7 @@
{ {
"creation": "2013-03-26 06:51:18", "creation": "2013-03-26 06:51:18",
"docstatus": 0, "docstatus": 0,
"modified": "2013-04-17 11:51:24", "modified": "2013-04-17 11:51:30",
"modified_by": "Administrator", "modified_by": "Administrator",
"owner": "Administrator" "owner": "Administrator"
}, },
@@ -227,15 +227,6 @@
"label": "Domain List", "label": "Domain List",
"reqd": 0 "reqd": 0
}, },
{
"doctype": "DocField",
"fieldname": "file_list",
"fieldtype": "Text",
"hidden": 1,
"label": "File List",
"no_copy": 1,
"print_hide": 1
},
{ {
"create": 1, "create": 1,
"doctype": "DocPerm", "doctype": "DocPerm",

View File

@@ -1,84 +1,78 @@
[ [
{ {
"owner": "Administrator", "creation": "2013-03-07 14:48:40",
"docstatus": 0, "docstatus": 0,
"creation": "2012-12-25 16:47:53", "modified": "2012-12-25 16:56:34",
"modified_by": "Administrator", "modified_by": "Administrator",
"modified": "2012-12-25 16:56:34" "owner": "Administrator"
}, },
{ {
"allow_attach": 1, "allow_attach": 1,
"autoname": "field:slideshow_name", "autoname": "field:slideshow_name",
"name": "__common__", "description": "Slideshow like display for the website",
"module": "Website",
"doctype": "DocType", "doctype": "DocType",
"max_attachments": 10,
"document_type": "Transaction", "document_type": "Transaction",
"description": "Slideshow like display for the website" "max_attachments": 10,
"module": "Website",
"name": "__common__"
}, },
{ {
"name": "__common__",
"parent": "Website Slideshow",
"doctype": "DocField", "doctype": "DocField",
"name": "__common__",
"parent": "Website Slideshow",
"parentfield": "fields",
"parenttype": "DocType", "parenttype": "DocType",
"permlevel": 0, "permlevel": 0
"parentfield": "fields"
}, },
{ {
"parent": "Website Slideshow",
"read": 1,
"report": 1,
"cancel": 1, "cancel": 1,
"name": "__common__",
"create": 1, "create": 1,
"doctype": "DocPerm", "doctype": "DocPerm",
"write": 1, "name": "__common__",
"parent": "Website Slideshow",
"parentfield": "permissions",
"parenttype": "DocType", "parenttype": "DocType",
"role": "Website Manager",
"permlevel": 0, "permlevel": 0,
"parentfield": "permissions" "read": 1,
"report": 1,
"role": "Website Manager",
"submit": 0,
"write": 1
}, },
{ {
"name": "Website Slideshow", "doctype": "DocType",
"doctype": "DocType" "name": "Website Slideshow"
}, },
{ {
"read_only": 0,
"doctype": "DocField", "doctype": "DocField",
"label": "Slideshow Name",
"fieldname": "slideshow_name", "fieldname": "slideshow_name",
"fieldtype": "Data", "fieldtype": "Data",
"label": "Slideshow Name",
"read_only": 0,
"reqd": 1 "reqd": 1
}, },
{ {
"depends_on": "eval:!doc.__islocal", "depends_on": "eval:!doc.__islocal",
"doctype": "DocField", "doctype": "DocField",
"label": "Slideshow Items",
"fieldname": "sb0", "fieldname": "sb0",
"fieldtype": "Section Break" "fieldtype": "Section Break",
"label": "Slideshow Items"
}, },
{ {
"depends_on": "eval:!doc.__islocal", "depends_on": "eval:!doc.__islocal",
"doctype": "DocField", "doctype": "DocField",
"label": "Slideshow Items",
"fieldname": "slideshow_items", "fieldname": "slideshow_items",
"fieldtype": "Table", "fieldtype": "Table",
"label": "Slideshow Items",
"options": "Website Slideshow Item" "options": "Website Slideshow Item"
}, },
{ {
"description": "This goes above the slideshow.",
"depends_on": "eval:!doc.__islocal", "depends_on": "eval:!doc.__islocal",
"description": "This goes above the slideshow.",
"doctype": "DocField", "doctype": "DocField",
"label": "Header",
"fieldname": "header", "fieldname": "header",
"fieldtype": "Text Editor" "fieldtype": "Text Editor",
}, "label": "Header"
{
"doctype": "DocField",
"label": "File List",
"fieldname": "file_list",
"fieldtype": "Text",
"hidden": 1
}, },
{ {
"doctype": "DocPerm" "doctype": "DocPerm"

View File

@@ -1,6 +1,6 @@
[ [
{ {
"creation": "2013-02-22 01:28:09", "creation": "2013-03-07 12:26:33",
"docstatus": 0, "docstatus": 0,
"modified": "2013-03-07 07:03:34", "modified": "2013-03-07 07:03:34",
"modified_by": "Administrator", "modified_by": "Administrator",
@@ -48,14 +48,5 @@
"label": "Description", "label": "Description",
"print_width": "200px", "print_width": "200px",
"width": "200px" "width": "200px"
},
{
"doctype": "DocField",
"fieldname": "file_list",
"fieldtype": "Text",
"hidden": 1,
"label": "File List",
"no_copy": 1,
"print_hide": 1
} }
] ]