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

This commit is contained in:
Rushabh Mehta 2012-12-06 08:46:18 +01:00
commit 80246da8fb
17 changed files with 1154 additions and 1316 deletions

View File

@ -179,16 +179,16 @@ class DocType:
sql("delete from `tabGL Entry` where account = %s and ifnull(is_cancelled, 'No') = 'Yes'", self.doc.name)
# on rename
def on_rename(self,newdn,olddn):
company_abbr = sql("select tc.abbr from `tabAccount` ta, `tabCompany` tc where ta.company = tc.name and ta.name=%s", olddn)[0][0]
parts = newdn.split(" - ")
def on_rename(self, new, old):
company_abbr = webnotes.conn.get_value("Company", self.doc.company, "abbr")
parts = new.split(" - ")
if parts[-1].lower() != company_abbr.lower():
parts.append(company_abbr)
# rename account name
account_name = " - ".join(parts[:-1])
sql("update `tabAccount` set account_name = '%s' where name = '%s'" % \
(account_name,olddn))
(account_name, old))
return " - ".join(parts)

View File

@ -90,3 +90,17 @@ class DocType(DocTypeNestedSet):
self.validate_mandatory()
self.validate_budget_details()
def on_rename(self, new, old):
company_abbr = webnotes.conn.get_value("Company", self.doc.company_name, "abbr")
parts = new.split(" - ")
if parts[-1].lower() != company_abbr.lower():
parts.append(company_abbr)
# rename account name
cost_center_name = " - ".join(parts[:-1])
webnotes.conn.sql("update `tabCost Center` set cost_center_name = %s where name = %s", \
(cost_center_name, old))
return " - ".join(parts)

View File

