diff --git a/erpnext/setup/doctype/company/company.py b/erpnext/setup/doctype/company/company.py
index 11ed655ce49..195b0218a05 100644
--- a/erpnext/setup/doctype/company/company.py
+++ b/erpnext/setup/doctype/company/company.py
@@ -166,6 +166,8 @@ class DocType:
ac.fields[d] = (d == 'parent_account' and lst[self.fld_dict[d]]) and lst[self.fld_dict[d]] +' - '+ self.doc.abbr or lst[self.fld_dict[d]]
ac.old_parent = ''
ac_obj = get_obj(doc=ac)
+ ac_obj.doc.freeze_account='No'
+ ac_obj.doc.master_type = ''
ac_obj.validate()
ac_obj.doc.save(1)
ac_obj.on_update()
diff --git a/erpnext/setup/doctype/company/company.txt b/erpnext/setup/doctype/company/company.txt
index 17bd61b6e33..3437fafdbc0 100644
--- a/erpnext/setup/doctype/company/company.txt
+++ b/erpnext/setup/doctype/company/company.txt
@@ -3,9 +3,9 @@
# These values are common in all dictionaries
{
- 'creation': '2012-03-27 14:36:19',
+ 'creation': '2012-07-03 13:30:55',
'docstatus': 0,
- 'modified': '2012-03-27 14:36:19',
+ 'modified': '2012-07-11 14:43:55',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
@@ -23,7 +23,7 @@
'section_style': u'Tabbed',
'server_code_error': u' ',
'show_in_menu': 0,
- 'version': 96
+ 'version': 1
},
# These values are common for all DocField
@@ -85,11 +85,11 @@
# DocField
{
- 'description': u'Please Enter Company Name and Abbr and save the document. Once saved Accounting Settings will be populated automatically',
+ 'colour': u'White:FFF',
'doctype': u'DocField',
'fieldname': u'details',
'fieldtype': u'Section Break',
- 'label': u'Details',
+ 'label': u'Company Details',
'oldfieldtype': u'Section Break',
'permlevel': 0
},
@@ -108,6 +108,14 @@
'reqd': 1
},
+ # DocField
+ {
+ 'doctype': u'DocField',
+ 'fieldname': u'cb0',
+ 'fieldtype': u'Column Break',
+ 'permlevel': 0
+ },
+
# DocField
{
'colour': u'White:FFF',
@@ -253,6 +261,8 @@
# DocField
{
+ 'colour': u'White:FFF',
+ 'description': u'For reference only.',
'doctype': u'DocField',
'fieldname': u'company_info',
'fieldtype': u'Section Break',
diff --git a/erpnext/setup/doctype/currency/currency.js b/erpnext/setup/doctype/currency/currency.js
new file mode 100644
index 00000000000..cd42c189565
--- /dev/null
+++ b/erpnext/setup/doctype/currency/currency.js
@@ -0,0 +1,3 @@
+cur_frm.cscript.refresh = function(doc) {
+ cur_frm.set_intro(doc.__islocal ? "" : "There is nothing to edit.")
+}
\ No newline at end of file
diff --git a/erpnext/setup/doctype/currency/currency.txt b/erpnext/setup/doctype/currency/currency.txt
index 5abf9c5932f..906e2f8a7d4 100644
--- a/erpnext/setup/doctype/currency/currency.txt
+++ b/erpnext/setup/doctype/currency/currency.txt
@@ -3,17 +3,19 @@
# These values are common in all dictionaries
{
- 'creation': '2012-03-27 14:36:19',
+ 'creation': '2012-07-03 13:30:55',
'docstatus': 0,
- 'modified': '2012-03-27 14:36:19',
+ 'modified': '2012-07-11 16:11:45',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
# These values are common for all DocType
{
+ 'allow_trash': 1,
'autoname': u'field:currency_name',
'colour': u'White:FFF',
+ 'description': u'**Currency** Master',
'doctype': 'DocType',
'in_create': 0,
'module': u'Setup',
@@ -22,7 +24,7 @@
'section_style': u'Simple',
'server_code_error': u' ',
'show_in_menu': 0,
- 'version': 3
+ 'version': 1
},
# These values are common for all DocField
@@ -60,10 +62,17 @@
'name': u'Currency'
},
+ # DocPerm
+ {
+ 'cancel': 1,
+ 'doctype': u'DocPerm',
+ 'role': u'Accounts Manager'
+ },
+
# DocPerm
{
'amend': 0,
- 'cancel': 0,
+ 'cancel': 1,
'doctype': u'DocPerm',
'role': u'Sales Master Manager',
'submit': 0
@@ -78,12 +87,6 @@
'submit': 0
},
- # DocPerm
- {
- 'doctype': u'DocPerm',
- 'role': u'Accounts Manager'
- },
-
# DocField
{
'doctype': u'DocField'
diff --git a/erpnext/setup/doctype/customer_group/customer_group.js b/erpnext/setup/doctype/customer_group/customer_group.js
index 11794cc56a2..67bc29368ea 100644
--- a/erpnext/setup/doctype/customer_group/customer_group.js
+++ b/erpnext/setup/doctype/customer_group/customer_group.js
@@ -14,21 +14,22 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
-
-
-cur_frm.cscript.onload = function(){
-
- if(doc.__islocal){
- doc.parent_customer_group = 'Root';
- refresh('parent_customer_group');
- }
+cur_frm.cscript.set_breadcrumbs = function(barea) {
+ cur_frm.frm_head.appframe.add_breadcrumb(cur_frm.docname);
+ cur_frm.frm_head.appframe.add_breadcrumb(' in \
+ Customer Group Tree');
+ cur_frm.frm_head.appframe.add_breadcrumb(' in Selling');
}
+
cur_frm.cscript.refresh = function(doc, cdt, cdn) {
}
//get query select Customer Group
cur_frm.fields_dict['parent_customer_group'].get_query = function(doc,cdt,cdn) {
- return 'SELECT `tabCustomer Group`.`name`,`tabCustomer Group`.`parent_customer_group` FROM `tabCustomer Group` WHERE `tabCustomer Group`.`is_group` = "Yes" AND `tabCustomer Group`.`docstatus`!= 2 AND `tabCustomer Group`.%(key)s LIKE "%s" ORDER BY `tabCustomer Group`.`name` ASC LIMIT 50';
+ return 'SELECT `tabCustomer Group`.`name`,`tabCustomer Group`.`parent_customer_group` \
+ FROM `tabCustomer Group` WHERE `tabCustomer Group`.`is_group` = "Yes" AND \
+ `tabCustomer Group`.`docstatus`!= 2 AND `tabCustomer Group`.%(key)s LIKE "%s" \
+ ORDER BY `tabCustomer Group`.`name` ASC LIMIT 50';
}
\ No newline at end of file
diff --git a/erpnext/setup/doctype/customer_group/customer_group.txt b/erpnext/setup/doctype/customer_group/customer_group.txt
index ceda674306a..5e44bef6a8d 100644
--- a/erpnext/setup/doctype/customer_group/customer_group.txt
+++ b/erpnext/setup/doctype/customer_group/customer_group.txt
@@ -3,9 +3,9 @@
# These values are common in all dictionaries
{
- 'creation': '2012-04-13 11:56:30',
+ 'creation': '2012-07-03 13:30:55',
'docstatus': 0,
- 'modified': '2012-04-19 17:50:43',
+ 'modified': '2012-07-12 09:47:20',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
@@ -22,6 +22,7 @@
'in_create': 1,
'module': u'Setup',
'name': '__common__',
+ 'read_only': 1,
'search_fields': u'name,parent_customer_group',
'section_style': u'Simple',
'server_code_error': u' ',
@@ -140,18 +141,6 @@
'reqd': 1
},
- # DocField
- {
- 'doctype': u'DocField',
- 'fieldname': u'description',
- 'fieldtype': u'Text',
- 'label': u'Description',
- 'oldfieldname': u'description',
- 'oldfieldtype': u'Text',
- 'permlevel': 0,
- 'width': u'300px'
- },
-
# DocField
{
'colour': u'White:FFF',
@@ -184,6 +173,16 @@
# DocField
{
+ 'doctype': u'DocField',
+ 'fieldname': u'cb0',
+ 'fieldtype': u'Column Break',
+ 'permlevel': 0
+ },
+
+ # DocField
+ {
+ 'colour': u'White:FFF',
+ 'description': u'This Price List will be selected as default for all Customers under this Group.',
'doctype': u'DocField',
'fieldname': u'default_price_list',
'fieldtype': u'Link',
diff --git a/erpnext/setup/doctype/item_group/item_group.js b/erpnext/setup/doctype/item_group/item_group.js
index db7582ce112..e5e108a3dd4 100644
--- a/erpnext/setup/doctype/item_group/item_group.js
+++ b/erpnext/setup/doctype/item_group/item_group.js
@@ -14,21 +14,14 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
-
-
-cur_frm.cscript.onload = function(){
-
- if(doc.__islocal){
- doc.parent_item_group = 'Root';
- refresh('parent_item_group');
- }
+cur_frm.cscript.set_breadcrumbs = function(barea) {
+ cur_frm.frm_head.appframe.add_breadcrumb(cur_frm.docname);
+ cur_frm.frm_head.appframe.add_breadcrumb(' in \
+ Item Group Tree');
+ cur_frm.frm_head.appframe.add_breadcrumb(' in Selling');
}
//get query select item group
cur_frm.fields_dict['parent_item_group'].get_query = function(doc,cdt,cdn) {
return 'SELECT `tabItem Group`.`name`,`tabItem Group`.`parent_item_group` FROM `tabItem Group` WHERE `tabItem Group`.`is_group` = "Yes" AND `tabItem Group`.`docstatus`!= 2 AND `tabItem Group`.`name` !="'+doc.item_group_name+'" AND `tabItem Group`.%(key)s LIKE "%s" ORDER BY `tabItem Group`.`name` ASC LIMIT 50';
-}
-
-cur_frm.cscript.refresh = function(doc, cdt, cdn) {
-
}
\ No newline at end of file
diff --git a/erpnext/setup/doctype/item_group/item_group.py b/erpnext/setup/doctype/item_group/item_group.py
index 7e92f53cf49..0253c8e40da 100644
--- a/erpnext/setup/doctype/item_group/item_group.py
+++ b/erpnext/setup/doctype/item_group/item_group.py
@@ -14,66 +14,15 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-# Please edit this list and import only required elements
import webnotes
-from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
-from webnotes.model import db_exists
-from webnotes.model.doc import Document, addchild, getchildren, make_autoname
-from webnotes.model.doclist import getlist, copy_doclist
-from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
-from webnotes import session, form, is_testing, msgprint, errprint
+from webnotes.model.doclist import getlist
+from webnotes.utils import flt
-set = webnotes.conn.set
-sql = webnotes.conn.sql
-get_value = webnotes.conn.get_value
-in_transaction = webnotes.conn.in_transaction
-convert_to_lists = webnotes.conn.convert_to_lists
-
-# -----------------------------------------------------------------------------------------
+from webnotes.utils.nestedset import DocTypeNestedSet
-
-class DocType:
- def __init__(self,d,dl):
- self.doc, self.doclist = d,dl
- self.nsm_parent_field = 'parent_item_group';
-
- # update Node Set Model
- def update_nsm_model(self):
- import webnotes
- import webnotes.utils.nestedset
- webnotes.utils.nestedset.update_nsm(self)
-
- # ON UPDATE
- #--------------------------------------
- def on_update(self):
- # update nsm
- self.update_nsm_model()
-
- def validate(self):
- if self.doc.lft and self.doc.rgt:
- res = sql("select name from `tabItem Group` where is_group = 'Yes' and docstatus!= 2 and name ='%s' and name !='%s'"%(self.doc.parent_item_group,self.doc.item_group_name))
- if not res:
- msgprint("Please enter proper parent item group.")
- raise Exception
-
- r = sql("select name from `tabItem Group` where name = '%s' and docstatus = 2"%(self.doc.item_group_name))
- if r:
- msgprint("'%s' record is trashed. To untrash please go to Setup & click on Trash."%(self.doc.item_group_name))
- raise Exception
-
- def on_trash(self):
- item = sql("select name from `tabItem` where ifnull(item_group, '') = %s", self.doc.name)
- item = [d[0] for d in item]
-
- if item:
- msgprint("""Item Group: %s can not be trashed/deleted because it is used in item: %s.
- To trash/delete this, remove/change item group in item master""" % (self.doc.name, item or ''), raise_exception=1)
-
- if sql("select name from `tabItem Group` where parent_item_group = %s and docstatus != 2", self.doc.name):
- msgprint("Child item group exists for this item group. You can not trash/cancel/delete this item group.", raise_exception=1)
-
-
- # rebuild tree
- set(self.doc,'old_parent', '')
- self.update_nsm_model()
+class DocType(DocTypeNestedSet):
+ def __init__(self, doc, doclist=[]):
+ self.doc = doc
+ self.doclist = doclist
+ self.nsm_parent_field = 'parent_item_group';
\ No newline at end of file
diff --git a/erpnext/setup/doctype/item_group/item_group.txt b/erpnext/setup/doctype/item_group/item_group.txt
index b56b8da7b1b..bd9887fafdd 100644
--- a/erpnext/setup/doctype/item_group/item_group.txt
+++ b/erpnext/setup/doctype/item_group/item_group.txt
@@ -3,9 +3,9 @@
# These values are common in all dictionaries
{
- 'creation': '2012-03-27 14:36:21',
+ 'creation': '2012-07-03 13:30:53',
'docstatus': 0,
- 'modified': '2012-03-27 14:36:21',
+ 'modified': '2012-07-12 11:26:21',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
@@ -17,6 +17,7 @@
'autoname': u'field:item_group_name',
'colour': u'White:FFF',
'default_print_format': u'Standard',
+ 'description': u'Item Classification',
'doctype': 'DocType',
'document_type': u'Master',
'in_create': 1,
@@ -27,7 +28,7 @@
'section_style': u'Simple',
'server_code_error': u' ',
'show_in_menu': 0,
- 'version': 59
+ 'version': 1
},
# These values are common for all DocField
@@ -55,6 +56,54 @@
'name': u'Item Group'
},
+ # DocPerm
+ {
+ 'amend': 0,
+ 'cancel': 0,
+ 'create': 0,
+ 'doctype': u'DocPerm',
+ 'permlevel': 1,
+ 'role': u'Material Manager',
+ 'submit': 0,
+ 'write': 0
+ },
+
+ # DocPerm
+ {
+ 'amend': 0,
+ 'cancel': 0,
+ 'create': 0,
+ 'doctype': u'DocPerm',
+ 'permlevel': 0,
+ 'role': u'Material Manager',
+ 'submit': 0,
+ 'write': 0
+ },
+
+ # DocPerm
+ {
+ 'amend': 0,
+ 'cancel': 0,
+ 'create': 0,
+ 'doctype': u'DocPerm',
+ 'permlevel': 1,
+ 'role': u'Material User',
+ 'submit': 0,
+ 'write': 0
+ },
+
+ # DocPerm
+ {
+ 'amend': 0,
+ 'cancel': 0,
+ 'create': 0,
+ 'doctype': u'DocPerm',
+ 'permlevel': 0,
+ 'role': u'Material User',
+ 'submit': 0,
+ 'write': 0
+ },
+
# DocPerm
{
'cancel': 1,
@@ -75,54 +124,6 @@
'write': 1
},
- # DocPerm
- {
- 'amend': 0,
- 'cancel': 0,
- 'create': 0,
- 'doctype': u'DocPerm',
- 'permlevel': 1,
- 'role': u'Material Manager',
- 'submit': 0,
- 'write': 0
- },
-
- # DocPerm
- {
- 'amend': 0,
- 'cancel': 0,
- 'create': 0,
- 'doctype': u'DocPerm',
- 'permlevel': 0,
- 'role': u'Material Manager',
- 'submit': 0,
- 'write': 0
- },
-
- # DocPerm
- {
- 'amend': 0,
- 'cancel': 0,
- 'create': 0,
- 'doctype': u'DocPerm',
- 'permlevel': 1,
- 'role': u'Material User',
- 'submit': 0,
- 'write': 0
- },
-
- # DocPerm
- {
- 'amend': 0,
- 'cancel': 0,
- 'create': 0,
- 'doctype': u'DocPerm',
- 'permlevel': 0,
- 'role': u'Material User',
- 'submit': 0,
- 'write': 0
- },
-
# DocField
{
'doctype': u'DocField',
@@ -137,20 +138,6 @@
'search_index': 0
},
- # DocField
- {
- 'doctype': u'DocField',
- 'fieldname': u'description',
- 'fieldtype': u'Text',
- 'label': u'Description',
- 'no_copy': 0,
- 'oldfieldname': u'description',
- 'oldfieldtype': u'Text',
- 'permlevel': 0,
- 'search_index': 0,
- 'width': u'300px'
- },
-
# DocField
{
'colour': u'White:FFF',
@@ -167,14 +154,9 @@
# DocField
{
'doctype': u'DocField',
- 'fieldname': u'show_in_catalogue',
- 'fieldtype': u'Check',
- 'label': u'Show in catalogue',
- 'no_copy': 0,
- 'oldfieldname': u'show_in_catalogue',
- 'oldfieldtype': u'Check',
- 'permlevel': 0,
- 'search_index': 0
+ 'fieldname': u'cb0',
+ 'fieldtype': u'Column Break',
+ 'permlevel': 0
},
# DocField
diff --git a/erpnext/setup/doctype/price_list/price_list.js b/erpnext/setup/doctype/price_list/price_list.js
index a222a65f08f..11993f8c3b1 100644
--- a/erpnext/setup/doctype/price_list/price_list.js
+++ b/erpnext/setup/doctype/price_list/price_list.js
@@ -14,24 +14,34 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
-
-//--------- ONLOAD -------------
-cur_frm.cscript.onload = function(doc, cdt, cdn) {
-}
-
cur_frm.cscript.refresh = function(doc, cdt, cdn) {
if(doc.__islocal) {
- set_field_options('price_help', ''); return;
+ cur_frm.set_intro("Save this list to begin.");
+ return;
}
if(!doc.file_list) {
- set_field_options('price_help', '
To upload a price list, please attach a (.csv) file with 3 columns - Item Code, Price and Currency (no headings necessary). See attachments box in the right column
')
- } else {
- set_field_options('price_help', '
To update prices from the attachment, please click on "Update Prices"
')
- }
-}
+ cur_frm.set_intro('
1. Click on "Download Template" \
+ to download the template of all Items.
'
+ +'
2. Update prices and Currency.
'
+ +'
3. Save it as a CSV (.csv) file.
'
+ +'
4. Upload the file.
');
+
+ cur_frm.add_custom_button('Download Template', function() {
+ $c_obj_csv(cur_frm.get_doclist(), 'download_template');
+ }, 'icon-download')
+
+ cur_frm.add_custom_button('Upload Price List', function() {
+ cur_frm.attachments.add_attachment();
+ }, 'icon-upload')
+
-cur_frm.cscript.clear_prices = function(doc, cdt, cdn) {
- if(confirm("This action will clear all rates for '"+ doc.name +"' from the Item Master and cannot be un-done. Are you sure you want to continue?")) {
- $c_obj(make_doclist(doc.doctype, doc.name), 'clear_prices', '', function(r, rt) { });
+ } else {
+ cur_frm.set_intro('To update prices from the attachment, click on "Update Prices". \
+ To reset prices, delete the attachment (in the sidebar) and upload again.');
+
+ // Update Prices
+ cur_frm.add_custom_button('Update Prices', function() {
+ cur_frm.call_server('update_prices');
+ }, 'icon-refresh')
}
}
diff --git a/erpnext/setup/doctype/price_list/price_list.py b/erpnext/setup/doctype/price_list/price_list.py
index be59c658163..0ec71215b31 100644
--- a/erpnext/setup/doctype/price_list/price_list.py
+++ b/erpnext/setup/doctype/price_list/price_list.py
@@ -14,23 +14,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-# Please edit this list and import only required elements
import webnotes
-from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
-from webnotes.model import db_exists
-from webnotes.model.doc import Document, addchild, getchildren, make_autoname
-from webnotes.model.doclist import getlist, copy_doclist
-from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
-from webnotes import session, form, is_testing, msgprint, errprint
-
-set = webnotes.conn.set
-sql = webnotes.conn.sql
-get_value = webnotes.conn.get_value
-in_transaction = webnotes.conn.in_transaction
-convert_to_lists = webnotes.conn.convert_to_lists
-
-# -----------------------------------------------------------------------------------------
+from webnotes.model.doc import Document
+from webnotes import msgprint
class DocType:
@@ -43,11 +30,24 @@ class DocType:
if currency in self.cl:
return 1
- if sql("select name from tabCurrency where name=%s", currency):
+ if webnotes.conn.sql("select name from tabCurrency where name=%s", currency):
self.cl.append(currency)
return 1
else:
return 0
+
+ def download_template(self, arg=None):
+ """download 3 column template with all Items"""
+ default_currency = webnotes.conn.get_default('currency')
+ item_list = webnotes.conn.sql("""select name from tabItem where
+ (ifnull(is_sales_item,'')='Yes' or ifnull(is_service_item,'')='Yes')""")
+ data = [self.get_price(i[0], default_currency) for i in item_list]
+ return [['Item', 'Rate', 'Currency']] + data
+
+ def get_price(self, item, default_currency):
+ rate = webnotes.conn.sql("""select ref_rate, ref_currency from `tabItem Price`
+ where parent=%s and price_list_name=%s""", (item, self.doc.name))
+ return [item, rate and rate[0][0] or 0, rate and rate[0][1] or default_currency]
# update prices in Price List
def update_prices(self):
@@ -57,15 +57,15 @@ class DocType:
updated = 0
for line in data:
- if line and len(line)==3:
+ if line and len(line)==3 and line[0]!='Item':
# if item exists
- if sql("select name from tabItem where name=%s", line[0]):
+ if webnotes.conn.sql("select name from tabItem where name=%s", line[0]):
if self.is_currency_valid(line[2]):
# if price exists
- ref_ret_detail = sql("select name from `tabItem Price` where parent=%s and price_list_name=%s and ref_currency=%s", \
+ ref_ret_detail = webnotes.conn.sql("select name from `tabItem Price` where parent=%s and price_list_name=%s and ref_currency=%s", \
(line[0], self.doc.name, line[2]))
if ref_ret_detail:
- sql("update `tabItem Price` set ref_rate=%s where name=%s", (line[1], ref_ret_detail[0][0]))
+ webnotes.conn.sql("update `tabItem Price` set ref_rate=%s where name=%s", (line[1], ref_ret_detail[0][0]))
else:
d = Document('Item Price')
d.parent = line[0]
@@ -80,17 +80,9 @@ class DocType:
msgprint("[Ignored] Unknown currency '%s' for Item '%s'" % (line[2], line[0]))
else:
msgprint("[Ignored] Did not find Item '%s'" % line[1])
- else:
- msgprint("[Ignored] Incorrect format: %s" % str(line))
msgprint("%s items updated" % updated)
- # clear prices
- def clear_prices(self):
- cnt = sql("select count(*) from `tabItem Price` where price_list_name = %s", self.doc.name)
- sql("delete from `tabItem Price` where price_list_name = %s", self.doc.name)
- msgprint("%s prices cleared" % cnt[0][0])
-
# Update CSV data
def get_csv_data(self):
if not self.doc.file_list:
@@ -99,8 +91,12 @@ class DocType:
fid = self.doc.file_list.split(',')[1]
- from webnotes.utils import file_manager
- fn, content = file_manager.get_file(fid)
+ try:
+ from webnotes.utils import file_manager
+ fn, content = file_manager.get_file(fid)
+ except Exception, e:
+ webnotes.msgprint("Unable to open attached file. Please try again.")
+ raise e
# NOTE: Don't know why this condition exists
if not isinstance(content, basestring) and hasattr(content, 'tostring'):
diff --git a/erpnext/setup/doctype/price_list/price_list.txt b/erpnext/setup/doctype/price_list/price_list.txt
index 2881cd7122d..79a7644c674 100644
--- a/erpnext/setup/doctype/price_list/price_list.txt
+++ b/erpnext/setup/doctype/price_list/price_list.txt
@@ -3,9 +3,9 @@
# These values are common in all dictionaries
{
- 'creation': '2012-05-15 12:15:02',
+ 'creation': '2012-07-03 13:30:55',
'docstatus': 0,
- 'modified': '2012-06-22 10:51:23',
+ 'modified': '2012-07-11 17:35:10',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
@@ -14,9 +14,13 @@
{
'_last_update': u'1303100817',
'allow_attach': 1,
+ 'allow_copy': 1,
+ 'allow_email': 1,
+ 'allow_print': 1,
'allow_trash': 1,
'autoname': u'field:price_list_name',
'colour': u'White:FFF',
+ 'description': u'Maintain multiple selling rates for the same **Item** using **Price Lists**. You can upload / edit multiple prices by downloading and uploading the template.',
'doctype': 'DocType',
'document_type': u'Master',
'max_attachments': 1,
@@ -34,7 +38,8 @@
'name': '__common__',
'parent': u'Price List',
'parentfield': u'fields',
- 'parenttype': u'DocType'
+ 'parenttype': u'DocType',
+ 'permlevel': 0
},
# These values are common for all DocPerm
@@ -105,17 +110,6 @@
'write': 1
},
- # DocField
- {
- 'doctype': u'DocField',
- 'fieldname': u'trash_reason',
- 'fieldtype': u'Small Text',
- 'label': u'Trash Reason',
- 'oldfieldname': u'trash_reason',
- 'oldfieldtype': u'Small Text',
- 'permlevel': 1
- },
-
# DocField
{
'doctype': u'DocField',
@@ -124,55 +118,15 @@
'label': u'Price List Name',
'oldfieldname': u'price_list_name',
'oldfieldtype': u'Data',
- 'permlevel': 0,
'reqd': 1
},
- # DocField
- {
- 'colour': u'White:FFF',
- 'depends_on': u'eval:!doc.__islocal',
- 'doctype': u'DocField',
- 'fieldname': u'price_help',
- 'fieldtype': u'HTML',
- 'label': u'Price Help',
- 'permlevel': 0
- },
-
- # DocField
- {
- 'colour': u'White:FFF',
- 'depends_on': u'eval:!doc.__islocal',
- 'description': u'Click on this button to clear prices for this list in all items',
- 'doctype': u'DocField',
- 'fieldname': u'clear_prices',
- 'fieldtype': u'Button',
- 'label': u'Clear Prices',
- 'permlevel': 0,
- 'trigger': u'Client'
- },
-
# DocField
{
'doctype': u'DocField',
'fieldname': u'file_list',
'fieldtype': u'Text',
'hidden': 1,
- 'label': u'File List',
- 'permlevel': 0
- },
-
- # DocField
- {
- 'colour': u'White:FFF',
- 'depends_on': u'eval:!doc.__islocal',
- 'description': u'Update prices from the attachment',
- 'doctype': u'DocField',
- 'fieldname': u'update_prices',
- 'fieldtype': u'Button',
- 'label': u'Update Prices',
- 'options': u'update_prices',
- 'permlevel': 0,
- 'trigger': u'Server'
+ 'label': u'File List'
}
]
\ No newline at end of file
diff --git a/erpnext/setup/doctype/sales_partner/sales_partner.js b/erpnext/setup/doctype/sales_partner/sales_partner.js
index 92c9966fc67..4f2aba2a193 100644
--- a/erpnext/setup/doctype/sales_partner/sales_partner.js
+++ b/erpnext/setup/doctype/sales_partner/sales_partner.js
@@ -95,55 +95,7 @@ cur_frm.cscript.make_contact = function() {
}
-// ******************** ITEM Group ********************************
cur_frm.fields_dict['partner_target_details'].grid.get_field("item_group").get_query = function(doc, dt, dn) {
return 'SELECT `tabItem Group`.`name`,`tabItem Group`.`parent_item_group` FROM `tabItem Group` WHERE `tabItem Group`.is_group="No" AND `tabItem Group`.docstatus != 2 AND `tabItem Group`.%(key)s LIKE "%s" LIMIT 50'
}
-// make sales order list
-cur_frm.cscript.make_so_list = function(parent, doc){
- var lst = new Listing();
- lst.colwidths = ['5%','20%','20%','15%','20%','20%'];
- lst.colnames = ['Sr.','Id','Status','SO Date','Total Commission','Grand Total'];
- lst.coltypes = ['Data','Link','Data','Data','Currency','Currency'];
- lst.coloptions = ['','Sales Order','','','','',''];
-
- cur_frm.cscript.set_list_opts(lst);
-
- var q = repl("select name,status,transaction_date, total_commission,grand_total from `tabSales Order` where sales_partner='%(sp)s'", {'sp':doc.name});
- var q_max = repl("select count(name) from `tabSales Order` where sales_partner='%(cust)s'", {'sp':doc.name});
-
- cur_frm.cscript.run_list(lst,parent,q,q_max,doc,'Sales Order','Sales Order');
-}
-
-// make delivery note list
-cur_frm.cscript.make_dn_list = function(parent,doc){
- var lst = new Listing();
- lst.colwidths = ['5%','20%','20%','15%','20%','20%'];
- lst.colnames = ['Sr.','Id','Status','Date','Total Commission','Grand Total'];
- lst.coltypes = ['Data','Link','Data','Data','Currency','Currency'];
- lst.coloptions = ['','Delivery Note','','','','',''];
-
- cur_frm.cscript.set_list_opts(lst);
-
- var q = repl("select name,status,transaction_date, total_commission,grand_total from `tabDelivery Note` where sales_partner='%(sp)s'", {'sp':doc.name});
- var q_max = repl("select count(name) from `tabDelivery Note` where sales_partner='%(cust)s'", {'sp':doc.name});
-
- cur_frm.cscript.run_list(lst,parent,q,q_max,doc,'Delivery Note','Delivery Note');
-}
-
-// make sales invoice list
-cur_frm.cscript.make_si_list = function(parent,doc){
- var lst = new Listing();
- lst.colwidths = ['5%','25%','20%','25%','25%'];
- lst.colnames = ['Sr.','Id','Invoice Date','Total Commission','Grand Total'];
- lst.coltypes = ['Data','Link','Data','Data','Currency','Currency'];
- lst.coloptions = ['','Sales Invoice','','','',''];
-
- cur_frm.cscript.set_list_opts(lst);
-
- var q = repl("select name,posting_date, total_commission,grand_total from `tabSales Invoice` where sales_partner='%(sp)s'", {'sp':doc.name});
- var q_max = repl("select count(name) from `tabSales Invoice` where sales_partner='%(cust)s'", {'sp':doc.name});
-
- cur_frm.cscript.run_list(lst,parent,q,q_max,doc,'Sales Invoice','Sales Invoice');
-}
diff --git a/erpnext/setup/doctype/sales_partner/sales_partner.txt b/erpnext/setup/doctype/sales_partner/sales_partner.txt
index 0aa2de70436..4e792617aba 100644
--- a/erpnext/setup/doctype/sales_partner/sales_partner.txt
+++ b/erpnext/setup/doctype/sales_partner/sales_partner.txt
@@ -3,9 +3,9 @@
# These values are common in all dictionaries
{
- 'creation': '2012-03-27 14:36:23',
+ 'creation': '2012-07-03 13:30:54',
'docstatus': 0,
- 'modified': '2012-03-27 18:49:33',
+ 'modified': '2012-07-12 11:22:15',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
@@ -17,6 +17,7 @@
'autoname': u'field:partner_name',
'colour': u'White:FFF',
'default_print_format': u'Standard',
+ 'description': u'A **Sales Partner** is a third party distributor / dealer / commission agent / affiliate / reseller who sells the companies products for a commission. This is useful if you make the end sale to the **Customer**, involving your **Sales Partner**.\n\nIf you sell to your **Sales Partner** who in-turn sells it to the **Customer**, then you must make a **Customer** instead.',
'doctype': 'DocType',
'document_type': u'Master',
'in_create': 0,
@@ -26,7 +27,7 @@
'section_style': u'Tabbed',
'server_code_error': u' ',
'show_in_menu': 0,
- 'version': 74
+ 'version': 1
},
# These values are common for all DocField
@@ -54,49 +55,6 @@
'name': u'Sales Partner'
},
- # DocPerm
- {
- 'amend': 0,
- 'cancel': 1,
- 'create': 1,
- 'doctype': u'DocPerm',
- 'permlevel': 0,
- 'role': u'Sales Master Manager',
- 'submit': 0,
- 'write': 1
- },
-
- # DocPerm
- {
- 'amend': 0,
- 'cancel': 0,
- 'create': 0,
- 'doctype': u'DocPerm',
- 'permlevel': 1,
- 'role': u'Sales Master Manager',
- 'submit': 0,
- 'write': 0
- },
-
- # DocPerm
- {
- 'cancel': 1,
- 'create': 1,
- 'doctype': u'DocPerm',
- 'permlevel': 0,
- 'role': u'System Manager',
- 'write': 1
- },
-
- # DocPerm
- {
- 'create': 0,
- 'doctype': u'DocPerm',
- 'permlevel': 1,
- 'role': u'System Manager',
- 'write': 0
- },
-
# DocPerm
{
'amend': 0,
@@ -145,6 +103,49 @@
'write': 0
},
+ # DocPerm
+ {
+ 'amend': 0,
+ 'cancel': 1,
+ 'create': 1,
+ 'doctype': u'DocPerm',
+ 'permlevel': 0,
+ 'role': u'Sales Master Manager',
+ 'submit': 0,
+ 'write': 1
+ },
+
+ # DocPerm
+ {
+ 'amend': 0,
+ 'cancel': 0,
+ 'create': 0,
+ 'doctype': u'DocPerm',
+ 'permlevel': 1,
+ 'role': u'Sales Master Manager',
+ 'submit': 0,
+ 'write': 0
+ },
+
+ # DocPerm
+ {
+ 'cancel': 1,
+ 'create': 1,
+ 'doctype': u'DocPerm',
+ 'permlevel': 0,
+ 'role': u'System Manager',
+ 'write': 1
+ },
+
+ # DocPerm
+ {
+ 'create': 0,
+ 'doctype': u'DocPerm',
+ 'permlevel': 1,
+ 'role': u'System Manager',
+ 'write': 0
+ },
+
# DocField
{
'colour': u'White:FFF',
@@ -152,7 +153,7 @@
'doctype': u'DocField',
'fieldname': u'basic_info',
'fieldtype': u'Section Break',
- 'label': u'Basic Info',
+ 'label': u'Sales Partner Details',
'oldfieldtype': u'Section Break',
'permlevel': 0
},
@@ -282,23 +283,11 @@
'doctype': u'DocField',
'fieldname': u'partner_target_details_section_break',
'fieldtype': u'Section Break',
- 'label': u'Partner Target Details',
+ 'label': u'Sales Partner Target',
'oldfieldtype': u'Section Break',
'permlevel': 0
},
- # DocField
- {
- 'doctype': u'DocField',
- 'fieldname': u'distribution_id',
- 'fieldtype': u'Link',
- 'label': u'Distribution Id',
- 'oldfieldname': u'distribution_id',
- 'oldfieldtype': u'Link',
- 'options': u'Budget Distribution',
- 'permlevel': 0
- },
-
# DocField
{
'doctype': u'DocField',
@@ -312,37 +301,17 @@
'reqd': 0
},
- # DocField
- {
- 'doctype': u'DocField',
- 'fieldname': u'manage_html',
- 'fieldtype': u'HTML',
- 'hidden': 1,
- 'label': u'Manage HTML',
- 'oldfieldtype': u'HTML',
- 'permlevel': 0,
- 'print_hide': 1
- },
-
# DocField
{
'colour': u'White:FFF',
- 'depends_on': u'eval:!doc.__islocal',
+ 'description': u'Select Budget Distribution to unevenly distribute targets across months.',
'doctype': u'DocField',
- 'fieldname': u'transaction_history',
- 'fieldtype': u'Section Break',
- 'label': u'Transaction History',
- 'oldfieldtype': u'Section Break',
- 'permlevel': 0
- },
-
- # DocField
- {
- 'doctype': u'DocField',
- 'fieldname': u'history_html',
- 'fieldtype': u'HTML',
- 'label': u'History HTML',
- 'oldfieldtype': u'HTML',
+ 'fieldname': u'distribution_id',
+ 'fieldtype': u'Link',
+ 'label': u'Target Distribution',
+ 'oldfieldname': u'distribution_id',
+ 'oldfieldtype': u'Link',
+ 'options': u'Budget Distribution',
'permlevel': 0
},
diff --git a/erpnext/setup/doctype/sales_person/sales_person.js b/erpnext/setup/doctype/sales_person/sales_person.js
index 453d88a454f..a1cac8a8bed 100644
--- a/erpnext/setup/doctype/sales_person/sales_person.js
+++ b/erpnext/setup/doctype/sales_person/sales_person.js
@@ -14,30 +14,19 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
+cur_frm.cscript.set_breadcrumbs = function(barea) {
+ cur_frm.frm_head.appframe.add_breadcrumb(cur_frm.docname);
+ cur_frm.frm_head.appframe.add_breadcrumb(' in \
+ Sales Person Tree');
+ cur_frm.frm_head.appframe.add_breadcrumb(' in Selling');
+}
cur_frm.cscript.refresh = function(doc, cdt, cdn) {
}
cur_frm.cscript.onload = function(){
- if(doc.__islocal){
- doc.parent_sales_person = 'Root';
- refresh('parent_sales_person');
- }
-}
-cur_frm.cscript.country = function(doc, cdt, cdn) {
- var mydoc=doc;
- $c('runserverobj', args={'method':'check_state', 'docs':compress_doclist(make_doclist(doc.doctype, doc.name))},
- function(r,rt){
- if(r.message) {
- var doc = locals[mydoc.doctype][mydoc.name];
- doc.state = '';
- get_field(doc.doctype, 'state' , doc.name).options = r.message;
- refresh_field('state');
- }
- }
- );
-}
+}
//get query select sales person
cur_frm.fields_dict['parent_sales_person'].get_query = function(doc,cdt,cdn) {
diff --git a/erpnext/setup/doctype/sales_person/sales_person.py b/erpnext/setup/doctype/sales_person/sales_person.py
index d8c6e43e660..3ab184750ee 100644
--- a/erpnext/setup/doctype/sales_person/sales_person.py
+++ b/erpnext/setup/doctype/sales_person/sales_person.py
@@ -17,79 +17,19 @@
# Please edit this list and import only required elements
import webnotes
-from webnotes.model.doc import Document
from webnotes.model.doclist import getlist
-from webnotes.model.code import get_obj
-from webnotes import session, form, is_testing, msgprint, errprint
-from webnotes.utils import flt, cstr
+from webnotes.utils import flt
-sql = webnotes.conn.sql
-convert_to_lists = webnotes.conn.convert_to_lists
-
-# -----------------------------------------------------------------------------------------
+from webnotes.utils.nestedset import DocTypeNestedSet
-class DocType:
+class DocType(DocTypeNestedSet):
def __init__(self, doc, doclist=[]):
self.doc = doc
self.doclist = doclist
self.nsm_parent_field = 'parent_sales_person';
-
- def check_state(self):
- return "\n" + "\n".join([i[0] for i in sql("select state_name from `tabState` where `tabState`.country='%s' " % self.doc.country)])
-
-
- # update Node Set Model
- def update_nsm_model(self):
- import webnotes
- import webnotes.utils.nestedset
- webnotes.utils.nestedset.update_nsm(self)
-
- # ON UPDATE
- #--------------------------------------
- def on_update(self):
- # update nsm
- self.update_nsm_model()
-
def validate(self):
for d in getlist(self.doclist, 'target_details'):
if not flt(d.target_qty) and not flt(d.target_amount):
- msgprint("Either target qty or target amount is mandatory.")
+ webnotes.msgprint("Either target qty or target amount is mandatory.")
raise Exception
-
- #self.sync_with_contact()
-
- def sync_with_contact(self):
- cid = sql("select name from tabContact where sales_person_id = %s and is_sales_person=1", self.doc.name)
- if cid:
- d = Document('Contact', cid[0][0])
- else:
- d = Document('Contact')
-
- name_split = self.doc.sales_person_name.split()
- d.contact_name = self.doc.sales_person_name
- d.first_name = name_split[0]
- d.last_name = len(name_split) > 1 and name_split[1] or ''
- d.email_id = self.doc.email_id
- d.contact_no = d.mobile_no = self.doc.mobile_no
- d.designation = self.doc.designation
- d.department = self.doc.department
- d.sales_person_id = self.doc.name
- d.is_sales_person = 1
-
- d.save(new = (not d.name))
-
-
- def on_trash(self):
- st = sql("select parent, parenttype from `tabSales Team` where ifnull(sales_person, '') = %s and docstatus != 2", self.doc.name)
- st = [(d[1] + ' : ' + d[0]) for d in st]
- if st:
- msgprint("""Sales Person: %s can not be trashed/deleted because it is used in %s.
- To trash/delete this, remove/change sales person in %s""" % (self.doc.name, st or '', st or ''), raise_exception=1)
-
- if sql("select name from `tabSales Person` where parent_sales_person = %s and docstatus != 2", self.doc.name):
- msgprint("Child sales person exists for this sales person. You can not trash/cancel this sales person.", raise_exception=1)
-
- # rebuild tree
- webnotes.conn.set(self.doc,'old_parent', '')
- self.update_nsm_model()
diff --git a/erpnext/setup/doctype/sales_person/sales_person.txt b/erpnext/setup/doctype/sales_person/sales_person.txt
index 5ff8e9414dc..028d828ceb1 100644
--- a/erpnext/setup/doctype/sales_person/sales_person.txt
+++ b/erpnext/setup/doctype/sales_person/sales_person.txt
@@ -3,9 +3,9 @@
# These values are common in all dictionaries
{
- 'creation': '2012-04-13 11:56:32',
+ 'creation': '2012-07-03 13:30:54',
'docstatus': 0,
- 'modified': '2012-05-31 11:28:32',
+ 'modified': '2012-07-12 10:33:10',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
@@ -16,6 +16,7 @@
'allow_trash': 1,
'autoname': u'field:sales_person_name',
'colour': u'White:FFF',
+ 'description': u'All Sales Transactions can be tagged against multiple **Sales Persons** so that you can set and monitor targets.',
'doctype': 'DocType',
'document_type': u'Master',
'in_create': 1,
@@ -126,17 +127,6 @@
'permlevel': 1
},
- # DocField
- {
- 'doctype': u'DocField',
- 'fieldname': u'general_info',
- 'fieldtype': u'Section Break',
- 'label': u'General Info',
- 'oldfieldtype': u'Section Break',
- 'options': u'Simple',
- 'permlevel': 0
- },
-
# DocField
{
'doctype': u'DocField',
@@ -167,17 +157,6 @@
'trigger': u'Client'
},
- # DocField
- {
- 'doctype': u'DocField',
- 'fieldname': u'sphelp',
- 'fieldtype': u'HTML',
- 'label': u'SPHelp',
- 'oldfieldtype': u'HTML',
- 'options': u'To manage Sales Person, click here',
- 'permlevel': 0
- },
-
# DocField
{
'doctype': u'DocField',
@@ -191,6 +170,14 @@
'reqd': 1
},
+ # DocField
+ {
+ 'doctype': u'DocField',
+ 'fieldname': u'cb0',
+ 'fieldtype': u'Column Break',
+ 'permlevel': 0
+ },
+
# DocField
{
'doctype': u'DocField',
@@ -201,125 +188,6 @@
'permlevel': 0
},
- # DocField
- {
- 'doctype': u'DocField',
- 'fieldname': u'department',
- 'fieldtype': u'Data',
- 'label': u'Department',
- 'oldfieldname': u'department',
- 'oldfieldtype': u'Data',
- 'permlevel': 0
- },
-
- # DocField
- {
- 'doctype': u'DocField',
- 'fieldname': u'designation',
- 'fieldtype': u'Data',
- 'label': u'Designation',
- 'oldfieldname': u'designation',
- 'oldfieldtype': u'Data',
- 'permlevel': 0
- },
-
- # DocField
- {
- 'doctype': u'DocField',
- 'fieldname': u'mobile_no',
- 'fieldtype': u'Data',
- 'label': u'Mobile No',
- 'oldfieldname': u'mobile_no',
- 'oldfieldtype': u'Data',
- 'permlevel': 0
- },
-
- # DocField
- {
- 'doctype': u'DocField',
- 'fieldname': u'column_break0',
- 'fieldtype': u'Column Break',
- 'oldfieldtype': u'Column Break',
- 'permlevel': 0
- },
-
- # DocField
- {
- 'doctype': u'DocField',
- 'fieldname': u'email_id',
- 'fieldtype': u'Data',
- 'label': u'Email Id',
- 'oldfieldname': u'email_id',
- 'oldfieldtype': u'Data',
- 'permlevel': 0
- },
-
- # DocField
- {
- 'doctype': u'DocField',
- 'fieldname': u'country',
- 'fieldtype': u'Select',
- 'in_filter': 1,
- 'label': u'Country',
- 'oldfieldname': u'country',
- 'oldfieldtype': u'Select',
- 'options': u'link:Country',
- 'permlevel': 0,
- 'search_index': 0,
- 'trigger': u'Client'
- },
-
- # DocField
- {
- 'doctype': u'DocField',
- 'fieldname': u'state',
- 'fieldtype': u'Select',
- 'in_filter': 1,
- 'label': u'State',
- 'oldfieldname': u'state',
- 'oldfieldtype': u'Select',
- 'options': u'link:State',
- 'permlevel': 0,
- 'search_index': 0
- },
-
- # DocField
- {
- 'doctype': u'DocField',
- 'fieldname': u'city',
- 'fieldtype': u'Data',
- 'label': u'City',
- 'oldfieldname': u'city',
- 'oldfieldtype': u'Data',
- 'permlevel': 0,
- 'reqd': 0
- },
-
- # DocField
- {
- 'doctype': u'DocField',
- 'fieldname': u'territory',
- 'fieldtype': u'Link',
- 'hidden': 0,
- 'label': u'Territory',
- 'oldfieldname': u'territory',
- 'oldfieldtype': u'Link',
- 'options': u'Territory',
- 'permlevel': 0,
- 'search_index': 0
- },
-
- # DocField
- {
- 'doctype': u'DocField',
- 'fieldname': u'territory_help',
- 'fieldtype': u'HTML',
- 'label': u'Territory Help',
- 'oldfieldtype': u'HTML',
- 'options': u'To manage Territories, click here',
- 'permlevel': 0
- },
-
# DocField
{
'doctype': u'DocField',
@@ -368,25 +236,13 @@
# DocField
{
- 'doctype': u'DocField',
- 'fieldname': u'distribution_id',
- 'fieldtype': u'Link',
- 'label': u'Distribution Id',
- 'oldfieldname': u'distribution_id',
- 'oldfieldtype': u'Link',
- 'options': u'Budget Distribution',
- 'permlevel': 0,
- 'search_index': 0
- },
-
- # DocField
- {
+ 'colour': u'White:FFF',
+ 'description': u'Set targets Item Group-wise for this Sales Person.',
'doctype': u'DocField',
'fieldname': u'target_details_section_break',
'fieldtype': u'Section Break',
- 'label': u'Target Details',
+ 'label': u'Sales Person Targets',
'oldfieldtype': u'Section Break',
- 'options': u'Simple',
'permlevel': 0
},
@@ -400,5 +256,20 @@
'oldfieldtype': u'Table',
'options': u'Target Detail',
'permlevel': 0
+ },
+
+ # DocField
+ {
+ 'colour': u'White:FFF',
+ 'description': u'Select Budget Distribution to unevenly distribute targets across months.',
+ 'doctype': u'DocField',
+ 'fieldname': u'distribution_id',
+ 'fieldtype': u'Link',
+ 'label': u'Target Distribution',
+ 'oldfieldname': u'distribution_id',
+ 'oldfieldtype': u'Link',
+ 'options': u'Budget Distribution',
+ 'permlevel': 0,
+ 'search_index': 0
}
]
\ No newline at end of file
diff --git a/erpnext/setup/doctype/territory/territory.js b/erpnext/setup/doctype/territory/territory.js
index 46312c4e51a..9b36d0c6f05 100644
--- a/erpnext/setup/doctype/territory/territory.js
+++ b/erpnext/setup/doctype/territory/territory.js
@@ -15,17 +15,19 @@
// along with this program. If not, see .
+cur_frm.cscript.set_breadcrumbs = function(barea) {
+ cur_frm.frm_head.appframe.add_breadcrumb(cur_frm.docname);
+ cur_frm.frm_head.appframe.add_breadcrumb(' in \
+ Territory Tree');
+ cur_frm.frm_head.appframe.add_breadcrumb(' in Selling');
+}
cur_frm.cscript.refresh = function(doc, cdt, cdn) {
}
cur_frm.cscript.onload = function(){
-
- if(doc.__islocal){
- doc.parent_territory = 'All Territories';
- refresh('parent_territory');
- }
+
}
diff --git a/erpnext/setup/doctype/territory/territory.py b/erpnext/setup/doctype/territory/territory.py
index 606efa8ef93..fae33ec8dc8 100644
--- a/erpnext/setup/doctype/territory/territory.py
+++ b/erpnext/setup/doctype/territory/territory.py
@@ -8,87 +8,28 @@
#
# 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
+# 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 .
+# along with this program. If not, see .
# Please edit this list and import only required elements
import webnotes
-from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
-from webnotes.model import db_exists
-from webnotes.model.doc import Document, addchild, getchildren, make_autoname
-from webnotes.model.doclist import getlist, copy_doclist
-from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
-from webnotes import session, form, is_testing, msgprint, errprint
+from webnotes.model.doclist import getlist
+from webnotes.utils import flt
-set = webnotes.conn.set
-sql = webnotes.conn.sql
-get_value = webnotes.conn.get_value
-in_transaction = webnotes.conn.in_transaction
-convert_to_lists = webnotes.conn.convert_to_lists
+from webnotes.utils.nestedset import DocTypeNestedSet
-# -----------------------------------------------------------------------------------------
+class DocType(DocTypeNestedSet):
+ def __init__(self, doc, doclist=[]):
+ self.doc = doc
+ self.doclist = doclist
+ self.nsm_parent_field = 'parent_territory'
-
-class DocType:
- def __init__(self, doc, doclist=[]):
- self.doc = doc
- self.doclist = doclist
- self.nsm_parent_field = 'parent_territory'
-
- def check_state(self):
- return "\n" + "\n".join([i[0] for i in sql("select state_name from `tabState` where `tabState`.country='%s' " % self.doc.country)])
-
-
-
- # update Node Set Model
- def update_nsm_model(self):
- import webnotes
- import webnotes.utils.nestedset
- webnotes.utils.nestedset.update_nsm(self)
-
- # ON UPDATE
- #--------------------------------------
- def on_update(self):
-
- # update nsm
- self.update_nsm_model()
-
-
-
- def validate(self):
- if self.doc.lft and self.doc.rgt:
- res = sql("select name from `tabTerritory` where is_group = 'Yes' and docstatus!= 2 and name ='%s' and name !='%s'"%(self.doc.parent_territory,self.doc.territory_name))
- if not res:
- msgprint("Please enter proper parent territory.")
- raise Exception
-
- r = sql("select name from `tabTerritory` where name = '%s' and docstatus = 2"%(self.doc.territory_name))
- if r:
- msgprint("%s record is trashed. To untrash please go to Setup & click on Trash."%(self.doc.territory_name))
- raise Exception
-
- for d in getlist(self.doclist, 'target_details'):
- if not flt(d.target_qty) and not flt(d.target_amount):
- msgprint("Either target qty or target amount is mandatory.")
- raise Exception
-
-
- def on_trash(self):
- cust = sql("select name from `tabCustomer` where ifnull(territory, '') = %s", self.doc.name)
- cust = [d[0] for d in cust]
-
- if cust:
- msgprint("""Territory: %s can not be trashed/deleted because it is used in customer: %s.
- To trash/delete this, remove/change territory in customer master""" % (self.doc.name, cust or ''), raise_exception=1)
-
-
- if sql("select name from `tabTerritory` where parent_territory = %s and docstatus != 2", self.doc.name):
- msgprint("Child territory exists for this territory. You can not trash/cancel/delete this territory.", raise_exception=1)
-
- # rebuild tree
- set(self.doc,'old_parent', '')
- self.update_nsm_model()
+ def validate(self):
+ for d in getlist(self.doclist, 'target_details'):
+ if not flt(d.target_qty) and not flt(d.target_amount):
+ msgprint("Either target qty or target amount is mandatory.")
+ raise Exception
diff --git a/erpnext/setup/doctype/territory/territory.txt b/erpnext/setup/doctype/territory/territory.txt
index 363280128cb..a9cdf058000 100644
--- a/erpnext/setup/doctype/territory/territory.txt
+++ b/erpnext/setup/doctype/territory/territory.txt
@@ -3,9 +3,9 @@
# These values are common in all dictionaries
{
- 'creation': '2012-04-13 11:56:32',
+ 'creation': '2012-07-03 13:30:55',
'docstatus': 0,
- 'modified': '2012-05-31 11:39:33',
+ 'modified': '2012-07-12 10:01:47',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
@@ -17,12 +17,14 @@
'autoname': u'field:territory_name',
'colour': u'White:FFF',
'default_print_format': u'Standard',
+ 'description': u'You can create **Territories** If your organization operates in multiple regions (could be countries, states or cities). Once you group **Customers** by **Territories**, you can set annual targets for each **Item Group** and get reports that will show your actual performance in the territory v/s what you had planned.',
'doctype': 'DocType',
'document_type': u'Master',
'in_create': 1,
'module': u'Setup',
'name': '__common__',
'name_case': u'Title Case',
+ 'read_only': 1,
'search_fields': u'name,parent_territory,territory_manager',
'section_style': u'Simple',
'server_code_error': u' ',
@@ -141,20 +143,6 @@
'reqd': 1
},
- # DocField
- {
- 'doctype': u'DocField',
- 'fieldname': u'territory_manager',
- 'fieldtype': u'Link',
- 'in_filter': 1,
- 'label': u'Territory Manager',
- 'oldfieldname': u'territory_manager',
- 'oldfieldtype': u'Link',
- 'options': u'Sales Person',
- 'permlevel': 0,
- 'search_index': 1
- },
-
# DocField
{
'doctype': u'DocField',
@@ -169,17 +157,6 @@
'trigger': u'Client'
},
- # DocField
- {
- 'doctype': u'DocField',
- 'fieldname': u'territoryhelp',
- 'fieldtype': u'HTML',
- 'label': u'TerritoryHelp',
- 'oldfieldtype': u'HTML',
- 'options': u'To manage Territories, click here',
- 'permlevel': 0
- },
-
# DocField
{
'colour': u'White:FFF',
@@ -195,6 +172,30 @@
'reqd': 1
},
+ # DocField
+ {
+ 'doctype': u'DocField',
+ 'fieldname': u'cb0',
+ 'fieldtype': u'Column Break',
+ 'permlevel': 0
+ },
+
+ # DocField
+ {
+ 'colour': u'White:FFF',
+ 'description': u'For reference',
+ 'doctype': u'DocField',
+ 'fieldname': u'territory_manager',
+ 'fieldtype': u'Link',
+ 'in_filter': 1,
+ 'label': u'Territory Manager',
+ 'oldfieldname': u'territory_manager',
+ 'oldfieldtype': u'Link',
+ 'options': u'Sales Person',
+ 'permlevel': 0,
+ 'search_index': 1
+ },
+
# DocField
{
'doctype': u'DocField',
@@ -247,22 +248,12 @@
# DocField
{
- 'doctype': u'DocField',
- 'fieldname': u'distribution_id',
- 'fieldtype': u'Link',
- 'label': u'Distribution Id',
- 'oldfieldname': u'distribution_id',
- 'oldfieldtype': u'Link',
- 'options': u'Budget Distribution',
- 'permlevel': 0
- },
-
- # DocField
- {
+ 'colour': u'White:FFF',
+ 'description': u'Set Item Group-wise budgets on this Territory. You can also include seasonality by setting the Distribution.',
'doctype': u'DocField',
'fieldname': u'target_details_section_break',
'fieldtype': u'Section Break',
- 'label': u'Target Details',
+ 'label': u'Territory Targets',
'oldfieldtype': u'Section Break',
'permlevel': 0
},
@@ -272,10 +263,24 @@
'doctype': u'DocField',
'fieldname': u'target_details',
'fieldtype': u'Table',
- 'label': u'Target Details1',
+ 'label': u'Target Details',
'oldfieldname': u'target_details',
'oldfieldtype': u'Table',
'options': u'Target Detail',
'permlevel': 0
+ },
+
+ # DocField
+ {
+ 'colour': u'White:FFF',
+ 'description': u'Select Budget Distribution to unevenly distribute targets across months.',
+ 'doctype': u'DocField',
+ 'fieldname': u'distribution_id',
+ 'fieldtype': u'Link',
+ 'label': u'Target Distribution',
+ 'oldfieldname': u'distribution_id',
+ 'oldfieldtype': u'Link',
+ 'options': u'Budget Distribution',
+ 'permlevel': 0
}
]
\ No newline at end of file
diff --git a/erpnext/stock/doctype/item/item.txt b/erpnext/stock/doctype/item/item.txt
index 8a079b815d6..b531e532650 100644
--- a/erpnext/stock/doctype/item/item.txt
+++ b/erpnext/stock/doctype/item/item.txt
@@ -3,9 +3,9 @@
# These values are common in all dictionaries
{
- 'creation': '2012-04-30 18:33:53',
+ 'creation': '2012-07-03 13:30:46',
'docstatus': 0,
- 'modified': '2012-06-07 16:16:24',
+ 'modified': '2012-07-11 09:57:40',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
@@ -196,7 +196,7 @@
# DocField
{
'colour': u'White:FFF',
- 'description': u'Classify your item in any one item group by clicking on the magnifying glass',
+ 'description': u'Manage Item Groups',
'doctype': u'DocField',
'fieldname': u'item_group',
'fieldtype': u'Link',
@@ -209,17 +209,6 @@
'reqd': 1
},
- # DocField
- {
- 'doctype': u'DocField',
- 'fieldname': u'ighelp',
- 'fieldtype': u'HTML',
- 'label': u'IGHelp',
- 'oldfieldtype': u'HTML',
- 'options': u'To manage Item Groups, click here',
- 'permlevel': 0
- },
-
# DocField
{
'doctype': u'DocField',
diff --git a/erpnext/stock/doctype/sales_bom/sales_bom.js b/erpnext/stock/doctype/sales_bom/sales_bom.js
index 275af6a85a9..fe84272b451 100644
--- a/erpnext/stock/doctype/sales_bom/sales_bom.js
+++ b/erpnext/stock/doctype/sales_bom/sales_bom.js
@@ -14,35 +14,20 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
-
-
-cur_frm.cscript.onload = function(doc, cdt, cdn) {
-
- if(!doc.price_list) set_multiple(cdt,cdn,{price_list:sys_defaults.price_list_name});
-}
-
cur_frm.cscript.refresh = function(doc, cdt, cdn) {
+ cur_frm.enable_fields('new_item_code', doc.__islocal);
if(!doc.__islocal) {
- get_field(doc.doctype, 'new_item_code', doc.name).permlevel = 1;
+ cur_frm.add_custom_button("Check for Duplicates", function() {
+ cur_frm.call_server('check_duplicate', 1)
+ }, 'icon-search')
}
}
-/* Get Item Code */
-cur_frm.cscript.item_code = function(doc, dt, dn) {
- var d = locals[dt][dn];
- if (d.item_code){
- get_server_fields('get_item_details', d.item_code, 'sales_bom_items', doc ,dt, dn, 1);
- }
-}
-
-cur_frm.cscript.price_list = function(doc, cdt, cdn) {
- $c_obj(make_doclist(cdt,cdn), 'get_rates', '', function(r,rt){refresh_field('sales_bom_items');});
-}
-
-cur_frm.cscript.currency = function(doc, cdt, cdn) {
- $c_obj(make_doclist(cdt,cdn), 'get_rates', '', function(r,rt){refresh_field('sales_bom_items');});
-}
-
-cur_frm.cscript.find_sales_bom = function(doc, dt, dn) {
- $c_obj(make_doclist(dt,dn), 'check_duplicate', 1, '');
+cur_frm.fields_dict.new_item_code.get_query = function() {
+ return 'select name, description from tabItem where is_stock_item="No" and is_sales_item="Yes"\
+ and name not in (select name from `tabSales BOM`)\
+ and `%(key)s` like "%s"'
}
+cur_frm.fields_dict.new_item_code.query_description = 'Select Item where "Is Stock Item" is "No" \
+ and "Is Sales Item" is "Yes" and there is no other Sales BOM';
+
\ No newline at end of file
diff --git a/erpnext/stock/doctype/sales_bom/sales_bom.py b/erpnext/stock/doctype/sales_bom/sales_bom.py
index 03e1bd04e61..4a9ba2d3f10 100644
--- a/erpnext/stock/doctype/sales_bom/sales_bom.py
+++ b/erpnext/stock/doctype/sales_bom/sales_bom.py
@@ -14,24 +14,9 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-# Please edit this list and import only required elements
import webnotes
-
-from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
-from webnotes.model import db_exists
-from webnotes.model.doc import Document, addchild, getchildren, make_autoname
-from webnotes.model.doclist import getlist, copy_doclist
-from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
-from webnotes import session, form, is_testing, msgprint, errprint
-
-set = webnotes.conn.set
-sql = webnotes.conn.sql
-get_value = webnotes.conn.get_value
-in_transaction = webnotes.conn.in_transaction
-convert_to_lists = webnotes.conn.convert_to_lists
-
-# -----------------------------------------------------------------------------------------
-
+from webnotes.utils import flt
+from webnotes.model.utils import getlist
class DocType:
def __init__(self,d,dl):
@@ -40,138 +25,41 @@ class DocType:
def autoname(self):
self.doc.name = self.doc.new_item_code
- # Get Ref Rates
- # --------------
- def get_rates(self):
- for d in getlist(self.doclist, "sales_bom_items"):
- r = sql("select ref_rate from `tabItem Price` where price_list_name=%s and parent=%s and ref_currency = %s", (self.doc.price_list, d.item_code, self.doc.currency))
- d.rate = r and flt(r[0][0]) or 0.00
-
-
- # Get Item Details
- # -----------------
- def get_item_details(self, name):
- det = sql("select description, stock_uom from `tabItem` where name = '%s' " % cstr(name))
- rate = sql("select ref_rate from `tabItem Price` where price_list_name = %s and parent = %s and ref_currency = %s", (self.doc.price_list, name, self.doc.currency))
- return {'description' : det and det[0][0] or '', 'uom': det and det[0][1] or '', 'rate': rate and flt(rate[0][0]) or 0.00}
-
-
- def get_main_item(self):
- is_main_item = []
- for d in getlist(self.doclist,'sales_bom_items'):
- if d.is_main_item == 'Yes':
- is_main_item.append(d.item_code)
- # Check that Sales Bom Item cannot be child of Sales Bom.
- if d.item_code == self.doc.new_item_code:
- msgprint("Sales Bom Item " + d.new_item_code +" cannot be child item.")
- raise Exception
- if len(is_main_item) > 1:
- msgprint('Main item cannot be more than one.')
- raise Exception , " Validation Error."
- if len(is_main_item) == 0:
- msgprint("At least one item should be main item.")
- raise Exception , " Validation Error."
- return is_main_item[0]
-
-
- # Make Item
- # ---------
- def create_new_item(self):
- i = Document("Item")
- i.item_code = self.doc.new_item_code
- i.item_name = self.doc.new_item_name
- i.name = i.item_code
- i.is_sales_item = 'Yes'
- i.is_stock_item = 'No'
- i.save(1)
-
- # Update Rate
- def update_ref_rate(self, i):
- ref_rate = 0
- if self.doc.price_list:
- if not cstr(self.doc.currency):
- msgprint("Please enter Currency.")
- raise Exception
- for d in getlist(self.doclist, "sales_bom_items"):
- item_rate = sql("select ref_rate,ref_currency from `tabItem Price` where price_list_name=%s and parent=%s", (self.doc.price_list, d.item_code))
- ref_rate += flt(d.qty) * (item_rate and flt(item_rate[0][0]) or 0)
-
- if ref_rate:
- # clear old rates
- sql("delete from `tabItem Price` where parent=%s and price_list_name = %s", (i.name, self.doc.price_list))
-
- pld = addchild(i,"ref_rate_details", "Item Price")
- pld.price_list_name = self.doc.price_list
- pld.ref_rate = flt(ref_rate)
- pld.ref_currency = self.doc.currency
- pld.save()
-
- # Update Items
- # ------------
- def update_item(self):
- i = Document("Item", self.doc.new_item_code)
-
- # update fields
- i.brand = self.doc.new_item_brand
- i.stock_uom = self.doc.stock_uom
- i.item_group = self.doc.item_group
-
-
- i.item_name = self.doc.new_item_name
- i.description = self.doc.description
-
- # set default as 'No' or 0
- i.is_sample_item = 'No'
- i.is_asset_item = 'No'
- i.is_purchase_item = 'No'
- i.is_manufactured_item = 'No'
- i.is_sub_contracted_item = 'No'
- i.is_service_item = 'No'
- i.inspection_required = 'No'
- i.has_serial_no = 'No'
- i.lead_time_days = flt(0)
- # update rates
- self.update_ref_rate(i)
- i.save()
- msgprint("Items: %s updated successfully. To update more details open and edit item master" % self.doc.new_item_code)
-
-
def validate(self):
# check for duplicate
self.check_duplicate()
- item_code = self.get_main_item()
- if not self.doc.new_item_code:
- self.doc.new_item_code = make_autoname(item_code +'.###')
-
-
- def on_update(self):
- # if no item code, create new item code
- if not sql("select name from tabItem where name=%s", self.doc.new_item_code):
- self.create_new_item()
- self.update_item()
+ self.validate_main_item()
+ def validate_main_item(self):
+ """main item must have Is Stock Item as No and Is Sales Item as Yes"""
+ if not webnotes.conn.sql("""select name from tabItem where name=%s and
+ ifnull(is_stock_item,'')='No' and ifnull(is_sales_item,'')='Yes'"""):
+ webnotes.msgprint("""Parent Item %s is either a Stock Item or a not a Sales Item""",
+ raise_exception=1)
def check_duplicate(self, finder=0):
il = getlist(self.doclist, "sales_bom_items")
if not il:
- msgprint("Add atleast one item")
+ webnotes.msgprint("Add atleast one item")
return
# get all Sales BOM that have the first item
- sbl = sql("select distinct parent from `tabSales BOM Item` where item_code=%s and parent != %s and docstatus != 2", (il[0].item_code, self.doc.name))
+ sbl = webnotes.conn.sql("""select distinct parent from `tabSales BOM Item` where item_code=%s
+ and parent != %s and docstatus != 2""", (il[0].item_code, self.doc.name))
# check all siblings
sub_items = [[d.item_code, flt(d.qty)] for d in il]
for s in sbl:
- t = sql("select item_code, qty from `tabSales BOM Item` where parent=%s and docstatus != 2", s[0])
+ t = webnotes.conn.sql("""select item_code, qty from `tabSales BOM Item` where parent=%s and
+ docstatus != 2""", s[0])
t = [[d[0], flt(d[1])] for d in t]
if self.has_same_items(sub_items, t):
- msgprint("%s has the same Sales BOM details" % s[0])
+ webnotes.msgprint("%s has the same Sales BOM details" % s[0])
raise Exception
if finder:
- msgprint("There is no Sales BOM present with the following Combination.")
+ webnotes.msgprint("There is no Sales BOM present with the following Combination.")
def has_same_items(self, l1, l2):
diff --git a/erpnext/stock/doctype/sales_bom/sales_bom.txt b/erpnext/stock/doctype/sales_bom/sales_bom.txt
index 29fcd3142fb..c131d1cc8b0 100644
--- a/erpnext/stock/doctype/sales_bom/sales_bom.txt
+++ b/erpnext/stock/doctype/sales_bom/sales_bom.txt
@@ -3,9 +3,9 @@
# These values are common in all dictionaries
{
- 'creation': '2012-04-30 12:08:49',
+ 'creation': '2012-07-03 13:30:44',
'docstatus': 0,
- 'modified': '2012-05-04 09:53:08',
+ 'modified': '2012-07-11 19:17:51',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
@@ -15,10 +15,10 @@
'_last_update': u'1322549701',
'allow_trash': 1,
'colour': u'White:FFF',
- 'description': u'Aggregate item and accessories to form a Sales Item. There is no inventory of the new item but of the sub-components.',
+ 'description': u'Aggregate group of **Items** into another **Item**. This is useful if you are bundling a certain **Items** into a package and you maintain stock of the packed **Items** and not the packed **Item**. \n\nThe package **Item** will have "Is Stock Item" as "No" and "Is Sales Item" as "Yes".\n\nFor Example: If you are selling Laptops and Backpacks separately and have a special price if the customer buys both, then the Laptop + Backpack will be a new Sales BOM Item.\n\nNote: BOM = Bill of Materials',
'doctype': 'DocType',
'document_type': u'Master',
- 'is_submittable': 1,
+ 'is_submittable': 0,
'module': u'Stock',
'name': '__common__',
'section_style': u'Simple',
@@ -33,17 +33,20 @@
'name': '__common__',
'parent': u'Sales BOM',
'parentfield': u'fields',
- 'parenttype': u'DocType'
+ 'parenttype': u'DocType',
+ 'permlevel': 0
},
# These values are common for all DocPerm
{
+ 'amend': 0,
'doctype': u'DocPerm',
'name': '__common__',
'parent': u'Sales BOM',
'parentfield': u'permissions',
'parenttype': u'DocType',
- 'read': 1
+ 'read': 1,
+ 'submit': 0
},
# DocType, Sales BOM
@@ -54,73 +57,61 @@
# DocPerm
{
- 'amend': 0,
'cancel': 0,
- 'create': 0,
+ 'create': 1,
'doctype': u'DocPerm',
'permlevel': 1,
'role': u'Material Manager',
- 'submit': 0,
- 'write': 0
- },
-
- # DocPerm
- {
- 'amend': 1,
- 'cancel': 1,
- 'create': 1,
- 'doctype': u'DocPerm',
- 'permlevel': 0,
- 'role': u'Material Manager',
- 'submit': 1,
'write': 1
},
# DocPerm
{
- 'amend': 0,
- 'cancel': 0,
- 'create': 0,
- 'doctype': u'DocPerm',
- 'permlevel': 1,
- 'role': u'Material User',
- 'submit': 0,
- 'write': 0
- },
-
- # DocPerm
- {
- 'amend': 0,
- 'cancel': 0,
- 'create': 0,
- 'doctype': u'DocPerm',
- 'permlevel': 0,
- 'role': u'Material User',
- 'submit': 0,
- 'write': 0
- },
-
- # DocPerm
- {
- 'amend': 0,
'cancel': 1,
'create': 1,
'doctype': u'DocPerm',
'permlevel': 0,
- 'role': u'Sales User',
- 'submit': 0,
+ 'role': u'Material Manager',
+ 'write': 1
+ },
+
+ # DocPerm
+ {
+ 'cancel': 0,
+ 'create': 0,
+ 'doctype': u'DocPerm',
+ 'permlevel': 1,
+ 'role': u'Material User',
+ 'write': 0
+ },
+
+ # DocPerm
+ {
+ 'cancel': 0,
+ 'create': 0,
+ 'doctype': u'DocPerm',
+ 'permlevel': 0,
+ 'role': u'Material User',
+ 'write': 0
+ },
+
+ # DocPerm
+ {
+ 'cancel': 1,
+ 'create': 1,
+ 'doctype': u'DocPerm',
+ 'permlevel': 0,
+ 'role': u'Sales User',
'write': 1
},
# DocPerm
{
- 'amend': 0,
'cancel': 0,
'create': 0,
'doctype': u'DocPerm',
'permlevel': 1,
'role': u'Sales User',
- 'submit': 0,
'write': 0
},
@@ -129,167 +120,32 @@
'doctype': u'DocField',
'fieldname': u'basic_section',
'fieldtype': u'Section Break',
- 'label': u'Basic Section',
- 'permlevel': 0
- },
-
- # DocField
- {
- 'doctype': u'DocField',
- 'fieldname': u'col1',
- 'fieldtype': u'Column Break',
- 'permlevel': 0,
- 'width': u'50%'
+ 'label': u'Sales BOM Item'
},
# DocField
{
'colour': u'White:FFF',
- 'description': u'Item code of the new aggregate item.',
+ 'description': u'The Item that represents the Package. This Item must have "Is Stock Item" as "No" and "Is Sales Item" as "Yes"',
'doctype': u'DocField',
'fieldname': u'new_item_code',
- 'fieldtype': u'Data',
- 'label': u'New Item Code',
+ 'fieldtype': u'Link',
+ 'label': u'Parent Item',
'no_copy': 1,
'oldfieldname': u'new_item_code',
'oldfieldtype': u'Data',
+ 'options': u'Item',
'reqd': 1
},
# DocField
{
'colour': u'White:FFF',
- 'doctype': u'DocField',
- 'fieldname': u'new_item_name',
- 'fieldtype': u'Data',
- 'label': u'New Item Name',
- 'oldfieldname': u'new_item_name',
- 'oldfieldtype': u'Data',
- 'permlevel': 0,
- 'reqd': 1
- },
-
- # DocField
- {
- 'doctype': u'DocField',
- 'fieldname': u'new_item_brand',
- 'fieldtype': u'Data',
- 'label': u'New Item Brand',
- 'oldfieldname': u'new_item_brand',
- 'oldfieldtype': u'Data',
- 'permlevel': 0
- },
-
- # DocField
- {
- 'doctype': u'DocField',
- 'fieldname': u'description',
- 'fieldtype': u'Text',
- 'label': u'New Description',
- 'oldfieldname': u'description',
- 'oldfieldtype': u'Text',
- 'permlevel': 0,
- 'reqd': 1,
- 'width': u'300px'
- },
-
- # DocField
- {
- 'doctype': u'DocField',
- 'fieldname': u'col2',
- 'fieldtype': u'Column Break',
- 'permlevel': 0,
- 'width': u'50%'
- },
-
- # DocField
- {
- 'doctype': u'DocField',
- 'fieldname': u'item_group',
- 'fieldtype': u'Link',
- 'label': u'Item Group',
- 'oldfieldname': u'item_group',
- 'oldfieldtype': u'Link',
- 'options': u'Item Group',
- 'permlevel': 0,
- 'reqd': 1
- },
-
- # DocField
- {
- 'doctype': u'DocField',
- 'fieldname': u'stock_uom',
- 'fieldtype': u'Link',
- 'label': u'Stock UOM',
- 'oldfieldname': u'stock_uom',
- 'oldfieldtype': u'Link',
- 'options': u'UOM',
- 'permlevel': 0,
- 'reqd': 1
- },
-
- # DocField
- {
- 'colour': u'White:FFF',
- 'doctype': u'DocField',
- 'fieldname': u'price_list',
- 'fieldtype': u'Select',
- 'label': u'Price List',
- 'oldfieldname': u'price_list',
- 'oldfieldtype': u'Select',
- 'options': u'link:Price List',
- 'permlevel': 0,
- 'trigger': u'Client'
- },
-
- # DocField
- {
- 'colour': u'White:FFF',
- 'doctype': u'DocField',
- 'fieldname': u'currency',
- 'fieldtype': u'Select',
- 'label': u'Currency',
- 'oldfieldname': u'currency',
- 'oldfieldtype': u'Select',
- 'options': u'link:Currency',
- 'permlevel': 0,
- 'trigger': u'Client'
- },
-
- # DocField
- {
- 'depends_on': u'eval:doc.amended_from',
- 'description': u'The date at which current entry is corrected in the system.',
- 'doctype': u'DocField',
- 'fieldname': u'amendment_date',
- 'fieldtype': u'Date',
- 'label': u'Amendment Date',
- 'no_copy': 1,
- 'permlevel': 1,
- 'print_hide': 1
- },
-
- # DocField
- {
- 'doctype': u'DocField',
- 'fieldname': u'amended_from',
- 'fieldtype': u'Link',
- 'label': u'Amended From',
- 'no_copy': 1,
- 'options': u'Sales BOM',
- 'permlevel': 1,
- 'print_hide': 1
- },
-
- # DocField
- {
- 'colour': u'White:FFF',
- 'description': u'List items that form a package. One of the items has to be a "main item".',
+ 'description': u'List items that form the package.',
'doctype': u'DocField',
'fieldname': u'item_section',
'fieldtype': u'Section Break',
- 'label': u'Items',
- 'permlevel': 0
+ 'label': u'Package Items'
},
# DocField
@@ -301,30 +157,6 @@
'oldfieldname': u'sales_bom_items',
'oldfieldtype': u'Table',
'options': u'Sales BOM Item',
- 'permlevel': 0
- },
-
- # DocField
- {
- 'colour': u'White:FFF',
- 'description': u'Add a few items and find if there are any Sales BOM created with the same combination to help you identify duplication.',
- 'doctype': u'DocField',
- 'fieldname': u'find_sales_bom',
- 'fieldtype': u'Button',
- 'label': u'Find Sales BOM',
- 'oldfieldtype': u'Button',
- 'permlevel': 0,
- 'trigger': u'Client'
- },
-
- # DocField
- {
- 'doctype': u'DocField',
- 'fieldname': u'trash_reason',
- 'fieldtype': u'Small Text',
- 'label': u'Trash Reason',
- 'oldfieldname': u'trash_reason',
- 'oldfieldtype': u'Small Text',
- 'permlevel': 1
+ 'reqd': 1
}
]
\ No newline at end of file
diff --git a/erpnext/stock/doctype/sales_bom_item/sales_bom_item.txt b/erpnext/stock/doctype/sales_bom_item/sales_bom_item.txt
index 8cf93f5702d..76e3f26a9fe 100644
--- a/erpnext/stock/doctype/sales_bom_item/sales_bom_item.txt
+++ b/erpnext/stock/doctype/sales_bom_item/sales_bom_item.txt
@@ -3,9 +3,9 @@
# These values are common in all dictionaries
{
- 'creation': '2012-03-27 14:36:37',
+ 'creation': '2012-07-03 13:30:46',
'docstatus': 0,
- 'modified': '2012-03-27 14:36:37',
+ 'modified': '2012-07-11 18:56:27',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
@@ -20,7 +20,7 @@
'section_style': u'Tray',
'server_code_error': u' ',
'show_in_menu': 0,
- 'version': 3
+ 'version': 1
},
# These values are common for all DocField
@@ -38,18 +38,6 @@
'name': u'Sales BOM Item'
},
- # DocField
- {
- 'doctype': u'DocField',
- 'fieldname': u'is_main_item',
- 'fieldtype': u'Select',
- 'label': u'Is Main Item',
- 'oldfieldname': u'is_main_item',
- 'oldfieldtype': u'Select',
- 'options': u'\nYes\nNo',
- 'permlevel': 0
- },
-
# DocField
{
'doctype': u'DocField',
@@ -64,6 +52,18 @@
'trigger': u'Client'
},
+ # DocField
+ {
+ 'doctype': u'DocField',
+ 'fieldname': u'qty',
+ 'fieldtype': u'Currency',
+ 'label': u'Qty',
+ 'oldfieldname': u'qty',
+ 'oldfieldtype': u'Currency',
+ 'permlevel': 0,
+ 'reqd': 1
+ },
+
# DocField
{
'doctype': u'DocField',
@@ -87,18 +87,6 @@
'permlevel': 0
},
- # DocField
- {
- 'doctype': u'DocField',
- 'fieldname': u'qty',
- 'fieldtype': u'Currency',
- 'label': u'Qty',
- 'oldfieldname': u'qty',
- 'oldfieldtype': u'Currency',
- 'permlevel': 0,
- 'reqd': 1
- },
-
# DocField
{
'doctype': u'DocField',
diff --git a/erpnext/stock/doctype/warehouse/warehouse.js b/erpnext/stock/doctype/warehouse/warehouse.js
index b218063b4a2..4ad95f494f3 100644
--- a/erpnext/stock/doctype/warehouse/warehouse.js
+++ b/erpnext/stock/doctype/warehouse/warehouse.js
@@ -14,6 +14,10 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
+cur_frm.cscript.refresh = function(doc) {
+ cur_frm.toggle_fields('warehouse_name', doc.__islocal);
+}
+
cur_frm.cscript.country = function(doc, cdt, cdn) {
var mydoc=doc;
$c('runserverobj', args={'method':'check_state', 'docs':compress_doclist(make_doclist(doc.doctype, doc.name))},
diff --git a/erpnext/stock/doctype/warehouse/warehouse.txt b/erpnext/stock/doctype/warehouse/warehouse.txt
index 16bf59d9d54..844e3f326cb 100644
--- a/erpnext/stock/doctype/warehouse/warehouse.txt
+++ b/erpnext/stock/doctype/warehouse/warehouse.txt
@@ -3,9 +3,9 @@
# These values are common in all dictionaries
{
- 'creation': '2012-05-15 12:15:13',
+ 'creation': '2012-07-03 13:30:45',
'docstatus': 0,
- 'modified': '2012-05-21 18:02:46',
+ 'modified': '2012-07-11 10:18:07',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
@@ -17,6 +17,7 @@
'autoname': u'field:warehouse_name',
'colour': u'White:FFF',
'default_print_format': u'Standard',
+ 'description': u'A logical Warehouse against which stock entries are made.\n\nThere are two main Warehouse Types that are significant in ERPNext.\n\n1. **Stores:** These are where your incoming **Items** are kept before they are consumed or sold. You can have as many \u201cStores\u201d type **Warehouses** as you wish. Stores type warehouses are significant because if you set an Item for automatic re-order, ERPNext will check its quantities in all \u201cStores\u201d type **Warehouses** when deciding whether to re-order or not.\n\n2. **Asset**: **Items** marked as type \u201cFixed Asset\u201d are maintained in Asset Type **Warehouses**. This helps you separate them for the **Items** that are consumed as a part of your regular operations or \u201cCost of Goods Sold\u201d.\n',
'doctype': 'DocType',
'document_type': u'Master',
'module': u'Stock',
@@ -170,17 +171,6 @@
'write': 1
},
- # DocField
- {
- 'doctype': u'DocField',
- 'fieldname': u'trash_reason',
- 'fieldtype': u'Small Text',
- 'label': u'Trash Reason',
- 'oldfieldname': u'trash_reason',
- 'oldfieldtype': u'Small Text',
- 'permlevel': 1
- },
-
# DocField
{
'doctype': u'DocField',
@@ -220,7 +210,6 @@
# DocField
{
'colour': u'White:FFF',
- 'description': u'The valuation of items in this warehouse will be considered for the company that is specified',
'doctype': u'DocField',
'fieldname': u'company',
'fieldtype': u'Link',
@@ -233,6 +222,17 @@
'search_index': 1
},
+ # DocField
+ {
+ 'colour': u'White:FFF',
+ 'description': u'For Reference Only.',
+ 'doctype': u'DocField',
+ 'fieldname': u'warehouse_contact_info',
+ 'fieldtype': u'Section Break',
+ 'label': u'Warehouse Contact Info',
+ 'permlevel': 0
+ },
+
# DocField
{
'doctype': u'DocField',
@@ -246,24 +246,6 @@
'print_hide': 0
},
- # DocField
- {
- 'doctype': u'DocField',
- 'fieldname': u'auto_indent_mail',
- 'fieldtype': u'Select',
- 'hidden': 1,
- 'label': u'Send Reorder Alert Mail ',
- 'no_copy': 1,
- 'oldfieldname': u'auto_indent_mail',
- 'oldfieldtype': u'Select',
- 'options': u'No\nYes',
- 'permlevel': 0,
- 'print_hide': 1,
- 'report_hide': 1,
- 'reqd': 0,
- 'trigger': u'Client'
- },
-
# DocField
{
'doctype': u'DocField',
@@ -357,6 +339,8 @@
# DocField
{
+ 'colour': u'White:FFF',
+ 'description': u'For Admin use only. Please report errors to support@erpnext.com',
'doctype': u'DocField',
'fieldname': u'repost_stock',
'fieldtype': u'Section Break',
diff --git a/erpnext/stock/page/stock_home/stock_home.html b/erpnext/stock/page/stock_home/stock_home.html
index ef941ab66f1..449a6034240 100644
--- a/erpnext/stock/page/stock_home/stock_home.html
+++ b/erpnext/stock/page/stock_home/stock_home.html
@@ -49,6 +49,11 @@
title = "Details packages against a delivery"
href="#!List/Packing Slip">Packing Slip
+