0) {
+ cur_frm.set_intro(wn._("Backups will be uploaded to") + ": " +
+ wn.utils.comma_and(active_services));
+ } else {
+ cur_frm.set_intro("");
}
- })
- }
-}
-
-cur_frm.cscript.backup_right_now = function(doc) {
- msgprint("Backing up and uploading. This may take a few minutes.")
- wn.call({
- method: "setup.doctype.backup_manager.backup_manager.take_backups_dropbox",
- callback: function(r) {
- msgprint("Backups taken. Please check your email for the response.")
}
- })
-}
-//gdrive
-cur_frm.cscript.allow_gdrive_access = function(doc) {
- if (doc.send_notifications_to == '') {
- msgprint("Please enter email address.")
- }
- else {
- wn.call({
- method: "setup.doctype.backup_manager.backup_googledrive.get_gdrive_authorize_url",
- callback: function(r) {
- if(!r.exc) {
- window.open(r.message.authorize_url);
+
+ },
+
+ validate_send_notifications_to: function() {
+ if(!cur_frm.doc.send_notifications_to) {
+ msgprint(wn._("Please specify") + ": " +
+ wn._(wn.meta.get_label(cur_frm.doctype, "send_notifications_to")));
+ return false;
+ }
+
+ return true;
+ },
+
+ allow_dropbox_access: function() {
+ if(cur_frm.cscript.validate_send_notifications_to()) {
+ wn.call({
+ method: "setup.doctype.backup_manager.backup_dropbox.get_dropbox_authorize_url",
+ callback: function(r) {
+ if(!r.exc) {
+ cur_frm.set_value("dropbox_access_secret", r.message.secret);
+ cur_frm.set_value("dropbox_access_key", r.message.key);
+ cur_frm.save(null, function() {
+ window.open(r.message.url);
+ });
+ }
}
- }
- })
- }
-}
-
-cur_frm.cscript.validate_gdrive = function(doc) {
- wn.call({
- method: "setup.doctype.backup_manager.backup_googledrive.gdrive_callback",
- args: {
- verification_code: doc.verification_code
- },
- });
-}
-
-cur_frm.cscript.upload_backups_to_dropbox = function(doc) {
- cur_frm.save()
-}
-
-cur_frm.cscript.upload_backups_to_gdrive = function(doc) {
- cur_frm.save()
-}
+ });
+ }
+ },
+
+ allow_gdrive_access: function() {
+ if(cur_frm.cscript.validate_send_notifications_to()) {
+ wn.call({
+ method: "setup.doctype.backup_manager.backup_googledrive.get_gdrive_authorize_url",
+ callback: function(r) {
+ if(!r.exc) {
+ window.open(r.message.authorize_url);
+ }
+ }
+ });
+ }
+ },
+
+ validate_gdrive: function() {
+ wn.call({
+ method: "setup.doctype.backup_manager.backup_googledrive.gdrive_callback",
+ args: {
+ verification_code: cur_frm.doc.verification_code
+ },
+ });
+ },
+
+ upload_backups_to_dropbox: function() {
+ cur_frm.save();
+ },
+
+ upload_backups_to_gdrive: function() {
+ cur_frm.save();
+ },
+});
\ No newline at end of file
diff --git a/setup/doctype/backup_manager/backup_manager.py b/setup/doctype/backup_manager/backup_manager.py
index a8ecd636db..c91cf1110f 100644
--- a/setup/doctype/backup_manager/backup_manager.py
+++ b/setup/doctype/backup_manager/backup_manager.py
@@ -20,8 +20,8 @@ def take_backups_if(freq):
if webnotes.conn.get_value("Backup Manager", None, "upload_backups_to_dropbox")==freq:
take_backups_dropbox()
- if webnotes.conn.get_value("Backup Manager", None, "upload_backups_to_gdrive")==freq:
- take_backups_gdrive()
+ # if webnotes.conn.get_value("Backup Manager", None, "upload_backups_to_gdrive")==freq:
+ # take_backups_gdrive()
@webnotes.whitelist()
def take_backups_dropbox():
@@ -35,7 +35,7 @@ def take_backups_dropbox():
except Exception:
file_and_error = [" - ".join(f) for f in zip(did_not_upload, error_log)]
error_message = ("\n".join(file_and_error) + "\n" + webnotes.getTraceback())
- print error_message
+ webnotes.errprint(error_message)
send_email(False, "Dropbox", error_message)
#backup to gdrive
@@ -51,7 +51,7 @@ def take_backups_gdrive():
except Exception:
file_and_error = [" - ".join(f) for f in zip(did_not_upload, error_log)]
error_message = ("\n".join(file_and_error) + "\n" + webnotes.getTraceback())
- print error_message
+ webnotes.errprint(error_message)
send_email(False, "Google Drive", error_message)
def send_email(success, service_name, error_status=None):
diff --git a/setup/doctype/backup_manager/backup_manager.txt b/setup/doctype/backup_manager/backup_manager.txt
index 9a43f34746..2d6f191e5e 100644
--- a/setup/doctype/backup_manager/backup_manager.txt
+++ b/setup/doctype/backup_manager/backup_manager.txt
@@ -1,8 +1,8 @@
[
{
- "creation": "2013-03-15 11:06:59",
+ "creation": "2013-04-30 12:58:38",
"docstatus": 0,
- "modified": "2013-03-15 17:27:33",
+ "modified": "2013-05-02 11:42:08",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -109,6 +109,7 @@
"doctype": "DocField",
"fieldname": "sync_with_gdrive",
"fieldtype": "Section Break",
+ "hidden": 1,
"label": "Sync with Google Drive"
},
{
diff --git a/setup/doctype/global_defaults/global_defaults.py b/setup/doctype/global_defaults/global_defaults.py
index 8275513dc9..191a47edf2 100644
--- a/setup/doctype/global_defaults/global_defaults.py
+++ b/setup/doctype/global_defaults/global_defaults.py
@@ -31,6 +31,7 @@ keydict = {
'item_group': 'default_item_group',
'customer_group': 'default_customer_group',
'cust_master_name': 'cust_master_name',
+ "item_naming_by": "item_naming_by",
'supplier_type': 'default_supplier_type',
'supp_master_name': 'supp_master_name',
'territory': 'default_territory',
diff --git a/setup/doctype/global_defaults/global_defaults.txt b/setup/doctype/global_defaults/global_defaults.txt
index 7f81618469..853bb57705 100644
--- a/setup/doctype/global_defaults/global_defaults.txt
+++ b/setup/doctype/global_defaults/global_defaults.txt
@@ -1,8 +1,8 @@
[
{
- "creation": "2013-03-25 11:08:14",
+ "creation": "2013-04-01 15:05:24",
"docstatus": 0,
- "modified": "2013-03-28 15:41:03",
+ "modified": "2013-05-02 15:05:21",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -27,8 +27,6 @@
"permlevel": 0
},
{
- "amend": 0,
- "cancel": 0,
"create": 1,
"doctype": "DocPerm",
"name": "__common__",
@@ -167,6 +165,13 @@
"read_only": 0,
"width": "50%"
},
+ {
+ "doctype": "DocField",
+ "fieldname": "item_naming_by",
+ "fieldtype": "Select",
+ "label": "Item Naming By",
+ "options": "Item Code\nNaming Series"
+ },
{
"doctype": "DocField",
"fieldname": "default_item_group",
@@ -502,6 +507,11 @@
"label": "SMS Sender Name",
"read_only": 0
},
+ {
+ "amend": 0,
+ "cancel": 0,
+ "doctype": "DocPerm"
+ },
{
"doctype": "DocPerm"
}
diff --git a/setup/doctype/naming_series/naming_series.py b/setup/doctype/naming_series/naming_series.py
index 7b804f8a96..3a6b36d1ff 100644
--- a/setup/doctype/naming_series/naming_series.py
+++ b/setup/doctype/naming_series/naming_series.py
@@ -123,7 +123,14 @@ class DocType:
def validate_series_name(self, n):
import re
- if not re.match('[a-zA-Z0-9]+(([-/][a-zA-Z0-9])?[-/][a-zA-Z0-9]*)*',n):
+ if "." in n:
+ parts = n.split(".")
+ if len(parts) > 2:
+ msgprint("Only one dot (.) allowed in " + n, raise_exception=1)
+ if not re.match("#+$", parts[-1]):
+ msgprint("Numbering series must be in hashes (e.g. ####)", raise_exception=1)
+ n = n[0]
+ if not re.match("^[a-zA-Z0-9-/]*$", n):
msgprint('Special Characters except "-" and "/" not allowed in naming series')
raise Exception
diff --git a/setup/doctype/naming_series/naming_series.txt b/setup/doctype/naming_series/naming_series.txt
index 3de9e5cfab..0dab9e970d 100644
--- a/setup/doctype/naming_series/naming_series.txt
+++ b/setup/doctype/naming_series/naming_series.txt
@@ -1,8 +1,8 @@
[
{
- "creation": "2013-01-10 16:34:23",
+ "creation": "2013-01-25 11:35:08",
"docstatus": 0,
- "modified": "2013-01-22 14:56:34",
+ "modified": "2013-05-02 15:34:41",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -25,8 +25,6 @@
"permlevel": 0
},
{
- "amend": 0,
- "cancel": 0,
"create": 1,
"doctype": "DocPerm",
"name": "__common__",
@@ -62,7 +60,7 @@
"fieldname": "help_html",
"fieldtype": "HTML",
"label": "Help HTML",
- "options": "\nEdit list of Series in the box below. Each Series Prefix on a new line.
\nAllowed special characters are \"/\" and \"-\"
\nExamples:
\nINV-
\nINV-10-
\nINVK-
\n
"
+ "options": "\nEdit list of Series in the box below. Rules:\n
\n- Each Series Prefix on a new line.
\n- Allowed special characters are \"/\" and \"-\"
\n- Optionally, set the number of digits in the series using dot (.) followed by hashes (#). For example, \".####\" means that the series will have four digits. Default is five digits.
\n
\nExamples:
\nINV-
\nINV-10-
\nINVK-
\nINV-.####
\n
"
},
{
"doctype": "DocField",
diff --git a/setup/doctype/price_list/price_list.txt b/setup/doctype/price_list/price_list.txt
index a230f5b98c..bce8aae6e7 100644
--- a/setup/doctype/price_list/price_list.txt
+++ b/setup/doctype/price_list/price_list.txt
@@ -2,7 +2,7 @@
{
"creation": "2013-01-25 11:35:09",
"docstatus": 0,
- "modified": "2013-01-22 14:56:41",
+ "modified": "2013-05-02 14:44:24",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -52,13 +52,21 @@
"oldfieldtype": "Data",
"reqd": 1
},
+ {
+ "doctype": "DocField",
+ "fieldname": "currency",
+ "fieldtype": "Link",
+ "label": "Currency",
+ "options": "Currency",
+ "reqd": 1
+ },
{
"depends_on": "price_list_name",
"doctype": "DocField",
"fieldname": "how_to_upload",
"fieldtype": "HTML",
"label": "How to upload",
- "options": "Use the
Data Import Tool to upload, update Item Prices in bulk:\n
\n- Go to Data Import Tool.\n
- Select \"Item\"\n
- Check on \"With Data\"\n
- Download \"Item Price\" from Child Tables.\n
- Update the prices required and add new rows if required.\n
- Check on \"Overwrite\"\n
- Upload the modified sheet.\n
\n"
+ "options": "Use the
Data Import Tool to upload, update Item Prices in bulk:\n
\n- Go to Data Import Tool.\n
- Select \"Item\"\n
- Check on \"With Data\"\n
- Download \"Item Price\" from Child Tables.\n
- Update the prices required and add new rows if required.\n
- Check on \"Overwrite\"\n
- Upload the modified sheet.\n
\n"
},
{
"cancel": 0,
@@ -78,7 +86,6 @@
"cancel": 1,
"create": 1,
"doctype": "DocPerm",
- "match": "",
"role": "Sales Master Manager",
"write": 1
}
diff --git a/setup/doctype/price_list/test_price_list.py b/setup/doctype/price_list/test_price_list.py
index 53b86a39fc..30262dc8aa 100644
--- a/setup/doctype/price_list/test_price_list.py
+++ b/setup/doctype/price_list/test_price_list.py
@@ -1,6 +1,7 @@
test_records = [
[{
"doctype": "Price List",
- "price_list_name": "_Test Price List"
+ "price_list_name": "_Test Price List",
+ "currency": "INR"
}]
]
\ No newline at end of file
diff --git a/stock/doctype/batch/batch.txt b/stock/doctype/batch/batch.txt
index 4722996c0f..c6ed3c370a 100644
--- a/stock/doctype/batch/batch.txt
+++ b/stock/doctype/batch/batch.txt
@@ -1,8 +1,8 @@
[
{
- "creation": "2013-03-01 19:09:43",
+ "creation": "2013-03-05 14:50:38",
"docstatus": 0,
- "modified": "2013-03-01 08:22:16",
+ "modified": "2013-05-01 15:49:47",
"modified_by": "Administrator",
"owner": "harshada@webnotestech.com"
},
@@ -24,14 +24,19 @@
"permlevel": 0
},
{
+ "cancel": 1,
+ "create": 1,
"doctype": "DocPerm",
"name": "__common__",
"parent": "Batch",
"parentfield": "permissions",
"parenttype": "DocType",
+ "permlevel": 0,
"read": 1,
+ "report": 1,
"role": "Material Master Manager",
- "submit": 0
+ "submit": 0,
+ "write": 1
},
{
"doctype": "DocType",
@@ -94,28 +99,6 @@
"oldfieldtype": "Date"
},
{
- "doctype": "DocField",
- "fieldname": "trash_reason",
- "fieldtype": "Small Text",
- "label": "Trash Reason",
- "oldfieldname": "trash_reason",
- "oldfieldtype": "Small Text",
- "read_only": 1
- },
- {
- "cancel": 1,
- "create": 1,
- "doctype": "DocPerm",
- "permlevel": 0,
- "report": 1,
- "write": 1
- },
- {
- "amend": 0,
- "cancel": 0,
- "create": 0,
- "doctype": "DocPerm",
- "match": "",
- "permlevel": 1
+ "doctype": "DocPerm"
}
]
\ No newline at end of file
diff --git a/stock/doctype/delivery_note/delivery_note.js b/stock/doctype/delivery_note/delivery_note.js
index 8d09cbd676..0a31dfe80e 100644
--- a/stock/doctype/delivery_note/delivery_note.js
+++ b/stock/doctype/delivery_note/delivery_note.js
@@ -326,6 +326,17 @@ if (sys_defaults.auto_inventory_accounting) {
}
// 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) {
return {
query: "accounts.utils.get_cost_center_list",
diff --git a/stock/doctype/item/item.js b/stock/doctype/item/item.js
index 8b3e04484a..a344ad3ce9 100644
--- a/stock/doctype/item/item.js
+++ b/stock/doctype/item/item.js
@@ -14,11 +14,17 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
+cur_frm.add_fetch("price_list_name", "currency", "ref_currency")
+
cur_frm.cscript.refresh = function(doc) {
// make sensitive fields(has_serial_no, is_stock_item, valuation_method)
// read only if any stock ledger entry exists
- cur_frm.toggle_enable("item_code", doc.__islocal);
+ cur_frm.toggle_display("naming_series", sys_defaults.item_naming_by=="Naming Series"
+ && doc.__islocal)
+ cur_frm.toggle_display("item_code", sys_defaults.item_naming_by!="Naming Series"
+ && doc.__islocal)
+
if ((!doc.__islocal) && (doc.is_stock_item == 'Yes')) {
var callback = function(r, rt) {
diff --git a/stock/doctype/item/item.py b/stock/doctype/item/item.py
index 4767742e3e..63275047ad 100644
--- a/stock/doctype/item/item.py
+++ b/stock/doctype/item/item.py
@@ -23,7 +23,17 @@ from webnotes.model.bean import getlist
from webnotes import msgprint, _
from webnotes.model.controller import DocListController
+
+class PriceListCurrencyMismatch(Exception): pass
+
class DocType(DocListController):
+ def autoname(self):
+ if webnotes.conn.get_default("item_naming_by")=="Naming Series":
+ from webnotes.model.doc import make_autoname
+ self.doc.item_code = make_autoname(self.doc.naming_series+'.#####')
+
+ self.doc.name = self.doc.item_code
+
def validate(self):
if not self.doc.stock_uom:
msgprint(_("Please enter Default Unit of Measure"), raise_exception=1)
@@ -33,7 +43,7 @@ class DocType(DocListController):
self.add_default_uom_in_conversion_factor_table()
self.valiadte_item_type()
self.check_for_active_boms()
- self.check_ref_rate_detail()
+ self.validate_price_lists()
self.fill_customer_code()
self.check_item_tax()
self.validate_barcode()
@@ -55,12 +65,13 @@ class DocType(DocListController):
ch.conversion_factor = 1
def check_stock_uom_with_bin(self):
- bin = webnotes.conn.sql("select stock_uom from `tabBin` where item_code = %s",
- self.doc.item_code)
- if self.doc.stock_uom and bin and cstr(bin[0][0]) \
- and cstr(bin[0][0]) != cstr(self.doc.stock_uom):
- msgprint(_("Please Update Stock UOM with the help of Stock UOM Replace Utility."),
- raise_exception=1)
+ if not self.doc.fields.get("__islocal"):
+ bin = webnotes.conn.sql("select stock_uom from `tabBin` where item_code = %s",
+ self.doc.name)
+ if self.doc.stock_uom and bin and cstr(bin[0][0]) \
+ and cstr(bin[0][0]) != cstr(self.doc.stock_uom):
+ msgprint(_("Please Update Stock UOM with the help of Stock UOM Replace Utility."),
+ raise_exception=1)
def validate_conversion_factor(self):
check_list = []
@@ -120,16 +131,21 @@ class DocType(DocListController):
if cstr(self.doc.fields.get(d)) != 'Yes':
_check_for_active_boms(fl[d])
- def check_ref_rate_detail(self):
- check_list=[]
+ def validate_price_lists(self):
+ price_lists=[]
for d in getlist(self.doclist,'ref_rate_details'):
- if [cstr(d.price_list_name), cstr(d.ref_currency),
- cint(d.selling), cint(d.buying)] in check_list:
- msgprint("Ref Rate is entered twice for Price List : '%s' and Currency : '%s'." %
- (d.price_list_name,d.ref_currency), raise_exception=1)
+ if d.price_list_name in price_lists:
+ msgprint(_("Cannot have two prices for same Price List") + ": " + d.price_list_name,
+ raise_exception= webnotes.DuplicateEntryError)
else:
- check_list.append([cstr(d.price_list_name),cstr(d.ref_currency)])
-
+ price_list_currency = webnotes.conn.get_value("Price List", d.price_list_name, "currency")
+ if price_list_currency and d.ref_currency != price_list_currency:
+ msgprint(_("Currency does not match Price List Currency for Price List") \
+ + ": " + d.price_list_name, raise_exception=PriceListCurrencyMismatch)
+
+ price_lists.append(d.price_list_name)
+
+
def fill_customer_code(self):
""" Append all the customer codes and insert into "customer_code" field of item table """
cust_code=[]
@@ -154,13 +170,14 @@ class DocType(DocListController):
def validate_barcode(self):
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:
msgprint("Barcode: %s already used in item: %s" %
(self.doc.barcode, cstr(duplicate[0][0])), raise_exception = 1)
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)
for e in existing_qty:
msgprint("%s Units exist in Warehouse %s, which is not an Asset Warehouse." %
diff --git a/stock/doctype/item/item.txt b/stock/doctype/item/item.txt
index a311c4c5bc..d6eaf345ed 100644
--- a/stock/doctype/item/item.txt
+++ b/stock/doctype/item/item.txt
@@ -2,7 +2,7 @@
{
"creation": "2013-03-28 10:35:28",
"docstatus": 0,
- "modified": "2013-04-23 11:44:39",
+ "modified": "2013-05-02 15:10:53",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -34,7 +34,6 @@
"parent": "Item",
"parentfield": "permissions",
"parenttype": "DocType",
- "permlevel": 0,
"read": 1,
"submit": 0
},
@@ -51,6 +50,13 @@
"oldfieldtype": "Section Break",
"read_only": 0
},
+ {
+ "doctype": "DocField",
+ "fieldname": "naming_series",
+ "fieldtype": "Select",
+ "label": "Naming Series",
+ "options": "\nITEM"
+ },
{
"description": "Item will be saved by this name in the data base.",
"doctype": "DocField",
diff --git a/stock/doctype/item/test_item.py b/stock/doctype/item/test_item.py
index dbbeecc85b..f5a688ca70 100644
--- a/stock/doctype/item/test_item.py
+++ b/stock/doctype/item/test_item.py
@@ -20,6 +20,22 @@ import webnotes
test_ignore = ["BOM"]
+class TestItem(unittest.TestCase):
+ def test_duplicate_price_list(self):
+ item = webnotes.bean(copy=test_records[0])
+ item.doc.item_code = "_Test Item 10"
+ item_price = item.doclist.get({"doctype": "Item Price"})[0]
+ item.doclist.append(webnotes.doc(item_price.fields.copy()))
+ self.assertRaises(webnotes.DuplicateEntryError, item.insert)
+
+ def test_price_list_mismatch(self):
+ from stock.doctype.item.item import PriceListCurrencyMismatch
+ item = webnotes.bean(copy=test_records[0])
+ item.doc.item_code = "_Test Item 11"
+ item_price = item.doclist.get({"doctype": "Item Price"})[0].ref_currency="USD"
+ self.assertRaises(PriceListCurrencyMismatch, item.insert)
+
+
test_records = [
[{
"doctype": "Item",
@@ -45,7 +61,14 @@ test_records = [
"warehouse": "_Test Warehouse",
"warehouse_reorder_level": 20,
"warehouse_reorder_qty": 20
- }],
+ }, {
+ "doctype": "Item Price",
+ "parentfield": "ref_rate_details",
+ "price_list_name": "_Test Price List",
+ "ref_rate": 100,
+ "ref_currency": "INR"
+ }
+ ],
[{
"doctype": "Item",
"item_code": "_Test Item Home Desktop 100",
diff --git a/stock/doctype/material_request/test_material_request.py b/stock/doctype/material_request/test_material_request.py
index 080989f2d9..f5dbb52bbe 100644
--- a/stock/doctype/material_request/test_material_request.py
+++ b/stock/doctype/material_request/test_material_request.py
@@ -263,6 +263,12 @@ class TestMaterialRequest(unittest.TestCase):
se = webnotes.bean(copy=se_doclist)
self.assertRaises(webnotes.MappingMismatchError, se.insert)
+ def test_warehouse_company_validation(self):
+ from controllers.buying_controller import WrongWarehouseCompany
+ mr = webnotes.bean(copy=test_records[0])
+ mr.doc.company = "_Test Company 1"
+ self.assertRaises(WrongWarehouseCompany, mr.insert)
+
test_records = [
[
{
diff --git a/stock/doctype/stock_ledger/stock_ledger.py b/stock/doctype/stock_ledger/stock_ledger.py
index 3c83de3260..8fdb50e7a4 100644
--- a/stock/doctype/stock_ledger/stock_ledger.py
+++ b/stock/doctype/stock_ledger/stock_ledger.py
@@ -114,7 +114,8 @@ class DocType:
def update_serial_purchase_details(self, obj, d, serial_no, is_submit, purpose = '', rejected=None):
exists = webnotes.conn.sql("select name, status, docstatus from `tabSerial No` where name = '%s'" % (serial_no))
if is_submit:
- if exists and exists[0][2] != 2 and purpose not in ['Material Transfer', 'Sales Return']:
+ if exists and exists[0][2] != 2 and \
+ purpose not in ['Material Transfer', "Material Receipt", 'Sales Return']:
msgprint("Serial No: %s already %s" % (serial_no, exists and exists[0][1]), raise_exception = 1)
elif exists:
s = Document('Serial No', exists and exists[0][0])
diff --git a/stock/doctype/warehouse/test_warehouse.py b/stock/doctype/warehouse/test_warehouse.py
index 26501beab9..f3a04581a9 100644
--- a/stock/doctype/warehouse/test_warehouse.py
+++ b/stock/doctype/warehouse/test_warehouse.py
@@ -2,7 +2,8 @@ test_records = [
[{
"doctype": "Warehouse",
"warehouse_name": "_Test Warehouse",
- "warehouse_type": "_Test Warehouse Type"
+ "warehouse_type": "_Test Warehouse Type",
+ "company": "_Test Company"
}],
[{
"doctype": "Warehouse",
diff --git a/stock/page/stock_ageing/stock_ageing.js b/stock/page/stock_ageing/stock_ageing.js
index e257bd4722..b9b4c8053b 100644
--- a/stock/page/stock_ageing/stock_ageing.js
+++ b/stock/page/stock_ageing/stock_ageing.js
@@ -95,6 +95,8 @@ erpnext.StockAgeing = erpnext.StockGridReport.extend({
this.data = [].concat(this._data);
+ this.serialized_buying_rates = this.get_serialized_buying_rates();
+
$.each(this.data, function(i, d) {
me.reset_item_values(d);
});
diff --git a/support/doctype/support_ticket/support_ticket.js b/support/doctype/support_ticket/support_ticket.js
index 4d59f42228..aee364e213 100644
--- a/support/doctype/support_ticket/support_ticket.js
+++ b/support/doctype/support_ticket/support_ticket.js
@@ -29,17 +29,13 @@ $.extend(cur_frm.cscript, {
erpnext.hide_naming_series();
cur_frm.cscript.make_listing(doc);
if(!doc.__islocal) {
- if(in_list(user_roles,'System Manager')) {
- 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']);
- }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']);
+ 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('Re-Open Ticket', cur_frm.cscript['Re-Open Ticket']);
}
- cur_frm.set_df_property('subject','read_only', 1);
- cur_frm.set_df_property('description','hidden', 1);
- cur_frm.set_df_property('raised_by','read_only', 1);
+ cur_frm.toggle_enable(["subject", "raised_by"], false);
+ cur_frm.toggle_display("description", false);
}
refresh_field('status');
},
diff --git a/support/doctype/support_ticket/support_ticket.py b/support/doctype/support_ticket/support_ticket.py
index 5625f1179c..8a705f41c7 100644
--- a/support/doctype/support_ticket/support_ticket.py
+++ b/support/doctype/support_ticket/support_ticket.py
@@ -45,6 +45,10 @@ class DocType(TransactionBase):
def validate(self):
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):
webnotes.conn.set(self.doc, 'status', 'Waiting for Customer')
if comm.lead and not self.doc.lead:
diff --git a/utilities/doctype/rename_tool/rename_tool.py b/utilities/doctype/rename_tool/rename_tool.py
index 2e368ced70..5accf3c6b7 100644
--- a/utilities/doctype/rename_tool/rename_tool.py
+++ b/utilities/doctype/rename_tool/rename_tool.py
@@ -34,7 +34,8 @@ def upload(select_doctype=None, rows=None):
rename_log = []
for row in rows:
- if len(row) > 2:
+ # if row has some content
+ if len(row) > 1 and row[0] and row[1]:
try:
if rename_doc(select_doctype, row[0], row[1]):
rename_log.append(_("Successful: ") + row[0] + " -> " + row[1])
@@ -45,5 +46,5 @@ def upload(select_doctype=None, rows=None):
rename_log.append("" + \
_("Failed: ") + row[0] + " -> " + row[1] + "")
rename_log.append("" + repr(e) + "")
-
+
return rename_log
\ No newline at end of file