@ -1,319 +1,262 @@
# DocType, Cost Center
[
# These values are common in all dictionaries
{
'creation': '2012-07-03 13:30:47',
'docstatus': 0,
'modified': '2012-07-11 14:41:39',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
# These values are common for all DocType
{
'_last_update': u'1317365120',
'allow_copy': 1,
'allow_trash': 1,
'autoname': u'field:cost_center_name',
'colour': u'White:FFF',
'default_print_format': u'Standard',
'description': u'**Chart of Accounts** is mainly for reporting information for governmental purposes and less for how business actually performs. \n\nMost businesses have multiple activities like different product lines, market segments, areas of business that share some common overheads but should ideally have their own structure to report whether they are profitable or not. For this purpose, there is an alternate structure, called the **Cost Centers**.\n\nA tree of **Cost Centers** to cab be designed to reflect the different units of an organization. Each Income / Expense entry is also tagged against a **Cost Center** and hence you can get Profit and Loss against a **Cost Center** too.\n\n### Budgeting\n\n**Cost Centers** can be used for budgeting purposes too. A budget can be set against each **Account** and the system will either stop, warn or ignore the budget based on the settings in the **Company** master.\n\nBudgets can also be distributed seasonally using **Budget Distribution**.',
'doctype': 'DocType',
'document_type': u'Master',
'in_create': 1,
'module': u'Accounts',
'name': '__common__',
'search_fields': u'name,parent_cost_center',
'section_style': u'Simple',
'server_code_error': u' ',
'show_in_menu': 0,
'version': 1
},
# These values are common for all DocField
{
'doctype': u'DocField',
'name': '__common__',
'parent': u'Cost Center',
'parentfield': u'fields',
'parenttype': u'DocType'
},
# These values are common for all DocPerm
{
'doctype': u'DocPerm',
'name': '__common__',
'parent': u'Cost Center',
'parentfield': u'permissions',
'parenttype': u'DocType',
'read': 1
},
# DocType, Cost Center
{
'doctype': 'DocType',
'name': u'Cost Center'
},
# DocPerm
{
'amend': 0,
'cancel': 0,
'create': 0,
'doctype': u'DocPerm',
'permlevel': 1,
'role': u'Accounts Manager',
'submit': 0,
'write': 0
},
# DocPerm
{
'amend': 0,
'cancel': 1,
'create': 1,
'doctype': u'DocPerm',
'permlevel': 0,
'role': u'Accounts Manager',
'submit': 0,
'write': 1
},
# DocPerm
{
'amend': 0,
'cancel': 0,
'create': 0,
'doctype': u'DocPerm',
'permlevel': 1,
'role': u'Accounts User',
'submit': 0,
'write': 0
},
# DocPerm
{
'amend': 0,
'cancel': 0,
'create': 0,
'doctype': u'DocPerm',
'permlevel': 0,
'role': u'Accounts User',
'submit': 0,
'write': 0
},
# DocPerm
{
'cancel': 1,
'create': 1,
'doctype': u'DocPerm',
'permlevel': 0,
'role': u'System Manager',
'write': 1
},
# DocPerm
{
'doctype': u'DocPerm',
'permlevel': 1,
'role': u'All'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'sb0',
'fieldtype': u'Section Break',
'label': u'Cost Center Details',
'permlevel': 0
},
# 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',
'fieldname': u'cost_center_name',
'fieldtype': u'Data',
'in_filter': 0,
'label': u'Cost Center Name',
'no_copy': 1,
'oldfieldname': u'cost_center_name',
'oldfieldtype': u'Data',
'permlevel': 0,
'reqd': 1,
'search_index': 0
},
# DocField
{
'colour': u'White:FFF',
'doctype': u'DocField',
'fieldname': u'parent_cost_center',
'fieldtype': u'Link',
'label': u'Parent Cost Center',
'oldfieldname': u'parent_cost_center',
'oldfieldtype': u'Link',
'options': u'Cost Center',
'permlevel': 0,
'reqd': 1,
'trigger': u'Client'
},
# DocField
{
'colour': u'White:FFF',
'doctype': u'DocField',
'fieldname': u'company_name',
'fieldtype': u'Link',
'label': u'Company',
'oldfieldname': u'company_name',
'oldfieldtype': u'Link',
'options': u'Company',
'permlevel': 0,
'reqd': 1,
'trigger': u'Client'
},
# DocField
{
'colour': u'White:FFF',
'doctype': u'DocField',
'fieldname': u'company_abbr',
'fieldtype': u'Data',
'hidden': 1,
'label': u'Company Abbr',
'oldfieldname': u'company_abbr',
'oldfieldtype': u'Data',
'permlevel': 1
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'cb0',
'fieldtype': u'Column Break',
'permlevel': 0,
'width': u'50%'
},
# DocField
{
'colour': u'White:FFF',
'doctype': u'DocField',
'fieldname': u'group_or_ledger',
'fieldtype': u'Select',
'hidden': 0,
'label': u'Group or Ledger',
'no_copy': 1,
'oldfieldname': u'group_or_ledger',
'oldfieldtype': u'Select',
'options': u'\nGroup\nLedger',
'permlevel': 0,
'print_hide': 1,
'report_hide': 1,
'reqd': 1,
'trigger': u'Client'
},
# DocField
{
'colour': u'White:FFF',
'description': u'Define Budget for this Cost Center. To set budget action, see <a href="#!List/Company">Company Master</a>',
'doctype': u'DocField',
'fieldname': u'sb1',
'fieldtype': u'Section Break',
'label': u'Budget',
'permlevel': 0
},
# DocField
{
'colour': u'White:FFF',
'description': u'Select Budget Distribution, if you want to track based on seasonality.',
'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'Add rows to set annual budgets on Accounts.',
'doctype': u'DocField',
'fieldname': u'budget_details',
'fieldtype': u'Table',
'label': u'Budget Details',
'oldfieldname': u'budget_details',
'oldfieldtype': u'Table',
'options': u'Budget Detail',
'permlevel': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'lft',
'fieldtype': u'Int',
'hidden': 1,
'in_filter': 1,
'label': u'lft',
'no_copy': 1,
'oldfieldname': u'lft',
'oldfieldtype': u'Int',
'permlevel': 0,
'print_hide': 1,
'report_hide': 1,
'search_index': 1
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'rgt',
'fieldtype': u'Int',
'hidden': 1,
'in_filter': 1,
'label': u'rgt',
'no_copy': 1,
'oldfieldname': u'rgt',
'oldfieldtype': u'Int',
'permlevel': 0,
'print_hide': 1,
'report_hide': 1,
'reqd': 0,
'search_index': 1
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'old_parent',
'fieldtype': u'Link',
'hidden': 1,
'label': u'old_parent',
'no_copy': 1,
'oldfieldname': u'old_parent',
'oldfieldtype': u'Data',
'options': u'Cost Center',
'permlevel': 0,
'print_hide': 1,
'report_hide': 1
}
{
"owner": "Administrator",
"docstatus": 0,
"creation": "2012-07-12 23:29:41",
"modified_by": "Administrator",
"modified": "2012-12-06 12:12:46"
},
{
"in_create": 1,
"search_fields": "name,parent_cost_center",
"module": "Accounts",
"document_type": "Master",
"description": "Track separate Income and Expense for product verticals or divisions.",
"autoname": "field:cost_center_name",
"name": "__common__",
"default_print_format": "Standard",
"allow_rename": 1,
"doctype": "DocType",
"allow_copy": 1
},
{
"name": "__common__",
"parent": "Cost Center",
"doctype": "DocField",
"parenttype": "DocType",
"parentfield": "fields"
},
{
"name": "__common__",
"parent": "Cost Center",
"read": 1,
"doctype": "DocPerm",
"parenttype": "DocType",
"parentfield": "permissions"
},
{
"name": "Cost Center",
"doctype": "DocType"
},
{
"doctype": "DocField",
"label": "Cost Center Details",
"fieldname": "sb0",
"fieldtype": "Section Break",
"permlevel": 0
},
{
"oldfieldtype": "Small Text",
"doctype": "DocField",
"label": "Trash Reason",
"oldfieldname": "trash_reason",
"fieldname": "trash_reason",
"fieldtype": "Small Text",
"permlevel": 1
},
{
"no_copy": 1,
"oldfieldtype": "Data",
"doctype": "DocField",
"label": "Cost Center Name",
"oldfieldname": "cost_center_name",
"fieldname": "cost_center_name",
"fieldtype": "Data",
"search_index": 0,
"reqd": 1,
"permlevel": 0,
"in_filter": 0
},
{
"oldfieldtype": "Link",
"colour": "White:FFF",
"doctype": "DocField",
"label": "Parent Cost Center",
"oldfieldname": "parent_cost_center",
"trigger": "Client",
"fieldname": "parent_cost_center",
"fieldtype": "Link",
"reqd": 1,
"options": "Cost Center",
"permlevel": 0
},
{
"oldfieldtype": "Link",
"colour": "White:FFF",
"doctype": "DocField",
"label": "Company",
"oldfieldname": "company_name",
"trigger": "Client",
"fieldname": "company_name",
"fieldtype": "Link",
"reqd": 1,
"options": "Company",
"permlevel": 0
},
{
"oldfieldtype": "Data",
"colour": "White:FFF",
"doctype": "DocField",
"label": "Company Abbr",
"oldfieldname": "company_abbr",
"fieldname": "company_abbr",
"fieldtype": "Data",
"hidden": 1,
"permlevel": 1
},
{
"doctype": "DocField",
"width": "50%",
"fieldname": "cb0",
"fieldtype": "Column Break",
"permlevel": 0
},
{
"print_hide": 1,
"no_copy": 1,
"oldfieldtype": "Select",
"colour": "White:FFF",
"doctype": "DocField",
"label": "Group or Ledger",
"oldfieldname": "group_or_ledger",
"permlevel": 0,
"trigger": "Client",
"fieldname": "group_or_ledger",
"fieldtype": "Select",
"reqd": 1,
"hidden": 0,
"options": "\nGroup\nLedger",
"report_hide": 1
},
{
"description": "Define Budget for this Cost Center. To set budget action, see <a href=\"#!List/Company\">Company Master</a>",
"colour": "White:FFF",
"doctype": "DocField",
"label": "Budget",
"fieldname": "sb1",
"fieldtype": "Section Break",
"permlevel": 0
},
{
"description": "Select Budget Distribution, if you want to track based on seasonality.",
"oldfieldtype": "Link",
"colour": "White:FFF",
"doctype": "DocField",
"label": "Distribution Id",
"oldfieldname": "distribution_id",
"options": "Budget Distribution",
"fieldname": "distribution_id",
"fieldtype": "Link",
"permlevel": 0
},
{
"description": "Add rows to set annual budgets on Accounts.",
"oldfieldtype": "Table",
"colour": "White:FFF",
"doctype": "DocField",
"label": "Budget Details",
"oldfieldname": "budget_details",
"options": "Budget Detail",
"fieldname": "budget_details",
"fieldtype": "Table",
"permlevel": 0
},
{
"print_hide": 1,
"no_copy": 1,
"oldfieldtype": "Int",
"doctype": "DocField",
"label": "lft",
"oldfieldname": "lft",
"fieldname": "lft",
"fieldtype": "Int",
"search_index": 1,
"hidden": 1,
"permlevel": 0,
"report_hide": 1,
"in_filter": 1
},
{
"print_hide": 1,
"no_copy": 1,
"oldfieldtype": "Int",
"doctype": "DocField",
"label": "rgt",
"oldfieldname": "rgt",
"fieldname": "rgt",
"fieldtype": "Int",
"search_index": 1,
"reqd": 0,
"hidden": 1,
"permlevel": 0,
"report_hide": 1,
"in_filter": 1
},
{
"print_hide": 1,
"no_copy": 1,
"oldfieldtype": "Data",
"doctype": "DocField",
"label": "old_parent",
"oldfieldname": "old_parent",
"permlevel": 0,
"fieldname": "old_parent",
"fieldtype": "Link",
"hidden": 1,
"options": "Cost Center",
"report_hide": 1
},
{
"amend": 0,
"create": 0,
"doctype": "DocPerm",
"submit": 0,
"write": 0,
"role": "Accounts Manager",
"cancel": 0,
"permlevel": 1
},
{
"amend": 0,
"create": 1,
"doctype": "DocPerm",
"submit": 0,
"write": 1,
"role": "Accounts Manager",
"cancel": 1,
"permlevel": 0
},
{
"amend": 0,
"create": 0,
"doctype": "DocPerm",
"submit": 0,
"write": 0,
"role": "Accounts User",
"cancel": 0,
"permlevel": 1
},
{
"amend": 0,
"create": 0,
"doctype": "DocPerm",
"submit": 0,
"write": 0,
"role": "Accounts User",
"cancel": 0,
"permlevel": 0
},
{
"create": 1,
"doctype": "DocPerm",
"write": 1,
"role": "System Manager",
"cancel": 1,
"permlevel": 0
},
{
"doctype": "DocPerm",
"role": "All",
"permlevel": 1
}
]

View File

