Merge pull request #1347 from akhileshdarjee/4.0-hotfix
method name fixing
diff --git a/erpnext/accounts/doctype/account/test_account.py b/erpnext/accounts/doctype/account/test_account.py
index 2d15b62..3221901 100644
--- a/erpnext/accounts/doctype/account/test_account.py
+++ b/erpnext/accounts/doctype/account/test_account.py
@@ -4,7 +4,7 @@
from __future__ import unicode_literals
import webnotes
-def make_test_records(verbose):
+def _make_test_records(verbose):
from webnotes.test_runner import make_test_objects
accounts = [
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
index 1a1fa9f..2362f3f 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
@@ -241,8 +241,8 @@
cur_frm.cscript.mode_of_payment = function(doc) {
return cur_frm.call({
- method: "get_bank_cash_account",
- args: { mode_of_payment: doc.mode_of_payment }
+ method: "erpnext.accounts.doctype.sales_invoice.sales_invoice.get_bank_cash_account",
+ args: { mode_of_payment: doc.mode_of_payment },
});
}
@@ -255,9 +255,6 @@
if (doc.is_opening == 'Yes') unhide_field('aging_date');
}
-//Make Delivery Note Button
-//-----------------------------
-
cur_frm.cscript['Make Delivery Note'] = function() {
wn.model.open_mapped_doc({
method: "erpnext.accounts.doctype.sales_invoice.sales_invoice.make_delivery_note",
diff --git a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py
index 02350c5..3092477 100644
--- a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py
+++ b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py
@@ -668,7 +668,7 @@
def test_recurring_invoice(self):
from webnotes.utils import get_first_day, get_last_day, add_to_date, nowdate, getdate
- from accounts.utils import get_fiscal_year
+ from erpnext.accounts.utils import get_fiscal_year
today = nowdate()
base_si = webnotes.bean(copy=test_records[0])
base_si.doc.fields.update({
diff --git a/erpnext/buying/doctype/purchase_order/test_purchase_order.py b/erpnext/buying/doctype/purchase_order/test_purchase_order.py
index e151970..2aede08 100644
--- a/erpnext/buying/doctype/purchase_order/test_purchase_order.py
+++ b/erpnext/buying/doctype/purchase_order/test_purchase_order.py
@@ -74,7 +74,7 @@
self.assertEquals(flt(webnotes.conn.get_value("Bin", {"item_code": "_Test Item",
"warehouse": "_Test Warehouse - _TC"}, "ordered_qty")), 0.0)
- def test_make_purchase_invocie(self):
+ def test_make_purchase_invoice(self):
from erpnext.buying.doctype.purchase_order.purchase_order import make_purchase_invoice
po = webnotes.bean(copy=test_records[0]).insert()
diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py
index 2615907..937449c 100644
--- a/erpnext/controllers/accounts_controller.py
+++ b/erpnext/controllers/accounts_controller.py
@@ -134,7 +134,8 @@
def calculate_taxes_and_totals(self):
self.discount_amount_applied = False
self._calculate_taxes_and_totals()
- if self.meta.get_field(self.doc.doctype, "discount_amount"):
+
+ if self.meta.get_field("discount_amount"):
self.apply_discount_amount()
def _calculate_taxes_and_totals(self):
diff --git a/erpnext/hooks.txt b/erpnext/hooks.txt
index 0c8b71a..a52ea2d 100644
--- a/erpnext/hooks.txt
+++ b/erpnext/hooks.txt
@@ -53,6 +53,7 @@
scheduler_event = daily:erpnext.setup.doctype.backup_manager.backup_manager.take_backups_daily
scheduler_event = daily:erpnext.stock.utils.reorder_item
scheduler_event = daily:erpnext.setup.doctype.email_digest.email_digest.send
+scheduler_event = daily:support.doctype.support_ticket.support_ticket.auto_close_tickets
#### Weekly
diff --git a/erpnext/hr/doctype/appraisal/appraisal.txt b/erpnext/hr/doctype/appraisal/appraisal.txt
index c82f848..da57097 100644
--- a/erpnext/hr/doctype/appraisal/appraisal.txt
+++ b/erpnext/hr/doctype/appraisal/appraisal.txt
@@ -2,7 +2,7 @@
{
"creation": "2013-01-10 16:34:12",
"docstatus": 0,
- "modified": "2014-01-20 17:48:22",
+ "modified": "2014-01-22 16:05:34",
"modified_by": "Administrator",
"owner": "ashwini@webnotestech.com"
},
@@ -233,7 +233,7 @@
"cancel": 0,
"delete": 0,
"doctype": "DocPerm",
- "match": "owner",
+ "restricted": 1,
"role": "Employee",
"submit": 0
},
diff --git a/erpnext/hr/doctype/expense_claim/expense_claim.txt b/erpnext/hr/doctype/expense_claim/expense_claim.txt
index 98e1782..ac7f788 100644
--- a/erpnext/hr/doctype/expense_claim/expense_claim.txt
+++ b/erpnext/hr/doctype/expense_claim/expense_claim.txt
@@ -2,7 +2,7 @@
{
"creation": "2013-01-10 16:34:14",
"docstatus": 0,
- "modified": "2014-01-20 17:48:44",
+ "modified": "2014-01-22 16:05:34",
"modified_by": "Administrator",
"owner": "harshada@webnotestech.com"
},
@@ -223,7 +223,7 @@
{
"delete": 0,
"doctype": "DocPerm",
- "match": "owner",
+ "restricted": 1,
"role": "Employee"
},
{
diff --git a/erpnext/hr/doctype/leave_allocation/leave_allocation.txt b/erpnext/hr/doctype/leave_allocation/leave_allocation.txt
index 41584c9..60f2523 100644
--- a/erpnext/hr/doctype/leave_allocation/leave_allocation.txt
+++ b/erpnext/hr/doctype/leave_allocation/leave_allocation.txt
@@ -2,7 +2,7 @@
{
"creation": "2013-02-20 19:10:38",
"docstatus": 0,
- "modified": "2014-01-20 17:48:54",
+ "modified": "2014-01-22 16:05:35",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -171,7 +171,7 @@
},
{
"doctype": "DocPerm",
- "match": "owner",
+ "restricted": 1,
"role": "HR User"
},
{
diff --git a/erpnext/patches/4_0/update_user_properties.py b/erpnext/patches/4_0/update_user_properties.py
index 085f2c1..54aed64 100644
--- a/erpnext/patches/4_0/update_user_properties.py
+++ b/erpnext/patches/4_0/update_user_properties.py
@@ -45,7 +45,11 @@
for profile in webnotes.conn.sql_list("""select name from `tabProfile`
where enabled=1 and user_type='System User'"""):
- perms = webnotes.permissions.get_user_perms(meta, "read", profile)
+ user_roles = webnotes.get_roles(profile)
+
+ perms = meta.get({"doctype": "DocPerm", "permlevel": 0,
+ "role": ["in", [["All"] + user_roles]], "read": 1})
+
# user does not have required roles
if not perms:
continue
diff --git a/erpnext/projects/doctype/task/task.txt b/erpnext/projects/doctype/task/task.txt
index 670eaa1..2dce94f 100644
--- a/erpnext/projects/doctype/task/task.txt
+++ b/erpnext/projects/doctype/task/task.txt
@@ -2,7 +2,7 @@
{
"creation": "2013-01-29 19:25:50",
"docstatus": 0,
- "modified": "2014-01-20 17:49:32",
+ "modified": "2014-01-24 13:01:46",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -15,7 +15,9 @@
"icon": "icon-check",
"max_attachments": 5,
"module": "Projects",
- "name": "__common__"
+ "name": "__common__",
+ "search_fields": "subject",
+ "title_field": "subject"
},
{
"doctype": "DocField",
diff --git a/erpnext/projects/doctype/time_log/time_log.txt b/erpnext/projects/doctype/time_log/time_log.txt
index 556597a..11fa7d6 100644
--- a/erpnext/projects/doctype/time_log/time_log.txt
+++ b/erpnext/projects/doctype/time_log/time_log.txt
@@ -2,7 +2,7 @@
{
"creation": "2013-04-03 16:38:41",
"docstatus": 0,
- "modified": "2014-01-20 17:49:34",
+ "modified": "2014-01-22 16:05:35",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -205,7 +205,7 @@
{
"create": 1,
"doctype": "DocPerm",
- "match": "owner",
+ "restricted": 1,
"role": "Projects User"
},
{
diff --git a/erpnext/selling/page/sales_browser/sales_browser.py b/erpnext/selling/page/sales_browser/sales_browser.py
index 6791ecf..bb1a094 100644
--- a/erpnext/selling/page/sales_browser/sales_browser.py
+++ b/erpnext/selling/page/sales_browser/sales_browser.py
@@ -7,17 +7,17 @@
@webnotes.whitelist()
def get_children():
- ctype = webnotes.form_dict.get('ctype')
- webnotes.form_dict['parent_field'] = 'parent_' + ctype.lower().replace(' ', '_')
+ ctype = webnotes.local.form_dict.get('ctype')
+ webnotes.local.form_dict['parent_field'] = 'parent_' + ctype.lower().replace(' ', '_')
if not webnotes.form_dict.get('parent'):
- webnotes.form_dict['parent'] = ''
+ webnotes.local.form_dict['parent'] = ''
return webnotes.conn.sql("""select name as value,
if(is_group='Yes', 1, 0) as expandable
from `tab%(ctype)s`
where docstatus < 2
and ifnull(%(parent_field)s,'') = "%(parent)s"
- order by name""" % webnotes.form_dict, as_dict=1)
+ order by name""" % webnotes.local.form_dict, as_dict=1)
@webnotes.whitelist()
def add_node():
diff --git a/erpnext/setup/doctype/item_group/item_group.py b/erpnext/setup/doctype/item_group/item_group.py
index 02fe374..7e79c95 100644
--- a/erpnext/setup/doctype/item_group/item_group.py
+++ b/erpnext/setup/doctype/item_group/item_group.py
@@ -5,10 +5,8 @@
import webnotes
from webnotes.utils.nestedset import DocTypeNestedSet
-from webnotes.webutils import WebsiteGenerator
-from webnotes.webutils import delete_page_cache
-class DocType(DocTypeNestedSet, WebsiteGenerator):
+class DocType(DocTypeNestedSet):
def __init__(self, doc, doclist=[]):
self.doc = doc
self.doclist = doclist
@@ -16,35 +14,12 @@
def on_update(self):
DocTypeNestedSet.on_update(self)
- WebsiteGenerator.on_update(self)
self.validate_name_with_item()
- invalidate_cache_for(self.doc.name)
-
self.validate_one_root()
def validate_name_with_item(self):
if webnotes.conn.exists("Item", self.doc.name):
webnotes.msgprint("An item exists with same name (%s), please change the \
item group name or rename the item" % self.doc.name, raise_exception=1)
-
-def get_group_item_count(item_group):
- child_groups = ", ".join(['"' + i[0] + '"' for i in get_child_groups(item_group)])
- return webnotes.conn.sql("""select count(*) from `tabItem`
- where docstatus = 0 and show_in_website = 1
- and (item_group in (%s)
- or name in (select parent from `tabWebsite Item Group`
- where item_group in (%s))) """ % (child_groups, child_groups))[0][0]
-
-def get_parent_item_groups(item_group_name):
- item_group = webnotes.doc("Item Group", item_group_name)
- return webnotes.conn.sql("""select name, page_name from `tabItem Group`
- where lft <= %s and rgt >= %s
- and ifnull(show_in_website,0)=1
- order by lft asc""", (item_group.lft, item_group.rgt), as_dict=True)
-
-def invalidate_cache_for(item_group):
- for i in get_parent_item_groups(item_group):
- if i.page_name:
- delete_page_cache(i.page_name)
diff --git a/erpnext/setup/doctype/sales_partner/sales_partner.py b/erpnext/setup/doctype/sales_partner/sales_partner.py
index c2309e8..cf9a863 100644
--- a/erpnext/setup/doctype/sales_partner/sales_partner.py
+++ b/erpnext/setup/doctype/sales_partner/sales_partner.py
@@ -4,9 +4,8 @@
from __future__ import unicode_literals
import webnotes
from webnotes.utils import cint, cstr, filter_strip_join
-from webnotes.webutils import WebsiteGenerator, clear_cache
-class DocType(WebsiteGenerator):
+class DocType():
def __init__(self, doc, doclist=None):
self.doc = doc
self.doclist = doclist
@@ -15,11 +14,6 @@
if self.doc.partner_website and not self.doc.partner_website.startswith("http"):
self.doc.partner_website = "http://" + self.doc.partner_website
- def on_update(self):
- WebsiteGenerator.on_update(self)
- if self.doc.page_name:
- clear_cache("partners")
-
def get_contacts(self,nm):
if nm:
contact_details =webnotes.conn.convert_to_lists(webnotes.conn.sql("select name, CONCAT(IFNULL(first_name,''),' ',IFNULL(last_name,'')),contact_no,email_id from `tabContact` where sales_partner = '%s'"%nm))
diff --git a/erpnext/stock/doctype/item/item.py b/erpnext/stock/doctype/item/item.py
index fb6f73d..16938b4 100644
--- a/erpnext/stock/doctype/item/item.py
+++ b/erpnext/stock/doctype/item/item.py
@@ -8,13 +8,12 @@
from webnotes.model.doc import addchild
from webnotes.model.bean import getlist
from webnotes import msgprint, _
-from webnotes.webutils import WebsiteGenerator
from webnotes.model.controller import DocListController
class WarehouseNotSet(Exception): pass
-class DocType(DocListController, WebsiteGenerator):
+class DocType(DocListController):
def onload(self):
self.doc.fields["__sle_exists"] = self.check_if_sle_exists()
@@ -48,7 +47,6 @@
def on_update(self):
self.validate_name_with_item_group()
- self.update_website()
self.update_item_price()
def check_warehouse_is_set_for_stock_item(self):
@@ -197,14 +195,6 @@
please change the item name or rename the item group" %
self.doc.name, raise_exception=1)
- def update_website(self):
- from erpnext.setup.doctype.item_group.item_group import invalidate_cache_for
- invalidate_cache_for(self.doc.item_group)
- [invalidate_cache_for(d.item_group) for d in \
- self.doclist.get({"doctype":"Website Item Group"})]
-
- WebsiteGenerator.on_update(self)
-
def update_item_price(self):
webnotes.conn.sql("""update `tabItem Price` set item_name=%s,
item_description=%s, modified=NOW() where item_code=%s""",
@@ -232,7 +222,6 @@
def on_trash(self):
webnotes.conn.sql("""delete from tabBin where item_code=%s""", self.doc.item_code)
- WebsiteGenerator.on_trash(self)
def before_rename(self, olddn, newdn, merge=False):
if merge:
@@ -250,18 +239,11 @@
def after_rename(self, olddn, newdn, merge):
webnotes.conn.set_value("Item", newdn, "item_code", newdn)
- self.update_website_page_name()
if merge:
self.set_last_purchase_rate(newdn)
self.recalculate_bin_qty(newdn)
- def update_website_page_name(self):
- if self.doc.page_name:
- self.update_website()
- from webnotes.webutils import clear_cache
- clear_cache(self.doc.page_name)
-
def set_last_purchase_rate(self, newdn):
from erpnext.buying.utils import get_last_purchase_details
last_purchase_rate = get_last_purchase_details(newdn).get("purchase_rate", 0)
diff --git a/erpnext/stock/doctype/item/test_item.py b/erpnext/stock/doctype/item/test_item.py
index 3cf1d5e..00ce548 100644
--- a/erpnext/stock/doctype/item/test_item.py
+++ b/erpnext/stock/doctype/item/test_item.py
@@ -36,6 +36,7 @@
"stock_uom": "_Test UOM",
"default_income_account": "Sales - _TC",
"default_warehouse": "_Test Warehouse - _TC",
+ "purchase_account": "_Test Account Cost for Goods Sold - _TC"
}, {
"doctype": "Item Reorder",
"parentfield": "item_reorder",
@@ -64,6 +65,7 @@
"stock_uom": "_Test UOM",
"default_income_account": "Sales - _TC",
"default_warehouse": "_Test Warehouse - _TC",
+ "purchase_account": "_Test Account Cost for Goods Sold - _TC"
}],
[{
"doctype": "Item",
@@ -73,6 +75,7 @@
"item_group": "_Test Item Group Desktops",
"default_warehouse": "_Test Warehouse - _TC",
"default_income_account": "Sales - _TC",
+ "purchase_account": "_Test Account Cost for Goods Sold - _TC",
"is_stock_item": "Yes",
"is_asset_item": "No",
"has_batch_no": "No",
@@ -99,6 +102,7 @@
"item_group": "_Test Item Group Desktops",
"default_warehouse": "_Test Warehouse - _TC",
"default_income_account": "Sales - _TC",
+ "purchase_account": "_Test Account Cost for Goods Sold - _TC",
"is_stock_item": "Yes",
"is_asset_item": "No",
"has_batch_no": "No",
@@ -119,6 +123,7 @@
"description": "_Test Sales BOM Item",
"item_group": "_Test Item Group Desktops",
"default_income_account": "Sales - _TC",
+ "purchase_account": "_Test Account Cost for Goods Sold - _TC",
"is_stock_item": "No",
"is_asset_item": "No",
"has_batch_no": "No",
@@ -140,6 +145,7 @@
"is_stock_item": "Yes",
"default_warehouse": "_Test Warehouse - _TC",
"default_income_account": "Sales - _TC",
+ "purchase_account": "_Test Account Cost for Goods Sold - _TC",
"is_asset_item": "No",
"has_batch_no": "No",
"has_serial_no": "No",
@@ -216,6 +222,7 @@
"item_group": "_Test Item Group Desktops",
"default_warehouse": "_Test Warehouse - _TC",
"default_income_account": "Sales - _TC",
+ "purchase_account": "_Test Account Cost for Goods Sold - _TC",
"is_stock_item": "Yes",
"is_asset_item": "No",
"has_batch_no": "No",
@@ -238,6 +245,7 @@
"is_stock_item": "Yes",
"default_warehouse": "_Test Warehouse - _TC",
"default_income_account": "Sales - _TC",
+ "purchase_account": "_Test Account Cost for Goods Sold - _TC",
"is_asset_item": "No",
"has_batch_no": "No",
"has_serial_no": "No",
diff --git a/erpnext/support/doctype/newsletter/newsletter.txt b/erpnext/support/doctype/newsletter/newsletter.txt
index 9482ed7..0618394 100644
--- a/erpnext/support/doctype/newsletter/newsletter.txt
+++ b/erpnext/support/doctype/newsletter/newsletter.txt
@@ -2,7 +2,7 @@
{
"creation": "2013-01-10 16:34:31",
"docstatus": 0,
- "modified": "2013-12-20 19:24:14",
+ "modified": "2014-01-24 13:00:11",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -13,7 +13,8 @@
"document_type": "Other",
"icon": "icon-envelope",
"module": "Support",
- "name": "__common__"
+ "name": "__common__",
+ "title_field": "subject"
},
{
"doctype": "DocField",
@@ -26,6 +27,7 @@
{
"cancel": 0,
"create": 0,
+ "delete": 0,
"doctype": "DocPerm",
"email": 1,
"name": "__common__",
diff --git a/erpnext/utilities/doctype/note/note.txt b/erpnext/utilities/doctype/note/note.txt
index b7c4f8b..94e5a0f 100644
--- a/erpnext/utilities/doctype/note/note.txt
+++ b/erpnext/utilities/doctype/note/note.txt
@@ -2,7 +2,7 @@
{
"creation": "2013-05-24 13:41:00",
"docstatus": 0,
- "modified": "2014-01-20 17:48:58",
+ "modified": "2014-01-22 16:05:35",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -25,7 +25,7 @@
"permlevel": 0
},
{
- "cancel": 1,
+ "cancel": 0,
"create": 1,
"delete": 1,
"doctype": "DocPerm",
@@ -37,6 +37,7 @@
"permlevel": 0,
"print": 1,
"read": 1,
+ "restricted": 1,
"role": "All",
"write": 1
},