@ -53,12 +53,6 @@ pscript['onload_Accounts Browser'] = function(wrapper){
wrapper.$company_select.val(sys_defaults.company || r[0]).change();
}
});
// refresh on rename
$(document).bind('rename', function(event, dt, old_name, new_name) {
if(erpnext.account_chart.ctype==dt)
wrapper.$company_select.change();
});
}
pscript.set_title = function(wrapper, ctype, val) {
@ -85,9 +79,9 @@ erpnext.AccountsChart = Class.extend({
$(wrapper).find('.tree-area').empty();
var me = this;
me.ctype = ctype;
me.can_create = wn.boot.profile.can_create.indexOf(this.ctype);
me.can_create = wn.model.can_create(this.ctype);
me.can_delete = wn.model.can_delete(this.ctype);
me.can_write = wn.boot.profile.can_write.indexOf(this.ctype);
me.can_write = wn.model.can_write(this.ctype);
me.company = company;
@ -105,13 +99,13 @@ erpnext.AccountsChart = Class.extend({
if(link.toolbar) {
me.cur_toolbar = link.toolbar;
$(me.cur_toolbar).toggle(true);
$(me.cur_toolbar).toggle(true);
}
// bold
$('.balance-bold').removeClass('balance-bold'); // deselect
$(link).parent().find('.balance-area:first').addClass('balance-bold'); // select
},
onrender: function(treenode) {
if (ctype == 'Account') {
@ -135,8 +129,7 @@ erpnext.AccountsChart = Class.extend({
var node_links = [];
// edit
if (wn.boot.profile.can_read.indexOf(this.ctype) !== -1) {
node_links.push('<a href="#Form/'+encodeURIComponent(this.ctype)+'/'
+encodeURIComponent(data.value)+'">Edit</a>');
node_links.push('<a onclick="erpnext.account_chart.open();">Edit</a>');
}
if (data.expandable) {
if(this.can_create) {
@ -146,30 +139,34 @@ erpnext.AccountsChart = Class.extend({
node_links.push('<a onclick="erpnext.account_chart.show_ledger();">View Ledger</a>');
}
if (this.can_write !== -1) {
if (this.can_write) {
node_links.push('<a onclick="erpnext.account_chart.rename()">Rename</a>');
};
if (this.can_delete !== -1) {
if (this.can_delete) {
node_links.push('<a onclick="erpnext.account_chart.delete()">Delete</a>');
};
link.toolbar.append(node_links.join(" | "));
},
open: function() {
var node = this.selected_node();
wn.set_route("Form", this.ctype, node.data("label"));
},
show_ledger: function() {
var me = this;
var node = me.selected_node();
wn.set_route("general-ledger", "account=" + node.data('label'));
},
rename: function() {
var me = this;
var node = me.selected_node();
wn.model.rename_doc("Account", node.data('label'));
var node = this.selected_node();
wn.model.rename_doc(this.ctype, node.data('label'), function(new_name) {
node.data('label', new_name).find(".tree-label").html(new_name);
});
},
delete: function() {
var me = this;
var node = me.selected_node();
wn.model.delete_doc("Account", node.data('label'), function() {
var node = this.selected_node();
wn.model.delete_doc(this.ctype, node.data('label'), function() {
node.parent().remove();
});
},

View File

@ -159,7 +159,7 @@ class DocType(TransactionBase):
self.delete_supplier_communication()
self.delete_supplier_account()
def on_rename(self,newdn,olddn):
def on_rename(self, new, old):
#update supplier_name if not naming series
if get_defaults().get('supp_master_name') == 'Supplier Name':
update_fields = [
@ -171,13 +171,14 @@ class DocType(TransactionBase):
('Purchase Receipt', 'supplier'),
('Serial No', 'supplier')]
for rec in update_fields:
sql("update `tab%s` set supplier_name = '%s' where %s = '%s'" %(rec[0],newdn,rec[1],olddn))
old_account = webnotes.conn.get_value("Account", {"master_type": "Supplier",
"master_name": olddn})
sql("update `tab%s` set supplier_name = %s where `%s` = %s" % \
(rec[0], '%s', rec[1], '%s'), (new, old))
for account in webnotes.conn.sql("""select name, account_name from
tabAccount where master_name=%s and master_type='Supplier'""", old, as_dict=1):
if account.account_name != new:
webnotes.rename_doc("Account", account.name, new)
#update master_name in doctype account
sql("update `tabAccount` set master_name = '%s', master_type = 'Supplier' where master_name = '%s'" %(newdn,olddn))
from webnotes.model.rename_doc import rename_doc
rename_doc("Account", old_account, newdn)
webnotes.conn.sql("""update `tabAccount` set master_name = %s,
master_type = 'Supplier' where master_name = %s""" , (new,old))

View File

@ -1,10 +1,13 @@
erpnext.updates = [
["6th December 2012", [
"Rename: Cost Center, Item Group, Customer Group, Supplier Type, Territory, Sales Person can now be renamed.",
]],
["5th December 2012", [
"Leave Application: Now can set approver.",
"New Roles Added: Leave Approver and Expense Approver.",
"Production Order is now linked with sales order.",
"Production Order: Now linked with Sales Order.",
"Production Planning Tool: The field 'Allow SA items as raw material' has been renamed to 'Use multi-level BOM', 'Include in plan' column from SO table has been deleted",
"Batch nos are now filtered with item and available qty",
"Batch Numbers: Batch nos are now filtered with Item and available qty at time of selection in transactions.",
"BOM: 'Update Costing' button has been deleted, once submitted cost are fixed.",
"[For indian customer only] Deprecated TDS related documents and fields. Old TDS amount added into tax table in Purchase Invoice and entries table in case of JV",
]],

View File

@ -212,7 +212,7 @@ class DocType(TransactionBase):
if self.doc.lead_name:
sql("update `tabLead` set status='Interested' where name=%s",self.doc.lead_name)
def on_rename(self,newdn,olddn):
def on_rename(self, new, old):
#update customer_name if not naming series
if get_defaults().get('cust_master_name') == 'Customer Name':
update_fields = [
@ -235,13 +235,14 @@ class DocType(TransactionBase):
('Support Ticket', 'customer'),
('Task', 'customer')]
for rec in update_fields:
sql("update `tab%s` set customer_name = '%s' where %s = '%s'" %(rec[0],newdn,rec[1],olddn))
old_account = webnotes.conn.get_value("Account", {"master_type": "Customer",
"master_name": olddn})
#update master_name in doctype account
sql("update `tabAccount` set master_name = '%s', master_type = 'Customer' where master_name = '%s'" %(newdn,olddn))
sql("""update `tab%s` set customer_name = %s
where `%s` = %s""" % (rec[0], "%s" ,rec[1], "%s"), (new, old))
from webnotes.model.rename_doc import rename_doc
rename_doc("Account", old_account, newdn)
for account in webnotes.conn.sql("""select name, account_name from
tabAccount where master_name=%s and master_type='Customer'""", old, as_dict=1):
if account.account_name != new:
webnotes.rename_doc("Account", account.name, new)
#update master_name in doctype account
webnotes.conn.sql("""update `tabAccount` set master_name = %s,
master_type = 'Customer' where master_name = %s""", (new,old))

View File

@ -84,9 +84,8 @@ erpnext.SalesChart = Class.extend({
// edit
var node_links = [];
if (wn.boot.profile.can_read.indexOf(this.ctype) !== -1) {
node_links.push('<a href="#!Form/'+encodeURIComponent(this.ctype)+'/'
+encodeURIComponent(data.value)+'">Edit</a>');
if (wn.model.can_read(this.ctype)) {
node_links.push('<a onclick="erpnext.sales_chart.open();">Edit</a>');
}
if(data.expandable) {
@ -95,6 +94,14 @@ erpnext.SalesChart = Class.extend({
node_links.push('<a onclick="erpnext.sales_chart.new_node();">Add Child</a>');
}
}
if (wn.model.can_write(this.ctype)) {
node_links.push('<a onclick="erpnext.sales_chart.rename()">Rename</a>');
};
if (wn.model.can_delete(this.ctype)) {
node_links.push('<a onclick="erpnext.sales_chart.delete()">Delete</a>');
};
link.toolbar.append(node_links.join(" | "));
},
@ -107,11 +114,12 @@ erpnext.SalesChart = Class.extend({
fields: [
{fieldtype:'Data', fieldname: 'name_field', label:'New ' + me.ctype + ' Name', reqd:true},
{fieldtype:'Select', fieldname:'is_group', label:'Group Node',
options:'No\nYes', description:'Entries can made only against non-group (leaf) nodes'},
options:'No\nYes', description: "Further nodes can be only created under 'Group' type nodes"},
{fieldtype:'Button', fieldname:'create_new', label:'Create New' }
]
})
d.set_value("is_group", "No");
// create
$(d.fields_dict.create_new.input).click(function() {
var btn = this;
@ -138,5 +146,22 @@ erpnext.SalesChart = Class.extend({
},
selected_node: function() {
return this.tree.$w.find('.tree-link.selected');
}
},
open: function() {
var node = this.selected_node();
wn.set_route("Form", this.ctype, node.data("label"));
},
rename: function() {
var node = this.selected_node();
wn.model.rename_doc(this.ctype, node.data('label'), function(new_name) {
console.log(new_name)
node.data('label', new_name).find(".tree-label").html(new_name);
});
},
delete: function() {
var node = this.selected_node();
wn.model.delete_doc(this.ctype, node.data('label'), function() {
node.parent().remove();
});
},
});

View File

@ -1,241 +1,194 @@
# DocType, Customer Group
[
# These values are common in all dictionaries
{
'creation': '2012-07-03 13:30:55',
'docstatus': 0,
'modified': '2012-07-12 09:47:20',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
# These values are common for all DocType
{
'_last_update': u'1294214943',
'allow_trash': 1,
'autoname': u'field:customer_group_name',
'colour': u'White:FFF',
'default_print_format': u'Standard',
'doctype': 'DocType',
'document_type': u'Master',
'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' ',
'show_in_menu': 0,
'version': 1
},
# These values are common for all DocField
{
'doctype': u'DocField',
'name': '__common__',
'parent': u'Customer Group',
'parentfield': u'fields',
'parenttype': u'DocType'
},
# These values are common for all DocPerm
{
'amend': 0,
'doctype': u'DocPerm',
'name': '__common__',
'parent': u'Customer Group',
'parentfield': u'permissions',
'parenttype': u'DocType',
'read': 1,
'submit': 0
},
# DocType, Customer Group
{
'doctype': 'DocType',
'name': u'Customer Group'
},
# DocPerm
{
'cancel': 0,
'create': 0,
'doctype': u'DocPerm',
'permlevel': 1,
'role': u'Sales Manager',
'write': 0
},
# DocPerm
{
'cancel': 0,
'create': 0,
'doctype': u'DocPerm',
'permlevel': 0,
'role': u'Sales Manager',
'write': 0
},
# DocPerm
{
'cancel': 0,
'create': 0,
'doctype': u'DocPerm',
'permlevel': 1,
'role': u'Sales Master Manager',
'write': 0
},
# DocPerm
{
'cancel': 0,
'create': 0,
'doctype': u'DocPerm',
'permlevel': 1,
'role': u'Sales User',
'write': 0
},
# DocPerm
{
'cancel': 0,
'create': 0,
'doctype': u'DocPerm',
'permlevel': 0,
'role': u'Sales User',
'write': 0
},
# DocPerm
{
'cancel': 1,
'create': 1,
'doctype': u'DocPerm',
'permlevel': 0,
'role': u'Sales Master Manager',
'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',
'fieldname': u'customer_group_name',
'fieldtype': u'Data',
'label': u'Customer Group Name',
'no_copy': 1,
'oldfieldname': u'customer_group_name',
'oldfieldtype': u'Data',
'permlevel': 0,
'reqd': 1
},
# DocField
{
'colour': u'White:FFF',
'doctype': u'DocField',
'fieldname': u'parent_customer_group',
'fieldtype': u'Link',
'label': u'Parent Customer Group',
'oldfieldname': u'parent_customer_group',
'oldfieldtype': u'Link',
'options': u'Customer Group',
'permlevel': 0,
'reqd': 1,
'trigger': u'Client'
},
# DocField
{
'colour': u'White:FFF',
'description': u'Only leaf nodes are allowed in transaction',
'doctype': u'DocField',
'fieldname': u'is_group',
'fieldtype': u'Select',
'label': u'Has Child Node',
'oldfieldname': u'is_group',
'oldfieldtype': u'Select',
'options': u'\nYes\nNo',
'permlevel': 0,
'reqd': 1
},
# 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',
'label': u'Default Price List',
'options': u'Price List',
'permlevel': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'lft',
'fieldtype': u'Int',
'hidden': 1,
'label': u'lft',
'no_copy': 1,
'oldfieldname': u'lft',
'oldfieldtype': u'Int',
'permlevel': 0,
'print_hide': 1,
'report_hide': 1,
'search_index': 1
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'rgt',
'fieldtype': u'Int',
'hidden': 1,
'label': u'rgt',
'no_copy': 1,
'oldfieldname': u'rgt',
'oldfieldtype': u'Int',
'permlevel': 0,
'print_hide': 1,
'report_hide': 1,
'search_index': 1
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'old_parent',
'fieldtype': u'Link',
'hidden': 1,
'label': u'old_parent',
'no_copy': 1,
'oldfieldname': u'old_parent',
'oldfieldtype': u'Data',
'options': u'Customer Group',
'permlevel': 0,
'print_hide': 1,
'report_hide': 1
}
{
"owner": "Administrator",
"docstatus": 0,
"creation": "2012-07-12 23:29:45",
"modified_by": "Administrator",
"modified": "2012-12-06 10:28:54"
},
{
"in_create": 1,
"search_fields": "name,parent_customer_group",
"module": "Setup",
"document_type": "Master",
"read_only": 1,
"autoname": "field:customer_group_name",
"name": "__common__",
"default_print_format": "Standard",
"allow_rename": 1,
"doctype": "DocType"
},
{
"name": "__common__",
"parent": "Customer Group",
"doctype": "DocField",
"parenttype": "DocType",
"parentfield": "fields"
},
{
"name": "__common__",
"parent": "Customer Group",
"amend": 0,
"submit": 0,
"doctype": "DocPerm",
"read": 1,
"parenttype": "DocType",
"parentfield": "permissions"
},
{
"name": "Customer Group",
"doctype": "DocType"
},
{
"oldfieldtype": "Small Text",
"doctype": "DocField",
"label": "Trash Reason",
"oldfieldname": "trash_reason",
"fieldname": "trash_reason",
"fieldtype": "Small Text",
"permlevel": 1
},
{
"no_copy": 1,
"oldfieldtype": "Data",
"doctype": "DocField",
"label": "Customer Group Name",
"oldfieldname": "customer_group_name",
"fieldname": "customer_group_name",
"fieldtype": "Data",
"reqd": 1,
"permlevel": 0
},
{
"oldfieldtype": "Link",
"colour": "White:FFF",
"doctype": "DocField",
"label": "Parent Customer Group",
"oldfieldname": "parent_customer_group",
"trigger": "Client",
"fieldname": "parent_customer_group",
"fieldtype": "Link",
"reqd": 1,
"options": "Customer Group",
"permlevel": 0
},
{
"description": "Only leaf nodes are allowed in transaction",
"oldfieldtype": "Select",
"colour": "White:FFF",
"doctype": "DocField",
"label": "Has Child Node",
"oldfieldname": "is_group",
"options": "\nYes\nNo",
"fieldname": "is_group",
"fieldtype": "Select",
"reqd": 1,
"permlevel": 0
},
{
"doctype": "DocField",
"fieldname": "cb0",
"fieldtype": "Column Break",
"permlevel": 0
},
{
"description": "This Price List will be selected as default for all Customers under this Group.",
"colour": "White:FFF",
"doctype": "DocField",
"label": "Default Price List",
"options": "Price List",
"fieldname": "default_price_list",
"fieldtype": "Link",
"permlevel": 0
},
{
"print_hide": 1,
"no_copy": 1,
"oldfieldtype": "Int",
"doctype": "DocField",
"label": "lft",
"oldfieldname": "lft",
"fieldname": "lft",
"fieldtype": "Int",
"search_index": 1,
"hidden": 1,
"permlevel": 0,
"report_hide": 1
},
{
"print_hide": 1,
"no_copy": 1,
"oldfieldtype": "Int",
"doctype": "DocField",
"label": "rgt",
"oldfieldname": "rgt",
"fieldname": "rgt",
"fieldtype": "Int",
"search_index": 1,
"hidden": 1,
"permlevel": 0,
"report_hide": 1
},
{
"print_hide": 1,
"no_copy": 1,
"oldfieldtype": "Data",
"doctype": "DocField",
"label": "old_parent",
"oldfieldname": "old_parent",
"permlevel": 0,
"fieldname": "old_parent",
"fieldtype": "Link",
"hidden": 1,
"options": "Customer Group",
"report_hide": 1
},
{
"create": 0,
"doctype": "DocPerm",
"write": 0,
"role": "Sales Manager",
"cancel": 0,
"permlevel": 1
},
{
"create": 0,
"doctype": "DocPerm",
"write": 0,
"role": "Sales Manager",
"cancel": 0,
"permlevel": 0
},
{
"create": 0,
"doctype": "DocPerm",
"write": 0,
"role": "Sales Master Manager",
"cancel": 0,
"permlevel": 1
},
{
"create": 0,
"doctype": "DocPerm",
"write": 0,
"role": "Sales User",
"cancel": 0,
"permlevel": 1
},
{
"create": 0,
"doctype": "DocPerm",
"write": 0,
"role": "Sales User",
"cancel": 0,
"permlevel": 0
},
{
"create": 1,
"doctype": "DocPerm",
"write": 1,
"role": "Sales Master Manager",
"cancel": 1,
"permlevel": 0
}
]

View File

@ -1,275 +1,222 @@
# DocType, Sales Person
[
# These values are common in all dictionaries
{
'creation': '2012-07-03 13:30:54',
'docstatus': 0,
'modified': '2012-07-12 10:33:10',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
# These values are common for all DocType
{
'_last_update': u'1302765705',
'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,
'module': u'Setup',
'name': '__common__',
'search_fields': u'name,parent_sales_person',
'section_style': u'Simple',
'server_code_error': u' ',
'show_in_menu': 0,
'version': 1
},
# These values are common for all DocField
{
'doctype': u'DocField',
'name': '__common__',
'parent': u'Sales Person',
'parentfield': u'fields',
'parenttype': u'DocType'
},
# These values are common for all DocPerm
{
'amend': 0,
'doctype': u'DocPerm',
'name': '__common__',
'parent': u'Sales Person',
'parentfield': u'permissions',
'parenttype': u'DocType',
'read': 1,
'submit': 0
},
# DocType, Sales Person
{
'doctype': 'DocType',
'name': u'Sales Person'
},
# DocPerm
{
'cancel': 0,
'create': 0,
'doctype': u'DocPerm',
'permlevel': 1,
'role': u'Sales Manager',
'write': 0
},
# DocPerm
{
'cancel': 0,
'create': 0,
'doctype': u'DocPerm',
'permlevel': 0,
'role': u'Sales Manager',
'write': 0
},
# DocPerm
{
'cancel': 0,
'create': 0,
'doctype': u'DocPerm',
'permlevel': 1,
'role': u'Sales User',
'write': 0
},
# DocPerm
{
'cancel': 0,
'create': 0,
'doctype': u'DocPerm',
'permlevel': 0,
'role': u'Sales User',
'write': 0
},
# DocPerm
{
'cancel': 1,
'create': 1,
'doctype': u'DocPerm',
'permlevel': 0,
'role': u'Sales Master Manager',
'write': 1
},
# DocPerm
{
'cancel': 0,
'create': 0,
'doctype': u'DocPerm',
'permlevel': 1,
'role': u'Sales Master Manager',
'write': 0
},
# 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',
'fieldname': u'sales_person_name',
'fieldtype': u'Data',
'in_filter': 1,
'label': u'Sales Person Name',
'oldfieldname': u'sales_person_name',
'oldfieldtype': u'Data',
'permlevel': 0,
'reqd': 1,
'search_index': 0
},
# DocField
{
'colour': u'White:FFF',
'description': u'Select company name first.',
'doctype': u'DocField',
'fieldname': u'parent_sales_person',
'fieldtype': u'Link',
'label': u'Parent Sales Person',
'oldfieldname': u'parent_sales_person',
'oldfieldtype': u'Link',
'options': u'Sales Person',
'permlevel': 0,
'reqd': 1,
'trigger': u'Client'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'is_group',
'fieldtype': u'Select',
'label': u'Has Child Node',
'oldfieldname': u'is_group',
'oldfieldtype': u'Select',
'options': u'\nYes\nNo',
'permlevel': 0,
'reqd': 1
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'cb0',
'fieldtype': u'Column Break',
'permlevel': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'employee',
'fieldtype': u'Link',
'label': u'Employee',
'options': u'Employee',
'permlevel': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'lft',
'fieldtype': u'Int',
'hidden': 1,
'in_filter': 1,
'label': u'lft',
'no_copy': 1,
'oldfieldname': u'lft',
'oldfieldtype': u'Int',
'permlevel': 0,
'print_hide': 1,
'search_index': 1
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'rgt',
'fieldtype': u'Int',
'hidden': 1,
'in_filter': 1,
'label': u'rgt',
'no_copy': 1,
'oldfieldname': u'rgt',
'oldfieldtype': u'Int',
'permlevel': 0,
'print_hide': 1,
'search_index': 1
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'old_parent',
'fieldtype': u'Data',
'hidden': 1,
'label': u'old_parent',
'no_copy': 1,
'oldfieldname': u'old_parent',
'oldfieldtype': u'Data',
'permlevel': 0,
'print_hide': 1
},
# 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'Sales Person Targets',
'oldfieldtype': u'Section Break',
'permlevel': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'target_details',
'fieldtype': u'Table',
'label': u'Target Details1',
'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,
'search_index': 0
}
{
"owner": "Administrator",
"docstatus": 0,
"creation": "2012-07-12 23:29:44",
"modified_by": "Administrator",
"modified": "2012-12-06 10:30:15"
},
{
"autoname": "field:sales_person_name",
"in_create": 1,
"name": "__common__",
"allow_rename": 1,
"search_fields": "name,parent_sales_person",
"module": "Setup",
"doctype": "DocType",
"document_type": "Master",
"description": "All Sales Transactions can be tagged against multiple **Sales Persons** so that you can set and monitor targets."
},
{
"name": "__common__",
"parent": "Sales Person",
"doctype": "DocField",
"parenttype": "DocType",
"parentfield": "fields"
},
{
"name": "__common__",
"parent": "Sales Person",
"amend": 0,
"submit": 0,
"doctype": "DocPerm",
"read": 1,
"parenttype": "DocType",
"parentfield": "permissions"
},
{
"name": "Sales Person",
"doctype": "DocType"
},
{
"oldfieldtype": "Small Text",
"doctype": "DocField",
"label": "Trash Reason",
"oldfieldname": "trash_reason",
"fieldname": "trash_reason",
"fieldtype": "Small Text",
"permlevel": 1
},
{
"oldfieldtype": "Data",
"doctype": "DocField",
"label": "Sales Person Name",
"oldfieldname": "sales_person_name",
"fieldname": "sales_person_name",
"fieldtype": "Data",
"search_index": 0,
"reqd": 1,
"permlevel": 0,
"in_filter": 1
},
{
"description": "Select company name first.",
"oldfieldtype": "Link",
"colour": "White:FFF",
"doctype": "DocField",
"label": "Parent Sales Person",
"oldfieldname": "parent_sales_person",
"permlevel": 0,
"trigger": "Client",
"fieldname": "parent_sales_person",
"fieldtype": "Link",
"reqd": 1,
"options": "Sales Person"
},
{
"oldfieldtype": "Select",
"doctype": "DocField",
"label": "Has Child Node",
"oldfieldname": "is_group",
"options": "\nYes\nNo",
"fieldname": "is_group",
"fieldtype": "Select",
"reqd": 1,
"permlevel": 0
},
{
"doctype": "DocField",
"fieldname": "cb0",
"fieldtype": "Column Break",
"permlevel": 0
},
{
"doctype": "DocField",
"label": "Employee",
"options": "Employee",
"fieldname": "employee",
"fieldtype": "Link",
"permlevel": 0
},
{
"print_hide": 1,
"no_copy": 1,
"oldfieldtype": "Int",
"doctype": "DocField",
"label": "lft",
"oldfieldname": "lft",
"fieldname": "lft",
"fieldtype": "Int",
"search_index": 1,
"hidden": 1,
"permlevel": 0,
"in_filter": 1
},
{
"print_hide": 1,
"no_copy": 1,
"oldfieldtype": "Int",
"doctype": "DocField",
"label": "rgt",
"oldfieldname": "rgt",
"fieldname": "rgt",
"fieldtype": "Int",
"search_index": 1,
"hidden": 1,
"permlevel": 0,
"in_filter": 1
},
{
"print_hide": 1,
"no_copy": 1,
"oldfieldtype": "Data",
"doctype": "DocField",
"label": "old_parent",
"oldfieldname": "old_parent",
"fieldname": "old_parent",
"fieldtype": "Data",
"hidden": 1,
"permlevel": 0
},
{
"description": "Set targets Item Group-wise for this Sales Person.",
"oldfieldtype": "Section Break",
"colour": "White:FFF",
"doctype": "DocField",
"label": "Sales Person Targets",
"fieldname": "target_details_section_break",
"fieldtype": "Section Break",
"permlevel": 0
},
{
"oldfieldtype": "Table",
"doctype": "DocField",
"label": "Target Details1",
"oldfieldname": "target_details",
"options": "Target Detail",
"fieldname": "target_details",
"fieldtype": "Table",
"permlevel": 0
},
{
"description": "Select Budget Distribution to unevenly distribute targets across months.",
"oldfieldtype": "Link",
"colour": "White:FFF",
"doctype": "DocField",
"label": "Target Distribution",
"oldfieldname": "distribution_id",
"options": "Budget Distribution",
"fieldname": "distribution_id",
"fieldtype": "Link",
"search_index": 0,
"permlevel": 0
},
{
"create": 0,
"doctype": "DocPerm",
"write": 0,
"role": "Sales Manager",
"cancel": 0,
"permlevel": 1
},
{
"create": 0,
"doctype": "DocPerm",
"write": 0,
"role": "Sales Manager",
"cancel": 0,
"permlevel": 0
},
{
"create": 0,
"doctype": "DocPerm",
"write": 0,
"role": "Sales User",
"cancel": 0,
"permlevel": 1
},
{
"create": 0,
"doctype": "DocPerm",
"write": 0,
"role": "Sales User",
"cancel": 0,
"permlevel": 0
},
{
"create": 1,
"doctype": "DocPerm",
"write": 1,
"role": "Sales Master Manager",
"cancel": 1,
"permlevel": 0
},
{
"create": 0,
"doctype": "DocPerm",
"write": 0,
"role": "Sales Master Manager",
"cancel": 0,
"permlevel": 1
}
]

View File

@ -1,127 +1,97 @@
# DocType, Supplier Type
[
# These values are common in all dictionaries
{
'creation': '2012-03-27 14:36:25',
'docstatus': 0,
'modified': '2012-03-27 14:36:25',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
# These values are common for all DocType
{
'allow_trash': 1,
'autoname': u'field:supplier_type',
'colour': u'White:FFF',
'doctype': 'DocType',
'document_type': u'Master',
'module': u'Setup',
'name': '__common__',
'section_style': u'Simple',
'server_code_error': u' ',
'show_in_menu': 0,
'version': 3
},
# These values are common for all DocField
{
'doctype': u'DocField',
'name': '__common__',
'parent': u'Supplier Type',
'parentfield': u'fields',
'parenttype': u'DocType'
},
# These values are common for all DocPerm
{
'amend': 0,
'doctype': u'DocPerm',
'name': '__common__',
'parent': u'Supplier Type',
'parentfield': u'permissions',
'parenttype': u'DocType',
'read': 1,
'submit': 0
},
# DocType, Supplier Type
{
'doctype': 'DocType',
'name': u'Supplier Type'
},
# DocPerm
{
'cancel': 1,
'create': 1,
'doctype': u'DocPerm',
'permlevel': 0,
'role': u'Purchase Master Manager',
'write': 1
},
# DocPerm
{
'cancel': 0,
'create': 0,
'doctype': u'DocPerm',
'permlevel': 1,
'role': u'Purchase Manager',
'write': 0
},
# DocPerm
{
'cancel': 0,
'create': 0,
'doctype': u'DocPerm',
'permlevel': 0,
'role': u'Purchase Manager',
'write': 0
},
# DocPerm
{
'cancel': 0,
'create': 0,
'doctype': u'DocPerm',
'permlevel': 1,
'role': u'Purchase User',
'write': 0
},
# DocPerm
{
'cancel': 0,
'create': 0,
'doctype': u'DocPerm',
'permlevel': 0,
'role': u'Purchase User',
'write': 0
},
# 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',
'fieldname': u'supplier_type',
'fieldtype': u'Data',
'label': u'Supplier Type',
'oldfieldname': u'supplier_type',
'oldfieldtype': u'Data',
'permlevel': 0,
'reqd': 1
}
{
"owner": "Administrator",
"docstatus": 0,
"creation": "2012-07-03 13:30:53",
"modified_by": "Administrator",
"modified": "2012-12-06 10:29:04"
},
{
"autoname": "field:supplier_type",
"name": "__common__",
"allow_rename": 1,
"doctype": "DocType",
"module": "Setup",
"document_type": "Master"
},
{
"name": "__common__",
"parent": "Supplier Type",
"doctype": "DocField",
"parenttype": "DocType",
"parentfield": "fields"
},
{
"name": "__common__",
"parent": "Supplier Type",
"amend": 0,
"doctype": "DocPerm",
"submit": 0,
"read": 1,
"parenttype": "DocType",
"parentfield": "permissions"
},
{
"name": "Supplier Type",
"doctype": "DocType"
},
{
"oldfieldtype": "Small Text",
"doctype": "DocField",
"label": "Trash Reason",
"oldfieldname": "trash_reason",
"fieldname": "trash_reason",
"fieldtype": "Small Text",
"permlevel": 1
},
{
"oldfieldtype": "Data",
"doctype": "DocField",
"label": "Supplier Type",
"oldfieldname": "supplier_type",
"fieldname": "supplier_type",
"fieldtype": "Data",
"reqd": 1,
"permlevel": 0
},
{
"create": 0,
"doctype": "DocPerm",
"write": 0,
"role": "Purchase Manager",
"cancel": 0,
"permlevel": 1
},
{
"create": 0,
"doctype": "DocPerm",
"write": 0,
"role": "Purchase Manager",
"cancel": 0,
"permlevel": 0
},
{
"create": 0,
"doctype": "DocPerm",
"write": 0,
"role": "Purchase User",
"cancel": 0,
"permlevel": 1
},
{
"create": 0,
"doctype": "DocPerm",
"write": 0,
"role": "Purchase User",
"cancel": 0,
"permlevel": 0
},
{
"create": 1,
"doctype": "DocPerm",
"write": 1,
"role": "Purchase Master Manager",
"cancel": 1,
"permlevel": 0
}
]

View File

@ -1,286 +1,233 @@
# DocType, Territory
[
# These values are common in all dictionaries
{
'creation': '2012-07-03 13:30:55',
'docstatus': 0,
'modified': '2012-07-12 10:01:47',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
# These values are common for all DocType
{
'_last_update': u'1311621379',
'allow_trash': 1,
'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' ',
'show_in_menu': 0,
'version': 1
},
# These values are common for all DocField
{
'doctype': u'DocField',
'name': '__common__',
'parent': u'Territory',
'parentfield': u'fields',
'parenttype': u'DocType'
},
# These values are common for all DocPerm
{
'amend': 0,
'doctype': u'DocPerm',
'name': '__common__',
'parent': u'Territory',
'parentfield': u'permissions',
'parenttype': u'DocType',
'read': 1,
'submit': 0
},
# DocType, Territory
{
'doctype': 'DocType',
'name': u'Territory'
},
# DocPerm
{
'cancel': 0,
'create': 0,
'doctype': u'DocPerm',
'permlevel': 1,
'role': u'Sales Manager',
'write': 0
},
# DocPerm
{
'cancel': 0,
'create': 0,
'doctype': u'DocPerm',
'permlevel': 0,
'role': u'Sales Manager',
'write': 0
},
# DocPerm
{
'cancel': 0,
'create': 0,
'doctype': u'DocPerm',
'permlevel': 1,
'role': u'Sales Master Manager',
'write': 0
},
# DocPerm
{
'cancel': 0,
'create': 0,
'doctype': u'DocPerm',
'permlevel': 1,
'role': u'Sales User',
'write': 0
},
# DocPerm
{
'cancel': 0,
'create': 0,
'doctype': u'DocPerm',
'permlevel': 0,
'role': u'Sales User',
'write': 0
},
# DocPerm
{
'cancel': 1,
'create': 1,
'doctype': u'DocPerm',
'permlevel': 0,
'role': u'Sales Master Manager',
'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',
'fieldname': u'territory_name',
'fieldtype': u'Data',
'label': u'Territory Name',
'no_copy': 1,
'oldfieldname': u'territory_name',
'oldfieldtype': u'Data',
'permlevel': 0,
'reqd': 1
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'parent_territory',
'fieldtype': u'Link',
'label': u'Parent Territory',
'oldfieldname': u'parent_territory',
'oldfieldtype': u'Link',
'options': u'Territory',
'permlevel': 0,
'reqd': 1,
'trigger': u'Client'
},
# DocField
{
'colour': u'White:FFF',
'description': u'Only leaf nodes are allowed in transaction',
'doctype': u'DocField',
'fieldname': u'is_group',
'fieldtype': u'Select',
'label': u'Has Child Node',
'oldfieldname': u'is_group',
'oldfieldtype': u'Select',
'options': u'\nYes\nNo',
'permlevel': 0,
'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',
'fieldname': u'lft',
'fieldtype': u'Int',
'hidden': 1,
'in_filter': 1,
'label': u'lft',
'no_copy': 1,
'oldfieldname': u'lft',
'oldfieldtype': u'Int',
'permlevel': 0,
'print_hide': 1,
'report_hide': 0,
'search_index': 1
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'rgt',
'fieldtype': u'Int',
'hidden': 1,
'in_filter': 1,
'label': u'rgt',
'no_copy': 1,
'oldfieldname': u'rgt',
'oldfieldtype': u'Int',
'permlevel': 0,
'print_hide': 1,
'report_hide': 0,
'search_index': 1
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'old_parent',
'fieldtype': u'Link',
'hidden': 1,
'label': u'old_parent',
'no_copy': 1,
'oldfieldname': u'old_parent',
'oldfieldtype': u'Data',
'options': u'Territory',
'permlevel': 0,
'print_hide': 1,
'report_hide': 1
},
# 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'Territory Targets',
'oldfieldtype': u'Section Break',
'permlevel': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'target_details',
'fieldtype': u'Table',
'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
}
{
"owner": "Administrator",
"docstatus": 0,
"creation": "2012-07-12 23:29:44",
"modified_by": "Administrator",
"modified": "2012-12-06 10:29:39"
},
{
"in_create": 1,
"search_fields": "name,parent_territory,territory_manager",
"module": "Setup",
"document_type": "Master",
"description": "Classification of Customers by region",
"read_only": 1,
"autoname": "field:territory_name",
"name": "__common__",
"default_print_format": "Standard",
"allow_rename": 1,
"doctype": "DocType",
"name_case": "Title Case"
},
{
"name": "__common__",
"parent": "Territory",
"doctype": "DocField",
"parenttype": "DocType",
"parentfield": "fields"
},
{
"name": "__common__",
"parent": "Territory",
"amend": 0,
"submit": 0,
"doctype": "DocPerm",
"read": 1,
"parenttype": "DocType",
"parentfield": "permissions"
},
{
"name": "Territory",
"doctype": "DocType"
},
{
"oldfieldtype": "Small Text",
"doctype": "DocField",
"label": "Trash Reason",
"oldfieldname": "trash_reason",
"fieldname": "trash_reason",
"fieldtype": "Small Text",
"permlevel": 1
},
{
"no_copy": 1,
"oldfieldtype": "Data",
"doctype": "DocField",
"label": "Territory Name",
"oldfieldname": "territory_name",
"fieldname": "territory_name",
"fieldtype": "Data",
"reqd": 1,
"permlevel": 0
},
{
"oldfieldtype": "Link",
"doctype": "DocField",
"label": "Parent Territory",
"oldfieldname": "parent_territory",
"trigger": "Client",
"fieldname": "parent_territory",
"fieldtype": "Link",
"reqd": 1,
"options": "Territory",
"permlevel": 0
},
{
"description": "Only leaf nodes are allowed in transaction",
"oldfieldtype": "Select",
"colour": "White:FFF",
"doctype": "DocField",
"label": "Has Child Node",
"oldfieldname": "is_group",
"options": "\nYes\nNo",
"fieldname": "is_group",
"fieldtype": "Select",
"reqd": 1,
"permlevel": 0
},
{
"doctype": "DocField",
"fieldname": "cb0",
"fieldtype": "Column Break",
"permlevel": 0
},
{
"description": "For reference",
"oldfieldtype": "Link",
"colour": "White:FFF",
"doctype": "DocField",
"label": "Territory Manager",
"oldfieldname": "territory_manager",
"permlevel": 0,
"fieldname": "territory_manager",
"fieldtype": "Link",
"search_index": 1,
"in_filter": 1,
"options": "Sales Person"
},
{
"print_hide": 1,
"no_copy": 1,
"oldfieldtype": "Int",
"doctype": "DocField",
"label": "lft",
"oldfieldname": "lft",
"fieldname": "lft",
"fieldtype": "Int",
"search_index": 1,
"hidden": 1,
"permlevel": 0,
"report_hide": 0,
"in_filter": 1
},
{
"print_hide": 1,
"no_copy": 1,
"oldfieldtype": "Int",
"doctype": "DocField",
"label": "rgt",
"oldfieldname": "rgt",
"fieldname": "rgt",
"fieldtype": "Int",
"search_index": 1,
"hidden": 1,
"permlevel": 0,
"report_hide": 0,
"in_filter": 1
},
{
"print_hide": 1,
"no_copy": 1,
"oldfieldtype": "Data",
"doctype": "DocField",
"label": "old_parent",
"oldfieldname": "old_parent",
"permlevel": 0,
"fieldname": "old_parent",
"fieldtype": "Link",
"hidden": 1,
"options": "Territory",
"report_hide": 1
},
{
"description": "Set Item Group-wise budgets on this Territory. You can also include seasonality by setting the Distribution.",
"oldfieldtype": "Section Break",
"colour": "White:FFF",
"doctype": "DocField",
"label": "Territory Targets",
"fieldname": "target_details_section_break",
"fieldtype": "Section Break",
"permlevel": 0
},
{
"oldfieldtype": "Table",
"doctype": "DocField",
"label": "Target Details",
"oldfieldname": "target_details",
"options": "Target Detail",
"fieldname": "target_details",
"fieldtype": "Table",
"permlevel": 0
},
{
"description": "Select Budget Distribution to unevenly distribute targets across months.",
"oldfieldtype": "Link",
"colour": "White:FFF",
"doctype": "DocField",
"label": "Target Distribution",
"oldfieldname": "distribution_id",
"options": "Budget Distribution",
"fieldname": "distribution_id",
"fieldtype": "Link",
"permlevel": 0
},
{
"create": 0,
"doctype": "DocPerm",
"write": 0,
"cancel": 0,
"role": "Sales Manager",
"permlevel": 1
},
{
"create": 0,
"doctype": "DocPerm",
"write": 0,
"cancel": 0,
"role": "Sales Manager",
"permlevel": 0
},
{
"create": 0,
"doctype": "DocPerm",
"write": 0,
"cancel": 0,
"role": "Sales Master Manager",
"permlevel": 1
},
{
"create": 0,
"doctype": "DocPerm",
"write": 0,
"cancel": 0,
"role": "Sales User",
"permlevel": 1
},
{
"create": 0,
"doctype": "DocPerm",
"write": 0,
"cancel": 0,
"role": "Sales User",
"permlevel": 0
},
{
"create": 1,
"doctype": "DocPerm",
"write": 1,
"cancel": 1,
"role": "Sales Master Manager",
"permlevel": 0
}
]

View File

@ -263,8 +263,6 @@ var set_print_hide= function(doc, cdt, cdn){
} else {
dn_fields['currency'].print_hide = 0;
dn_item_fields['export_rate'].print_hide = 0;
dn_item_fields['adj_rate'].print_hide = 0;
dn_item_fields['ref_rate'].print_hide = 0;
dn_item_fields['export_amount'].print_hide = 0;
}
}

View File

@ -18,6 +18,8 @@ from __future__ import unicode_literals
import webnotes
import webnotes.utils
from webnotes.utils import cstr
from webnotes.model.doc import Document
class DocType():
def __init__(self, d, dl):
@ -46,8 +48,7 @@ class DocType():
}
def send_emails(self):
"""send emails to leads and customers"""
# TODO: create unsubscribed check in customer
"""send emails to leads and customers"""
if self.doc.email_sent:
webnotes.msgprint("""Newsletter has already been sent""", raise_exception=1)
@ -67,6 +68,14 @@ class DocType():
if self.doc.blog_subscribers:
self.send("blog_subscribers", "Lead")
if self.doc.email_list:
email_list = [cstr(email).strip() for email in self.doc.email_list.split(",")]
for email in email_list:
if not webnotes.conn.exists({"doctype": "Lead", "email_id": email}):
create_lead(email)
self.send(email_list, "Lead")
webnotes.conn.set(self.doc, "email_sent", 1)
webnotes.msgprint("""Scheduled to send to %s""" % \
@ -78,9 +87,8 @@ class DocType():
recipients = self.doc.test_email_id.split(",")
from webnotes.utils.email_lib.bulk import send
send(recipients = recipients, sender = sender,
subject = self.doc.subject, message = self.get_message(),
doctype = doctype, email_field = args["email_field"],
first_name_field = args["first_name_field"], last_name_field = "")
subject = self.doc.subject, message = self.doc.message,
doctype = doctype, email_field = args["email_field"])
webnotes.msgprint("""Scheduled to send to %s""" % self.doc.test_email_id)
def get_recipients(self, key):
@ -89,21 +97,47 @@ class DocType():
self.all_recipients += recipients
return recipients
def get_message(self):
if not hasattr(self, "message"):
import markdown2
self.message = markdown2.markdown(self.doc.message)
return self.message
def send(self, query_key, doctype):
webnotes.conn.auto_commit_on_many_writes = True
recipients = self.get_recipients(query_key)
if isinstance(query_key, basestring) and self.query_map.has_key(query_key):
recipients = self.get_recipients(query_key)
else:
recipients = query_key
sender = webnotes.utils.get_email_id(self.doc.owner)
args = self.dt_map[doctype]
self.send_count[doctype] = self.send_count.setdefault(doctype, 0) + len(recipients)
self.send_count[doctype] = self.send_count.setdefault(doctype, 0) + \
len(recipients)
from webnotes.utils.email_lib.bulk import send
send(recipients = recipients, sender = sender,
subject = self.doc.subject, message = self.get_message(),
doctype = doctype, email_field = args["email_field"],
first_name_field = args["first_name_field"], last_name_field = "")
subject = self.doc.subject, message = self.doc.message,
doctype = doctype, email_field = args["email_field"])
lead_naming_series = None
def create_lead(email):
"""create a lead if it does not exist"""
lead = Document("Lead")
lead.fields["__islocal"] = 1
lead.lead_name = email
lead.email_id = email
lead.status = "Open"
lead.naming_series = lead_naming_series or get_lead_naming_series()
lead.company = webnotes.conn.get_default("company")
lead.source = "Email"
lead.save()
def get_lead_naming_series():
"""gets lead's default naming series"""
global lead_naming_series
naming_series_field = webnotes.get_doctype("Lead").get_field("naming_series")
if naming_series_field.default:
lead_naming_series = naming_series_field.default
else:
latest_naming_series = webnotes.conn.sql("""select naming_series
from `tabLead` order by creation desc limit 1""")
if latest_naming_series:
lead_naming_series = latest_naming_series[0][0]
else:
lead_naming_series = filter(None, naming_series_field.options.split("\n"))[0]
return lead_naming_series

View File

@ -2,9 +2,9 @@
{
"owner": "Administrator",
"docstatus": 0,
"creation": "2012-11-28 11:26:23",
"creation": "2012-12-04 11:45:44",
"modified_by": "Administrator",
"modified": "2012-12-03 17:10:41"
"modified": "2012-12-06 13:07:47"
},
{
"autoname": "naming_series:",
@ -106,6 +106,15 @@
"fieldtype": "Check",
"permlevel": 0
},
{
"description": "Comma separated list of email addresses",
"colour": "White:FFF",
"doctype": "DocField",
"label": "Send to this list",
"fieldname": "email_list",
"fieldtype": "Text",
"permlevel": 0
},
{
"doctype": "DocField",
"label": "Newsletter Content",
@ -126,9 +135,8 @@
"colour": "White:FFF",
"doctype": "DocField",
"label": "Message",
"options": "Markdown",
"fieldname": "message",
"fieldtype": "Code",
"fieldtype": "Text Editor",
"reqd": 0,
"permlevel": 0
},

View File

@ -119,8 +119,6 @@ def add_comment(args=None):
send(recipients=list(set(commentors + [blog['owner']])),
doctype='Comment',
email_field='comment_by',
first_name_field="comment_by_fullname",
last_name_field="NA",
subject='New Comment on Blog: ' + blog['title'],
message='%(comment)s<p>By %(comment_by_fullname)s</p>' % args)

View File

@ -44,8 +44,7 @@ class DocType(website.web_page.Page):
# send the blog
send(recipients = recipients, doctype='Lead', email_field='email_id',
first_name_field = 'lead_name', last_name_field="", subject=self.doc.title,
message = markdown(content))
subject=self.doc.title, message = markdown(content))
webnotes.conn.set(self.doc, 'email_sent', 1)
webnotes.msgprint("""Scheduled to send to %s subscribers""" % len(recipients))