Sourced wnframework-modules from Google Code as erpnext

This commit is contained in:
Pratik Vyas
2011-06-08 14:37:15 +05:30
commit c1e6e4c752
1680 changed files with 162635 additions and 0 deletions

View File

@@ -0,0 +1,652 @@
[
{
'_last_update': None,
'creation': '2010-11-30 22:43:08',
'disabled': 'No',
'docstatus': 0,
'doctype': 'Module Def',
'doctype_list': None,
'file_list': None,
'idx': None,
'is_hidden': 'No',
'last_updated_date': '2011-03-21 12:13:39',
'modified': '2010-09-25 00:00:00',
'modified_by': 'Administrator',
'module_desc': None,
'module_icon': 'wired.png',
'module_label': 'Setup',
'module_name': 'Setup',
'module_page': 'Setup',
'module_seq': 1,
'name': 'Setup',
'owner': 'Administrator',
'parent': None,
'parentfield': None,
'parenttype': None,
'trash_reason': None,
'widget_code': None
},
{
'click_function': None,
'creation': '2010-11-30 22:43:08',
'description': 'All important setup items in one place',
'display_name': 'Setup Wizard',
'doc_name': 'Setup Wizard',
'doc_type': 'Pages',
'docstatus': 0,
'doctype': 'Module Def Item',
'fields': None,
'hide': None,
'icon': 'lightbulb.gif',
'idx': 1,
'modified': '2011-03-24 15:04:47',
'modified_by': 'Administrator',
'name': 'MDI00221',
'owner': 'Administrator',
'parent': 'Setup',
'parentfield': 'items',
'parenttype': 'Module Def'
},
{
'click_function': None,
'creation': '2010-11-30 22:43:08',
'description': 'Personalize settings like company banner, date format, print format header etc.',
'display_name': 'Personalize',
'doc_name': 'Personalize Page',
'doc_type': 'Pages',
'docstatus': 0,
'doctype': 'Module Def Item',
'fields': None,
'hide': None,
'icon': 'star.gif',
'idx': 2,
'modified': '2011-03-24 15:04:47',
'modified_by': 'Administrator',
'name': 'MDI00222',
'owner': 'Administrator',
'parent': 'Setup',
'parentfield': 'items',
'parenttype': 'Module Def'
},
{
'click_function': None,
'creation': '2010-11-30 22:43:08',
'description': 'Enable / Disable users. Set user roles.',
'display_name': 'Manage Users',
'doc_name': 'Manage Users',
'doc_type': 'Pages',
'docstatus': 0,
'doctype': 'Module Def Item',
'fields': None,
'hide': None,
'icon': 'group.gif',
'idx': 3,
'modified': '2011-03-24 15:04:47',
'modified_by': 'Administrator',
'name': 'MDI00223',
'owner': 'Administrator',
'parent': 'Setup',
'parentfield': 'items',
'parenttype': 'Module Def'
},
{
'click_function': None,
'creation': '2010-11-30 22:43:08',
'description': 'Set global default values and account settings',
'display_name': 'Setup Defaults',
'doc_name': 'Manage Account',
'doc_type': 'Single DocType',
'docstatus': 0,
'doctype': 'Module Def Item',
'fields': None,
'hide': None,
'icon': 'folder.gif',
'idx': 4,
'modified': '2011-03-24 15:04:47',
'modified_by': 'Administrator',
'name': 'MDI00224',
'owner': 'Administrator',
'parent': 'Setup',
'parentfield': 'items',
'parenttype': 'Module Def'
},
{
'click_function': None,
'creation': '2010-11-30 22:43:08',
'description': 'General Masters',
'display_name': 'Setup Masters',
'doc_name': 'Setup Masters',
'doc_type': 'Pages',
'docstatus': 0,
'doctype': 'Module Def Item',
'fields': None,
'hide': None,
'icon': 'wrench.gif',
'idx': 5,
'modified': '2011-03-24 15:04:47',
'modified_by': 'Administrator',
'name': 'MDI00225',
'owner': 'Administrator',
'parent': 'Setup',
'parentfield': 'items',
'parenttype': 'Module Def'
},
{
'click_function': None,
'creation': '2010-11-30 22:43:08',
'description': None,
'display_name': 'Sales Browser',
'doc_name': 'Sales Browser',
'doc_type': 'Pages',
'docstatus': 0,
'doctype': 'Module Def Item',
'fields': None,
'hide': None,
'icon': None,
'idx': 6,
'modified': '2011-03-24 15:04:47',
'modified_by': 'Administrator',
'name': 'MDI00226',
'owner': 'Administrator',
'parent': 'Setup',
'parentfield': 'items',
'parenttype': 'Module Def'
},
{
'click_function': None,
'creation': '2011-03-24 15:04:47',
'description': None,
'display_name': None,
'doc_name': None,
'doc_type': 'Separator',
'docstatus': 0,
'doctype': 'Module Def Item',
'fields': None,
'hide': None,
'icon': None,
'idx': 7,
'modified': '2011-03-24 15:04:47',
'modified_by': 'Administrator',
'name': '000003107',
'owner': 'Administrator',
'parent': 'Setup',
'parentfield': 'items',
'parenttype': 'Module Def'
},
{
'click_function': None,
'creation': '2010-11-30 22:43:08',
'description': "Import data like Customers, Items etc in 'CSV' format",
'display_name': 'Import Data',
'doc_name': 'Import Data',
'doc_type': 'Pages',
'docstatus': 0,
'doctype': 'Module Def Item',
'fields': None,
'hide': None,
'icon': 'disk.gif',
'idx': 8,
'modified': '2011-03-24 15:04:47',
'modified_by': 'Administrator',
'name': 'MDI00228',
'owner': 'nabin@webnotestech.com',
'parent': 'Setup',
'parentfield': 'items',
'parenttype': 'Module Def'
},
{
'click_function': None,
'creation': '2010-11-30 22:43:08',
'description': 'Set series prefix for transactions',
'display_name': 'Setup Series',
'doc_name': 'Naming Series',
'doc_type': 'Single DocType',
'docstatus': 0,
'doctype': 'Module Def Item',
'fields': None,
'hide': None,
'icon': 'paperclip.gif',
'idx': 9,
'modified': '2011-03-24 15:04:47',
'modified_by': 'Administrator',
'name': 'MDI00229',
'owner': 'Administrator',
'parent': 'Setup',
'parentfield': 'items',
'parenttype': 'Module Def'
},
{
'click_function': None,
'creation': '2010-11-30 22:43:08',
'description': 'Set approval rights for transactions based on grand total and discount.',
'display_name': 'Authorization Rule',
'doc_name': 'Authorization Rule',
'doc_type': 'Forms',
'docstatus': 0,
'doctype': 'Module Def Item',
'fields': 'transaction\nbased_on\nmaster_name\nsystem_user\nsystem_role\napproving_role\napproving_user\nvalue',
'hide': None,
'icon': 'accept.gif',
'idx': 10,
'modified': '2011-03-24 15:04:47',
'modified_by': 'Administrator',
'name': 'MDI00230',
'owner': 'saumil@webnotestech.com',
'parent': 'Setup',
'parentfield': 'items',
'parenttype': 'Module Def'
},
{
'click_function': None,
'creation': '2010-11-30 22:43:08',
'description': 'Add fields in transactions, masters...',
'display_name': 'Custom Field',
'doc_name': 'Custom Field',
'doc_type': 'Forms',
'docstatus': 0,
'doctype': 'Module Def Item',
'fields': 'dt\nlabel\nfieldtype\noptions',
'hide': None,
'icon': 'paperclip.gif',
'idx': 11,
'modified': '2011-03-24 15:04:47',
'modified_by': 'Administrator',
'name': 'MDI00231',
'owner': 'saumil@webnotestech.com',
'parent': 'Setup',
'parentfield': 'items',
'parenttype': 'Module Def'
},
{
'click_function': None,
'creation': '2010-11-30 22:43:08',
'description': 'Contains records that you have trashed.',
'display_name': 'Trash',
'doc_name': 'Trash',
'doc_type': 'Pages',
'docstatus': 0,
'doctype': 'Module Def Item',
'fields': None,
'hide': None,
'icon': None,
'idx': 12,
'modified': '2011-03-24 15:04:47',
'modified_by': 'Administrator',
'name': 'MDI00232',
'owner': 'saumil@webnotestech.com',
'parent': 'Setup',
'parentfield': 'items',
'parenttype': 'Module Def'
},
{
'click_function': None,
'creation': '2011-03-24 15:04:47',
'description': None,
'display_name': 'Price List',
'doc_name': 'Price List',
'doc_type': 'Setup Forms',
'docstatus': 0,
'doctype': 'Module Def Item',
'fields': None,
'hide': None,
'icon': None,
'idx': 13,
'modified': '2011-03-24 15:04:47',
'modified_by': 'Administrator',
'name': '000003108',
'owner': 'Administrator',
'parent': 'Setup',
'parentfield': 'items',
'parenttype': 'Module Def'
},
{
'click_function': None,
'creation': '2011-03-24 15:04:47',
'description': None,
'display_name': 'Warehouse Type',
'doc_name': 'Warehouse Type',
'doc_type': 'Setup Forms',
'docstatus': 0,
'doctype': 'Module Def Item',
'fields': None,
'hide': None,
'icon': None,
'idx': 14,
'modified': '2011-03-24 15:04:47',
'modified_by': 'Administrator',
'name': '000003109',
'owner': 'Administrator',
'parent': 'Setup',
'parentfield': 'items',
'parenttype': 'Module Def'
},
{
'click_function': None,
'creation': '2011-03-24 15:04:47',
'description': None,
'display_name': 'Warehouse',
'doc_name': 'Warehouse',
'doc_type': 'Setup Forms',
'docstatus': 0,
'doctype': 'Module Def Item',
'fields': None,
'hide': None,
'icon': None,
'idx': 15,
'modified': '2011-03-24 15:04:47',
'modified_by': 'Administrator',
'name': '000003110',
'owner': 'Administrator',
'parent': 'Setup',
'parentfield': 'items',
'parenttype': 'Module Def'
},
{
'click_function': None,
'creation': '2011-03-24 15:04:47',
'description': None,
'display_name': 'UOM',
'doc_name': 'UOM',
'doc_type': 'Setup Forms',
'docstatus': 0,
'doctype': 'Module Def Item',
'fields': None,
'hide': None,
'icon': None,
'idx': 16,
'modified': '2011-03-24 15:04:47',
'modified_by': 'Administrator',
'name': '000003111',
'owner': 'Administrator',
'parent': 'Setup',
'parentfield': 'items',
'parenttype': 'Module Def'
},
{
'click_function': None,
'creation': '2011-03-24 15:04:47',
'description': None,
'display_name': 'Term',
'doc_name': 'Term',
'doc_type': 'Setup Forms',
'docstatus': 0,
'doctype': 'Module Def Item',
'fields': None,
'hide': None,
'icon': None,
'idx': 17,
'modified': '2011-03-24 15:04:47',
'modified_by': 'Administrator',
'name': '000003112',
'owner': 'Administrator',
'parent': 'Setup',
'parentfield': 'items',
'parenttype': 'Module Def'
},
{
'click_function': None,
'creation': '2011-03-24 15:04:47',
'description': None,
'display_name': 'Taxes and Charges',
'doc_name': 'Other Charges',
'doc_type': 'Setup Forms',
'docstatus': 0,
'doctype': 'Module Def Item',
'fields': None,
'hide': None,
'icon': None,
'idx': 18,
'modified': '2011-03-24 15:04:47',
'modified_by': 'Administrator',
'name': '000003113',
'owner': 'Administrator',
'parent': 'Setup',
'parentfield': 'items',
'parenttype': 'Module Def'
},
{
'click_function': None,
'creation': '2011-03-24 15:04:47',
'description': None,
'display_name': 'Business Letter Type',
'doc_name': 'Business Letter Type',
'doc_type': 'Setup Forms',
'docstatus': 0,
'doctype': 'Module Def Item',
'fields': None,
'hide': None,
'icon': None,
'idx': 19,
'modified': '2011-03-24 15:04:47',
'modified_by': 'Administrator',
'name': '000003114',
'owner': 'Administrator',
'parent': 'Setup',
'parentfield': 'items',
'parenttype': 'Module Def'
},
{
'click_function': None,
'creation': '2011-03-24 15:04:47',
'description': None,
'display_name': 'Business Letter Template',
'doc_name': 'Business Letter Template',
'doc_type': 'Setup Forms',
'docstatus': 0,
'doctype': 'Module Def Item',
'fields': None,
'hide': None,
'icon': None,
'idx': 20,
'modified': '2011-03-24 15:04:47',
'modified_by': 'Administrator',
'name': '000003115',
'owner': 'Administrator',
'parent': 'Setup',
'parentfield': 'items',
'parenttype': 'Module Def'
},
{
'click_function': None,
'creation': '2011-03-24 15:04:47',
'description': None,
'display_name': 'Mode of Payment',
'doc_name': 'Mode of Payment',
'doc_type': 'Setup Forms',
'docstatus': 0,
'doctype': 'Module Def Item',
'fields': None,
'hide': None,
'icon': None,
'idx': 21,
'modified': '2011-03-24 15:04:47',
'modified_by': 'Administrator',
'name': '000003116',
'owner': 'harshada@webnotestech.com',
'parent': 'Setup',
'parentfield': 'items',
'parenttype': 'Module Def'
},
{
'creation': '2010-11-30 22:43:08',
'docstatus': 0,
'doctype': 'Module Def Role',
'idx': 1,
'modified': '2010-11-30 22:43:08',
'modified_by': 'Administrator',
'name': 'MDR00042',
'owner': 'Administrator',
'parent': 'Setup',
'parentfield': 'roles',
'parenttype': 'Module Def',
'role': 'Administrator'
},
{
'creation': '2010-11-30 22:43:08',
'docstatus': 0,
'doctype': 'Module Def Role',
'idx': 2,
'modified': '2010-11-30 22:43:08',
'modified_by': 'Administrator',
'name': 'MDR00043',
'owner': 'Administrator',
'parent': 'Setup',
'parentfield': 'roles',
'parenttype': 'Module Def',
'role': 'System Manager'
},
{
'creation': '2010-11-30 22:43:08',
'docstatus': 0,
'doctype': 'Module Def Role',
'idx': 3,
'modified': '2010-11-30 22:43:08',
'modified_by': 'Administrator',
'name': 'MDR00044',
'owner': 'saumil@webnotestech.com',
'parent': 'Setup',
'parentfield': 'roles',
'parenttype': 'Module Def',
'role': 'Sales User'
},
{
'creation': '2010-11-30 22:43:08',
'docstatus': 0,
'doctype': 'Module Def Role',
'idx': 4,
'modified': '2010-11-30 22:43:08',
'modified_by': 'Administrator',
'name': 'MDR00045',
'owner': 'saumil@webnotestech.com',
'parent': 'Setup',
'parentfield': 'roles',
'parenttype': 'Module Def',
'role': 'Sales Master Manager'
},
{
'creation': '2010-11-30 22:43:08',
'docstatus': 0,
'doctype': 'Module Def Role',
'idx': 5,
'modified': '2010-11-30 22:43:08',
'modified_by': 'Administrator',
'name': 'MDR00046',
'owner': 'saumil@webnotestech.com',
'parent': 'Setup',
'parentfield': 'roles',
'parenttype': 'Module Def',
'role': 'Sales Master Manager'
},
{
'creation': '2010-11-30 22:43:08',
'docstatus': 0,
'doctype': 'Module Def Role',
'idx': 6,
'modified': '2010-11-30 22:43:08',
'modified_by': 'Administrator',
'name': 'MDR00047',
'owner': 'saumil@webnotestech.com',
'parent': 'Setup',
'parentfield': 'roles',
'parenttype': 'Module Def',
'role': 'Purchase User'
},
{
'creation': '2010-11-30 22:43:08',
'docstatus': 0,
'doctype': 'Module Def Role',
'idx': 7,
'modified': '2010-11-30 22:43:08',
'modified_by': 'Administrator',
'name': 'MDR00048',
'owner': 'saumil@webnotestech.com',
'parent': 'Setup',
'parentfield': 'roles',
'parenttype': 'Module Def',
'role': 'Purchase Master Manager'
},
{
'creation': '2010-11-30 22:43:08',
'docstatus': 0,
'doctype': 'Module Def Role',
'idx': 8,
'modified': '2010-11-30 22:43:08',
'modified_by': 'Administrator',
'name': 'MDR00049',
'owner': 'saumil@webnotestech.com',
'parent': 'Setup',
'parentfield': 'roles',
'parenttype': 'Module Def',
'role': 'Purchase Manager'
},
{
'creation': '2010-11-30 22:43:08',
'docstatus': 0,
'doctype': 'Module Def Role',
'idx': 9,
'modified': '2010-11-30 22:43:08',
'modified_by': 'Administrator',
'name': 'MDR00050',
'owner': 'saumil@webnotestech.com',
'parent': 'Setup',
'parentfield': 'roles',
'parenttype': 'Module Def',
'role': 'Material User'
},
{
'creation': '2010-11-30 22:43:08',
'docstatus': 0,
'doctype': 'Module Def Role',
'idx': 10,
'modified': '2010-11-30 22:43:08',
'modified_by': 'Administrator',
'name': 'MDR00051',
'owner': 'saumil@webnotestech.com',
'parent': 'Setup',
'parentfield': 'roles',
'parenttype': 'Module Def',
'role': 'Material Master Manager'
},
{
'creation': '2010-11-30 22:43:08',
'docstatus': 0,
'doctype': 'Module Def Role',
'idx': 11,
'modified': '2010-11-30 22:43:08',
'modified_by': 'Administrator',
'name': 'MDR00052',
'owner': 'saumil@webnotestech.com',
'parent': 'Setup',
'parentfield': 'roles',
'parenttype': 'Module Def',
'role': 'Material Manager'
},
{
'creation': '2010-11-30 22:43:08',
'docstatus': 0,
'doctype': 'Module Def Role',
'idx': 12,
'modified': '2010-11-30 22:43:08',
'modified_by': 'Administrator',
'name': 'MDR00053',
'owner': 'saumil@webnotestech.com',
'parent': 'Setup',
'parentfield': 'roles',
'parenttype': 'Module Def',
'role': 'Accounts User'
},
{
'creation': '2010-11-30 22:43:08',
'docstatus': 0,
'doctype': 'Module Def Role',
'idx': 13,
'modified': '2010-11-30 22:43:08',
'modified_by': 'Administrator',
'name': 'MDR00054',
'owner': 'saumil@webnotestech.com',
'parent': 'Setup',
'parentfield': 'roles',
'parenttype': 'Module Def',
'role': 'Accounts Manager'
}
]

0
setup/__init__.py Normal file
View File

View File

View File

View File

@@ -0,0 +1,10 @@
$import(Tips Common)
//--------- ONLOAD -------------
cur_frm.cscript.onload = function(doc, cdt, cdn) {
cur_frm.cscript.get_tips(doc, cdt, cdn);
}
cur_frm.cscript.refresh = function(doc, cdt, cdn) {
cur_frm.cscript.get_tips(doc, cdt, cdn);
}

File diff suppressed because one or more lines are too long

View File

View File

@@ -0,0 +1,17 @@
cur_frm.cscript.refresh = function(doc, cdt, cdn) {
if(doc.abbr && !doc.__islocal) set_field_permlevel('abbr',1);
}
cur_frm.fields_dict.default_bank_account.get_query = function(doc) {
return 'SELECT `tabAccount`.name, `tabAccount`.debit_or_credit, `tabAccount`.group_or_ledger FROM `tabAccount` WHERE `tabAccount`.company = "'+doc.name+'" AND `tabAccount`.group_or_ledger = "Ledger" AND `tabAccount`.docstatus != 2 AND `tabAccount`.account_type = "Bank or Cash" AND `tabAccount`.%(key)s LIKE "%s" ORDER BY `tabAccount`.name LIMIT 50';
}
cur_frm.fields_dict.receivables_group.get_query = function(doc) {
return 'SELECT `tabAccount`.name FROM `tabAccount` WHERE `tabAccount`.company = "'+doc.name+'" AND `tabAccount`.group_or_ledger = "Group" AND `tabAccount`.docstatus != 2 AND `tabAccount`.%(key)s LIKE "%s" ORDER BY `tabAccount`.name LIMIT 50';
}
cur_frm.fields_dict.payables_group.get_query = function(doc) {
return 'SELECT `tabAccount`.name FROM `tabAccount` WHERE `tabAccount`.company = "'+doc.name+'" AND `tabAccount`.group_or_ledger = "Group" AND `tabAccount`.docstatus != 2 AND `tabAccount`.%(key)s LIKE "%s" ORDER BY `tabAccount`.name LIMIT 50';
}

View File

@@ -0,0 +1,228 @@
# 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, removechild, getchildren, make_autoname, SuperDocType
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
# -----------------------------------------------------------------------------------------
class DocType:
def __init__(self,d,dl):
self.doc, self.doclist = d,dl
# Create default accounts
# ---------------------------------------------------
def create_default_accounts(self):
self.fld_dict = {'account_name':0,'parent_account':1,'group_or_ledger':2,'is_pl_account':3,'account_type':4,'debit_or_credit':5,'company':6,'tax_rate':7}
acc_list_common = [['Application of Funds (Assets)','','Group','No','','Debit',self.doc.name,''],
['Current Assets','Application of Funds (Assets)','Group','No','','Debit',self.doc.name,''],
['Accounts Receivable','Current Assets','Group','No','','Debit',self.doc.name,''],
['Bank Accounts','Current Assets','Group','No','Bank or Cash','Debit',self.doc.name,''],
['Cash In Hand','Current Assets','Group','No','Bank or Cash','Debit',self.doc.name,''],
['Cash','Cash In Hand','Ledger','No','Bank or Cash','Debit',self.doc.name,''],
['Loans and Advances (Assets)','Current Assets','Group','No','','Debit',self.doc.name,''],
['Securities and Deposits','Current Assets','Group','No','','Debit',self.doc.name,''],
['Earnest Money','Securities and Deposits','Ledger','No','','Debit',self.doc.name,''],
['Stock In Hand','Current Assets','Group','No','','Debit',self.doc.name,''],
['Stock','Stock In Hand','Ledger','No','','Debit',self.doc.name,''],
['Tax Assets','Current Assets','Group','No','','Debit',self.doc.name,''],
['Fixed Assets','Application of Funds (Assets)','Group','No','','Debit',self.doc.name,''],
['Capital Equipments','Fixed Assets','Ledger','No','Fixed Asset Account','Debit',self.doc.name,''],
['Computers','Fixed Assets','Ledger','No','Fixed Asset Account','Debit',self.doc.name,''],
['Furniture and Fixture','Fixed Assets','Ledger','No','Fixed Asset Account','Debit',self.doc.name,''],
['Office Equipments','Fixed Assets','Ledger','No','Fixed Asset Account','Debit',self.doc.name,''],
['Plant and Machinery','Fixed Assets','Ledger','No','Fixed Asset Account','Debit',self.doc.name,''],
['Investments','Application of Funds (Assets)','Group','No','','Debit',self.doc.name,''],
['Temporary Accounts (Assets)','Application of Funds (Assets)','Group','No','','Debit',self.doc.name,''],
['Temporary Account (Assets)','Temporary Accounts (Assets)','Ledger','No','','Debit',self.doc.name,''],
['Source of Funds (Liabilities)','','Group','No','','Credit',self.doc.name,''],
['Capital Account','Source of Funds (Liabilities)','Group','No','','Credit',self.doc.name,''],
['Reserves and Surplus','Capital Account','Group','No','','Credit',self.doc.name,''],
['Shareholders Funds','Capital Account','Group','No','','Credit',self.doc.name,''],
['Current Liabilities','Source of Funds (Liabilities)','Group','No','','Credit',self.doc.name,''],
['Accounts Payable','Current Liabilities','Group','No','','Credit',self.doc.name,''],
['Duties and Taxes','Current Liabilities','Group','No','','Credit',self.doc.name,''],
['Loans (Liabilities)','Current Liabilities','Group','No','','Credit',self.doc.name,''],
['Secured Loans','Loans (Liabilities)','Group','No','','Credit',self.doc.name,''],
['Unsecured Loans','Loans (Liabilities)','Group','No','','Credit',self.doc.name,''],
['Bank Overdraft Account','Loans (Liabilities)','Group','No','','Credit',self.doc.name,''],
['Temporary Accounts (Liabilities)','Source of Funds (Liabilities)','Group','No','','Credit',self.doc.name,''],
['Temporary Account (Liabilities)','Temporary Accounts (Liabilities)','Ledger','No','','Credit',self.doc.name,''],
['Income','','Group','Yes','','Credit',self.doc.name,''],
['Direct Income','Income','Group','Yes','Income Account','Credit',self.doc.name,''],
['Sales','Direct Income','Ledger','Yes','Income Account','Credit',self.doc.name,''],
['Service','Direct Income','Ledger','Yes','Income Account','Credit',self.doc.name,''],
['Indirect Income','Income','Group','Yes','Income Account','Credit',self.doc.name,''],
['Expenses','','Group','Yes','Expense Account','Debit',self.doc.name,''],
['Direct Expenses','Expenses','Group','Yes','Expense Account','Debit',self.doc.name,''],
['Cost of Goods Sold','Direct Expenses','Ledger','Yes','Expense Account','Debit',self.doc.name,''],
['Indirect Expenses','Expenses','Group','Yes','Expense Account','Debit',self.doc.name,''],
['Advertising and Publicity','Indirect Expenses','Ledger','Yes','Chargeable','Debit',self.doc.name,''],
['Bad Debts Written Off','Indirect Expenses','Ledger','Yes','Expense Account','Debit',self.doc.name,''],
['Bank Charges','Indirect Expenses','Ledger','Yes','Expense Account','Debit',self.doc.name,''],
['Books and Periodicals','Indirect Expenses','Ledger','Yes','Expense Account','Debit',self.doc.name,''],
['Charity and Donations','Indirect Expenses','Ledger','Yes','Expense Account','Debit',self.doc.name,''],
['Commission on Sales','Indirect Expenses','Ledger','Yes','Expense Account','Debit',self.doc.name,''],
['Conveyance Expenses','Indirect Expenses','Ledger','Yes','Expense Account','Debit',self.doc.name,''],
['Customer Entertainment Expenses','Indirect Expenses','Ledger','Yes','Expense Account','Debit',self.doc.name,''],
['Depreciation Account','Indirect Expenses','Ledger','Yes','Expense Account','Debit',self.doc.name,''],
['Freight and Forwarding Charges','Indirect Expenses','Ledger','Yes','Chargeable','Debit',self.doc.name,''],
['Legal Expenses','Indirect Expenses','Ledger','Yes','Expense Account','Debit',self.doc.name,''],
['Miscellaneous Expenses','Indirect Expenses','Ledger','Yes','Chargeable','Debit',self.doc.name,''],
['Office Maintenance Expenses','Indirect Expenses','Ledger','Yes','Expense Account','Debit',self.doc.name,''],
['Office Rent','Indirect Expenses','Ledger','Yes','Expense Account','Debit',self.doc.name,''],
['Postal Expenses','Indirect Expenses','Ledger','Yes','Expense Account','Debit',self.doc.name,''],
['Print and Stationary','Indirect Expenses','Ledger','Yes','Expense Account','Debit',self.doc.name,''],
['Rounded Off','Indirect Expenses','Ledger','Yes','Expense Account','Debit',self.doc.name,''],
['Salary','Indirect Expenses','Ledger','Yes','Expense Account','Debit',self.doc.name,''],
['Sales Promotion Expenses','Indirect Expenses','Ledger','Yes','Chargeable','Debit',self.doc.name,''],
['Service Charges Paid','Indirect Expenses','Ledger','Yes','Expense Account','Debit',self.doc.name,''],
['Staff Welfare Expenses','Indirect Expenses','Ledger','Yes','Expense Account','Debit',self.doc.name,''],
['Telephone Expenses','Indirect Expenses','Ledger','Yes','Expense Account','Debit',self.doc.name,''],
['Travelling Expenses','Indirect Expenses','Ledger','Yes','Expense Account','Debit',self.doc.name,''],
['Water and Electricity Expenses','Indirect Expenses','Ledger','Yes','Expense Account','Debit',self.doc.name,'']
]
acc_list_india = [
['CENVAT Capital Goods','Tax Assets','Ledger','No','','Debit',self.doc.name,''],
['CENVAT','Tax Assets','Ledger','No','Chargeable','Debit',self.doc.name,''],
['CENVAT Service Tax','Tax Assets','Ledger','No','','Debit',self.doc.name,''],
['CENVAT Service Tax Cess 1','Tax Assets','Ledger','No','','Debit',self.doc.name,''],
['CENVAT Service Tax Cess 2','Tax Assets','Ledger','No','','Debit',self.doc.name,''],
['CENVAT Edu Cess','Tax Assets','Ledger','No','Chargeable','Debit',self.doc.name,''],
['CENVAT SHE Cess','Tax Assets','Ledger','No','Chargeable','Debit',self.doc.name,''],
['Excise Duty 4','Tax Assets','Ledger','No','Tax','Debit',self.doc.name,'4.00'],
['Excise Duty 8','Tax Assets','Ledger','No','Tax','Debit',self.doc.name,'8.00'],
['Excise Duty 10','Tax Assets','Ledger','No','Tax','Debit',self.doc.name,'10.00'],
['Excise Duty 14','Tax Assets','Ledger','No','Tax','Debit',self.doc.name,'14.00'],
['Excise Duty Edu Cess 2','Tax Assets','Ledger','No','Tax','Debit',self.doc.name,'2.00'],
['Excise Duty SHE Cess 1','Tax Assets','Ledger','No','Tax','Debit',self.doc.name,'1.00'],
['P L A','Tax Assets','Ledger','No','','Debit',self.doc.name,''],
['P L A - Cess Portion','Tax Assets','Ledger','No','','Debit',self.doc.name,''],
['Edu. Cess on Excise','Duties and Taxes','Ledger','No','Tax','Credit',self.doc.name,'2.00'],
['Edu. Cess on Service Tax','Duties and Taxes','Ledger','No','Tax','Credit',self.doc.name,'2.00'],
['Edu. Cess on TDS','Duties and Taxes','Ledger','No','Tax','Credit',self.doc.name,'2.00'],
['Excise Duty @ 4','Duties and Taxes','Ledger','No','Tax','Credit',self.doc.name,'4.00'],
['Excise Duty @ 8','Duties and Taxes','Ledger','No','Tax','Credit',self.doc.name,'8.00'],
['Excise Duty @ 10','Duties and Taxes','Ledger','No','Tax','Credit',self.doc.name,'10.00'],
['Excise Duty @ 14','Duties and Taxes','Ledger','No','Tax','Credit',self.doc.name,'14.00'],
['Service Tax','Duties and Taxes','Ledger','No','Tax','Credit',self.doc.name,'10.3'],
['SHE Cess on Excise','Duties and Taxes','Ledger','No','Tax','Credit',self.doc.name,'1.00'],
['SHE Cess on Service Tax','Duties and Taxes','Ledger','No','Tax','Credit',self.doc.name,'1.00'],
['SHE Cess on TDS','Duties and Taxes','Ledger','No','Tax','Credit',self.doc.name,'1.00'],
['Professional Tax','Duties and Taxes','Ledger','No','','Credit',self.doc.name,''],
['VAT','Duties and Taxes','Ledger','No','','Credit',self.doc.name,''],
['TDS (Advertisement)','Duties and Taxes','Ledger','No','','Credit',self.doc.name,''],
['TDS (Commission)','Duties and Taxes','Ledger','No','','Credit',self.doc.name,''],
['TDS (Contractor)','Duties and Taxes','Ledger','No','','Credit',self.doc.name,''],
['TDS (Interest)','Duties and Taxes','Ledger','No','','Credit',self.doc.name,''],
['TDS (Rent)','Duties and Taxes','Ledger','No','','Credit',self.doc.name,''],
['TDS (Salary)','Duties and Taxes','Ledger','No','','Credit',self.doc.name,'']
]
# load common account heads
for d in acc_list_common:
self.add_acc(d)
country = sql("select value from tabSingles where field = 'country' and doctype = 'Control Panel'")
country = country and cstr(country[0][0]) or ''
# load taxes (only for India)
if country == 'India':
for d in acc_list_india:
self.add_acc(d)
# Create account
# ---------------------------------------------------
def add_acc(self,lst):
ac = Document('Account')
for d in self.fld_dict.keys():
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.validate()
ac_obj.doc.save(1)
ac_obj.on_update()
sql("commit")
sql("start transaction")
# Set letter head
# ---------------------------------------------------
def set_letter_head(self):
if not self.doc.letter_head:
if self.doc.address:
header = """
<div><h3> %(comp)s </h3> %(add)s </div>
""" % {'comp':self.doc.name,
'add':self.doc.address.replace("\n",'<br>')}
self.doc.letter_head = header
# Set default AR and AP group
# ---------------------------------------------------
def set_default_groups(self):
if not self.doc.receivables_group:
set(self.doc, 'receivables_group', 'Accounts Receivable - '+self.doc.abbr)
if not self.doc.payables_group:
set(self.doc, 'payables_group', 'Accounts Payable - '+self.doc.abbr)
# Create default cost center
# ---------------------------------------------------
def create_default_cost_center(self):
glc = get_obj('GL Control')
cc_list = [{'cost_center_name':'Root','company_name':self.doc.name,'company_abbr':self.doc.abbr,'group_or_ledger':'Group','parent_cost_center':'','old_parent':''}, {'cost_center_name':'Default CC Ledger','company_name':self.doc.name,'company_abbr':self.doc.abbr,'group_or_ledger':'Ledger','parent_cost_center':'Root - ' + self.doc.abbr,'old_parent':''}]
for c in cc_list:
glc.add_cc(str(c))
# On update
# ---------------------------------------------------
def on_update(self):
self.set_letter_head()
ac = sql("select name from tabAccount where account_name='Income' and company=%s", self.doc.name)
if not ac:
self.create_default_accounts()
self.set_default_groups()
cc = sql("select name from `tabCost Center` where cost_center_name = 'Root' and company_name = '%s'"%(self.doc.name))
if not cc:
self.create_default_cost_center()
# Trash accounts and cost centers for this company
# ---------------------------------------------------
def on_trash(self):
acc = sql("select name from tabAccount where company = '%s' and docstatus = 1" % self.doc.name)
for each in acc:
get_obj('Account', each[0]).on_trash()
cc = sql("select name from `tabCost Center` where company_name = '%s' and docstatus = 1" % self.doc.name)
for each in cc:
get_obj('Cost Center', each[0]).on_trash()
msgprint("Company trashed. All the accounts and cost centers related to this company also trashed. You can restore it anytime from Setup -> Manage Trash")
# Restore accounts and cost centers for this company
# ---------------------------------------------------
def on_restore(self):
acc = sql("select name from tabAccount where company = '%s' and docstatus = 2" % self.doc.name)
for each in acc:
get_obj('Account', each[0]).on_restore()
cc = sql("select name from `tabCost Center` where company_name = '%s' and docstatus = 2" % self.doc.name)
for each in cc:
get_obj('Cost Center', each[0]).on_restore()
msgprint("Company restored. All the accounts and cost centers related to this company also restored.")

View File

@@ -0,0 +1,930 @@
[
{
'_last_update': '1303215455',
'allow_attach': None,
'allow_copy': None,
'allow_email': None,
'allow_print': None,
'allow_rename': None,
'allow_trash': 1,
'autoname': 'field:company_name',
'change_log': None,
'client_script': None,
'client_script_core': None,
'client_string': None,
'colour': 'White:FFF',
'creation': '2010-08-08 17:08:55',
'description': None,
'docstatus': 0,
'doctype': 'DocType',
'document_type': 'Master',
'dt_template': None,
'hide_heading': None,
'hide_toolbar': None,
'idx': None,
'in_create': None,
'in_dialog': None,
'is_transaction_doc': None,
'issingle': None,
'istable': None,
'max_attachments': None,
'menu_index': None,
'modified': '2011-04-20 12:17:16',
'modified_by': 'Administrator',
'module': 'Setup',
'name': 'Company',
'name_case': None,
'owner': 'Administrator',
'parent': None,
'parent_node': None,
'parentfield': None,
'parenttype': None,
'print_outline': None,
'read_only': None,
'read_only_onload': None,
'search_fields': None,
'section_style': 'Tabbed',
'server_code': None,
'server_code_compiled': None,
'server_code_core': None,
'server_code_error': ' ',
'show_in_menu': 0,
'smallicon': None,
'use_template': None,
'version': 86
},
{
'amend': 0,
'cancel': 0,
'create': 1,
'creation': '2010-08-08 17:08:55',
'docstatus': 0,
'doctype': 'DocPerm',
'execute': None,
'idx': 1,
'match': '',
'modified': '2010-08-08 17:08:55',
'modified_by': 'Administrator',
'name': 'PERM00119',
'owner': 'Administrator',
'parent': 'Company',
'parentfield': 'permissions',
'parenttype': 'DocType',
'permlevel': 0,
'read': 1,
'role': 'System Manager',
'submit': 0,
'write': 1
},
{
'amend': 0,
'cancel': 0,
'create': 1,
'creation': '2010-08-08 17:08:55',
'docstatus': 0,
'doctype': 'DocPerm',
'execute': None,
'idx': 2,
'match': '',
'modified': '2010-08-08 17:08:55',
'modified_by': 'Administrator',
'name': 'PERM00120',
'owner': 'Administrator',
'parent': 'Company',
'parentfield': 'permissions',
'parenttype': 'DocType',
'permlevel': 0,
'read': 1,
'role': 'Administrator',
'submit': 0,
'write': 1
},
{
'amend': None,
'cancel': 0,
'create': None,
'creation': '2010-08-08 17:08:55',
'docstatus': 0,
'doctype': 'DocPerm',
'execute': None,
'idx': 3,
'match': None,
'modified': '2010-08-08 17:08:55',
'modified_by': 'Administrator',
'name': 'PERM00121',
'owner': 'Administrator',
'parent': 'Company',
'parentfield': 'permissions',
'parenttype': 'DocType',
'permlevel': 1,
'read': 1,
'role': 'All',
'submit': None,
'write': None
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2011-05-09 11:04:28',
'default': None,
'depends_on': None,
'description': 'Please Enter Company Name and Abbr and save the document. Once saved Accounting Settings will be populated automatically',
'docstatus': 0,
'doctype': 'DocField',
'fieldname': None,
'fieldtype': 'Section Break',
'hidden': None,
'icon': None,
'idx': 1,
'in_filter': None,
'label': 'Details',
'modified': '2011-05-09 11:04:28',
'modified_by': 'Administrator',
'name': '000000437',
'no_copy': None,
'oldfieldname': None,
'oldfieldtype': 'Section Break',
'options': None,
'owner': 'Administrator',
'parent': 'Company',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': None
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2010-08-08 17:08:55',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'company_name',
'fieldtype': 'Data',
'hidden': None,
'icon': None,
'idx': 2,
'in_filter': None,
'label': 'Company',
'modified': '2011-05-09 11:04:28',
'modified_by': 'Administrator',
'name': 'FL00695',
'no_copy': 1,
'oldfieldname': 'company_name',
'oldfieldtype': 'Data',
'options': None,
'owner': 'Administrator',
'parent': 'Company',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': 1,
'search_index': None,
'trigger': None,
'width': None
},
{
'allow_on_submit': None,
'colour': 'White:FFF',
'creation': '2010-08-08 17:08:55',
'default': None,
'depends_on': None,
'description': 'Please Enter Abbreviation or Short Name properly as it will be added as Suffix to all Account Heads.',
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'abbr',
'fieldtype': 'Data',
'hidden': None,
'icon': None,
'idx': 3,
'in_filter': None,
'label': 'Abbr',
'modified': '2011-05-09 11:04:28',
'modified_by': 'Administrator',
'name': 'FL00696',
'no_copy': 1,
'oldfieldname': 'abbr',
'oldfieldtype': 'Data',
'options': None,
'owner': 'Administrator',
'parent': 'Company',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': 1,
'search_index': None,
'trigger': None,
'width': None
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2010-08-08 17:08:55',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'address',
'fieldtype': 'Small Text',
'hidden': None,
'icon': None,
'idx': 4,
'in_filter': None,
'label': 'Address',
'modified': '2011-05-09 11:04:28',
'modified_by': 'Administrator',
'name': 'FL00697',
'no_copy': None,
'oldfieldname': 'address',
'oldfieldtype': 'Small Text',
'options': None,
'owner': 'Administrator',
'parent': 'Company',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': None
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2011-05-09 11:04:28',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'default_currency',
'fieldtype': 'Select',
'hidden': None,
'icon': None,
'idx': 5,
'in_filter': None,
'label': 'Default Currency',
'modified': '2011-05-09 11:04:28',
'modified_by': 'Administrator',
'name': '000000434',
'no_copy': None,
'oldfieldname': None,
'oldfieldtype': None,
'options': 'link:Currency',
'owner': 'Administrator',
'parent': 'Company',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': 1,
'search_index': None,
'trigger': None,
'width': None
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2011-05-09 11:04:28',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': None,
'fieldtype': 'Column Break',
'hidden': None,
'icon': None,
'idx': 6,
'in_filter': None,
'label': None,
'modified': '2011-05-09 11:04:28',
'modified_by': 'Administrator',
'name': '000000438',
'no_copy': None,
'oldfieldname': None,
'oldfieldtype': 'Column Break',
'options': None,
'owner': 'Administrator',
'parent': 'Company',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': '50%'
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2010-08-08 17:08:55',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'phone_no',
'fieldtype': 'Data',
'hidden': None,
'icon': None,
'idx': 7,
'in_filter': None,
'label': 'Phone No',
'modified': '2011-05-09 11:04:28',
'modified_by': 'Administrator',
'name': 'FL00699',
'no_copy': None,
'oldfieldname': 'phone_no',
'oldfieldtype': 'Data',
'options': 'Phone',
'owner': 'Administrator',
'parent': 'Company',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': None
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2010-08-08 17:08:55',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'email',
'fieldtype': 'Data',
'hidden': None,
'icon': None,
'idx': 8,
'in_filter': None,
'label': 'Email',
'modified': '2011-05-09 11:04:28',
'modified_by': 'Administrator',
'name': 'FL00700',
'no_copy': None,
'oldfieldname': 'email',
'oldfieldtype': 'Data',
'options': 'Email',
'owner': 'Administrator',
'parent': 'Company',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': None
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2010-08-08 17:08:55',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'fax',
'fieldtype': 'Data',
'hidden': None,
'icon': None,
'idx': 9,
'in_filter': None,
'label': 'Fax',
'modified': '2011-05-09 11:04:28',
'modified_by': 'Administrator',
'name': 'FL00701',
'no_copy': None,
'oldfieldname': 'fax',
'oldfieldtype': 'Data',
'options': 'Phone',
'owner': 'Administrator',
'parent': 'Company',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': None
},
{
'allow_on_submit': None,
'colour': 'White:FFF',
'creation': '2010-12-14 10:32:55',
'default': None,
'depends_on': 'eval:!doc.__islocal',
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': None,
'fieldtype': 'Button',
'hidden': None,
'icon': None,
'idx': 10,
'in_filter': None,
'label': 'Trash Company',
'modified': '2011-05-09 11:04:28',
'modified_by': 'Administrator',
'name': 'FL04130',
'no_copy': None,
'oldfieldname': None,
'oldfieldtype': 'Button',
'options': None,
'owner': 'nabin@webnotestech.com',
'parent': 'Company',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': 'Client',
'width': None
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2010-08-08 17:08:55',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'website',
'fieldtype': 'Data',
'hidden': None,
'icon': None,
'idx': 11,
'in_filter': None,
'label': 'Website',
'modified': '2011-05-09 11:04:28',
'modified_by': 'Administrator',
'name': 'FL00702',
'no_copy': None,
'oldfieldname': 'website',
'oldfieldtype': 'Data',
'options': None,
'owner': 'Administrator',
'parent': 'Company',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': None
},
{
'allow_on_submit': None,
'colour': 'White:FFF',
'creation': '2011-05-09 11:04:28',
'default': None,
'depends_on': None,
'description': 'Company registration numbers for your reference. Example: VAT Registration Numbers etc.',
'docstatus': 0,
'doctype': 'DocField',
'fieldname': None,
'fieldtype': 'Section Break',
'hidden': None,
'icon': None,
'idx': 12,
'in_filter': None,
'label': 'Registration Info',
'modified': '2011-05-09 11:04:28',
'modified_by': 'Administrator',
'name': '000000439',
'no_copy': None,
'oldfieldname': None,
'oldfieldtype': 'Section Break',
'options': None,
'owner': 'Administrator',
'parent': 'Company',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': '50%'
},
{
'allow_on_submit': None,
'colour': 'White:FFF',
'creation': '2010-08-08 17:08:55',
'default': None,
'depends_on': None,
'description': 'Company registration numbers for your reference. Tax numbers etc.',
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'registration_details',
'fieldtype': 'Code',
'hidden': None,
'icon': None,
'idx': 13,
'in_filter': None,
'label': 'Registration Details',
'modified': '2011-05-09 11:04:28',
'modified_by': 'Administrator',
'name': 'FL00704',
'no_copy': None,
'oldfieldname': 'registration_details',
'oldfieldtype': 'Code',
'options': None,
'owner': 'Administrator',
'parent': 'Company',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': None
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2011-05-09 11:04:28',
'default': None,
'depends_on': 'eval:!doc.__islocal',
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': None,
'fieldtype': 'Section Break',
'hidden': None,
'icon': None,
'idx': 14,
'in_filter': None,
'label': 'Accounting Settings',
'modified': '2011-05-09 11:04:28',
'modified_by': 'Administrator',
'name': '000000440',
'no_copy': None,
'oldfieldname': None,
'oldfieldtype': 'Section Break',
'options': None,
'owner': 'Administrator',
'parent': 'Company',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': None
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2010-08-08 17:08:55',
'default': None,
'depends_on': 'eval:!doc.__islocal',
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'default_bank_account',
'fieldtype': 'Link',
'hidden': None,
'icon': None,
'idx': 15,
'in_filter': None,
'label': 'Default Bank Account',
'modified': '2011-05-09 11:04:28',
'modified_by': 'Administrator',
'name': 'FL00706',
'no_copy': 1,
'oldfieldname': 'default_bank_account',
'oldfieldtype': 'Link',
'options': 'Account',
'owner': 'Administrator',
'parent': 'Company',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': 'Client',
'width': None
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2010-08-08 17:08:55',
'default': None,
'depends_on': 'eval:!doc.__islocal',
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'receivables_group',
'fieldtype': 'Link',
'hidden': None,
'icon': None,
'idx': 16,
'in_filter': None,
'label': 'Receivables Group',
'modified': '2011-05-09 11:04:28',
'modified_by': 'Administrator',
'name': 'FL00707',
'no_copy': 1,
'oldfieldname': 'receivables_group',
'oldfieldtype': 'Link',
'options': 'Account',
'owner': 'Administrator',
'parent': 'Company',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': 'Client',
'width': None
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2010-08-08 17:08:55',
'default': None,
'depends_on': 'eval:!doc.__islocal',
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'payables_group',
'fieldtype': 'Link',
'hidden': None,
'icon': None,
'idx': 17,
'in_filter': None,
'label': 'Payables Group',
'modified': '2011-05-09 11:04:28',
'modified_by': 'Administrator',
'name': 'FL00708',
'no_copy': 1,
'oldfieldname': 'payables_group',
'oldfieldtype': 'Link',
'options': 'Account',
'owner': 'Administrator',
'parent': 'Company',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': 'Client',
'width': None
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2011-05-09 11:04:28',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': None,
'fieldtype': 'Column Break',
'hidden': None,
'icon': None,
'idx': 18,
'in_filter': None,
'label': None,
'modified': '2011-05-09 11:04:28',
'modified_by': 'Administrator',
'name': '000000441',
'no_copy': None,
'oldfieldname': None,
'oldfieldtype': 'Column Break',
'options': None,
'owner': 'Administrator',
'parent': 'Company',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': '50%'
},
{
'allow_on_submit': None,
'colour': 'White:FFF',
'creation': '2010-08-08 17:08:55',
'default': None,
'depends_on': 'eval:!doc.__islocal',
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'yearly_bgt_flag',
'fieldtype': 'Select',
'hidden': None,
'icon': None,
'idx': 19,
'in_filter': None,
'label': 'If Yearly Budget Exceeded',
'modified': '2011-05-09 11:04:28',
'modified_by': 'Administrator',
'name': 'FL00710',
'no_copy': None,
'oldfieldname': 'yearly_bgt_flag',
'oldfieldtype': 'Select',
'options': '\nWarn\nIgnore\nStop',
'owner': 'Administrator',
'parent': 'Company',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': None
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2010-08-08 17:08:55',
'default': None,
'depends_on': 'eval:!doc.__islocal',
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'monthly_bgt_flag',
'fieldtype': 'Select',
'hidden': None,
'icon': None,
'idx': 20,
'in_filter': None,
'label': 'If Monthly Budget Exceeded',
'modified': '2011-05-09 11:04:28',
'modified_by': 'Administrator',
'name': 'FL00711',
'no_copy': None,
'oldfieldname': 'monthly_bgt_flag',
'oldfieldtype': 'Select',
'options': '\nWarn\nIgnore\nStop',
'owner': 'jai@webnotestech.com',
'parent': 'Company',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': None
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2010-08-08 17:08:55',
'default': None,
'depends_on': 'eval:!doc.__islocal',
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'credit_days',
'fieldtype': 'Int',
'hidden': None,
'icon': None,
'idx': 21,
'in_filter': None,
'label': 'Credit Days',
'modified': '2011-05-09 11:04:28',
'modified_by': 'Administrator',
'name': 'FL00712',
'no_copy': None,
'oldfieldname': 'credit_days',
'oldfieldtype': 'Int',
'options': None,
'owner': 'Administrator',
'parent': 'Company',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': None
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2010-08-08 17:08:55',
'default': None,
'depends_on': 'eval:!doc.__islocal',
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'credit_limit',
'fieldtype': 'Currency',
'hidden': None,
'icon': None,
'idx': 22,
'in_filter': None,
'label': 'Credit Limit',
'modified': '2011-05-09 11:04:28',
'modified_by': 'Administrator',
'name': 'FL00713',
'no_copy': None,
'oldfieldname': 'credit_limit',
'oldfieldtype': 'Currency',
'options': None,
'owner': 'Administrator',
'parent': 'Company',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': None
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2010-08-08 17:08:55',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'trash_reason',
'fieldtype': 'Small Text',
'hidden': None,
'icon': None,
'idx': 23,
'in_filter': None,
'label': 'Trash Reason',
'modified': '2011-05-09 11:04:28',
'modified_by': 'Administrator',
'name': 'FL00716',
'no_copy': 1,
'oldfieldname': 'trash_reason',
'oldfieldtype': 'Small Text',
'options': None,
'owner': 'Administrator',
'parent': 'Company',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 1,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': None
}
]

View File

@@ -0,0 +1,562 @@
// common partner functions
// =========================
/*
// make shipping list body
// ------------------------
cur_frm.cscript.make_sl_body = function(){
cur_frm.fields_dict['Shipping HTML'].wrapper.innerHTML = '';
cur_frm.shipping_html = $a(cur_frm.fields_dict['Shipping HTML'].wrapper,'div');
}
*/
// make history list body
// -----------------------
cur_frm.cscript.make_hl_body = function(){
cur_frm.fields_dict['History HTML'].wrapper.innerHTML = '';
cur_frm.history_html = $a(cur_frm.fields_dict['History HTML'].wrapper,'div');
}
/*
// set shipping list message
// --------------------------
cur_frm.cscript.set_sl_msg = function(doc){
cur_frm.shipping_html.innerHTML = 'Shipping Address Details will appear only when you save the ' + doc.doctype.toLowerCase();
}
*/
/*
// set history list message
// -------------------------
cur_frm.cscript.set_hl_msg = function(doc){
cur_frm.history_html.innerHTML= 'History Details will appear only when you save the ' + doc.doctype.toLowerCase();
}
*/
/*
// make shipping address
// -------------
cur_frm.cscript.make_shipping_address = function(doc, dt, dn){
cur_frm.shipping_html.innerHTML = '';
var dsn = cur_frm.doc.customer_name;
var dsa = cur_frm.doc.address;
cl = new AddressList(cur_frm.shipping_html,dt,dn,dsn,dsa);
}
*/
// make history
// -------------
cur_frm.cscript.make_history = function(doc,dt,dn){
cur_frm.history_html.innerHTML = '';
cur_frm.cscript.make_history_list(cur_frm.history_html,doc);
}
// make history list
// ------------------
cur_frm.cscript.make_history_list = function(parent,doc){
var sel = $a(parent,'select');
var ls = ['Select Transaction..'];
for(d in cur_frm.history_dict){
ls.push(d);
}
add_sel_options(sel,ls,'Select..');
var body = $a(parent,'div');
body.innerHTML = '<div class="help_box">Please select a transaction type to see History</div>';
sel.body = body;
sel.doc = doc;
sel.onchange = function(){
for(d in cur_frm.history_dict){
if(sel_val(this) == d){
this.body.innerHTML = '';
eval(cur_frm.history_dict[d]);
return;
}
else{
// pass
}
}
}
}
// run list
// ---------
cur_frm.cscript.run_list = function(lst,parent,q,q_max,doc,dn,nm){
parent.innerHTML = '';
$dh(parent);
lst.doc = doc;
lst.dn = dn;
lst.nm = nm;
lst.page_len = 10;
lst.get_query = function(){
this.query = q;
this.query_max = q_max;
}
lst.make(parent);
lst.run();
lst.onrun = function(){
$ds(parent);
if(!this.has_data()){
parent.innerHTML = '';
var dv = $a(parent,'div','help_box');
$a(dv,'span').innerHTML = "No " + this.dn + " found. ";
var lbl = 'Create the <b>first</b> ' + this.dn + ' for ' + this.doc.name;
var sp = $a(dv,'span');
sp.nm = this.nm;
$(sp).html(lbl).addClass('link_type').click(function(){ newdoc(this.nm); });
}
}
}
// get sates on country trigger
// -----------------------------
cur_frm.cscript.get_states=function(doc,dt,dn){
$c('runserverobj', args={'method':'check_state', 'docs':compress_doclist([doc])},
function(r,rt){
if(r.message) {
set_field_options('state', r.message);
}
}
);
}
cur_frm.cscript.country = function(doc, dt, dn) {
cur_frm.cscript.get_states(doc, dt, dn);
}
// territory help - cutsomer + sales partner
// -----------------------------------------
cur_frm.cscript.TerritoryHelp = function(doc,dt,dn){
var call_back = function(){
var sb_obj = new SalesBrowser();
sb_obj.set_val('Territory');
}
loadpage('Sales Browser',call_back);
}
// get query select Territory
// ---------------------------
if(cur_frm.fields_dict['territory']){
cur_frm.fields_dict['territory'].get_query = function(doc,dt,dn) {
return 'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` FROM `tabTerritory` WHERE `tabTerritory`.`is_group` = "No" AND `tabTerritory`.`docstatus`!= 2 AND `tabTerritory`.%(key)s LIKE "%s" ORDER BY `tabTerritory`.`name` ASC LIMIT 50';
}
}
// =======================================================================================================
// contact list
// --------------
ContactList = function(parent,dt,dn,dsn){
var me = this;
this.dt = dt;
this.dn = dn;
this.dsn = dsn ? dsn : dn;
this.wrapper = $a(parent,'div');
me.get_list();
}
// add contact
// ------------
ContactList.prototype.add_contact = function(){
var me = this;
// onload - set default values
var cont = LocalDB.create('Contact');
var c = locals['Contact'][cont];
if(me.dt == 'Customer') {
c.is_customer = 1;
c.customer = me.dn;
c.customer_name = me.dsn;
}
else if(me.dt == 'Supplier'){
c.is_supplier = 1;
c.supplier = me.dn;
c.supplier_name = me.dsn;
}
else if(me.dt == 'Sales Partner'){
c.is_sales_partner = 1;
c.sales_partner = me.dn;
//c.sales_partner_name = me.dsn;
}
loaddoc('Contact',c.name);
}
// get contact list
// -----------------
ContactList.prototype.get_list = function(){
var me = this;
me.make_list();
var dt = me.dt.toLowerCase().split(' ').join('_');
// build query
me.lst.get_query = function(){
this.query = repl("select name, first_name, last_name, concat_ws(' ', first_name, last_name), email_id, contact_no, department, designation, is_primary_contact, has_login, disable_login from tabContact where %(dt)s = '%(dn)s' and docstatus != 2",{'dt':dt, 'dn':me.dn});
this.query_max = repl("select count(name) from tabContact where %(dt)s = '%(dn)s' and docstatus != 2",{'dt':dt, 'dn':me.dn});
}
// render list ui
me.lst.show_cell = function(cell,ri,ci,d){
me.render_list(cell,ri,ci,d);
}
// run query
me.lst.run();
// onrun
me.lst.onrun = function(){
if(!this.has_data()){
this.rec_label.innerHTML = '';
$a(this.rec_label,'span').innerHTML = "You do not have any contact. ";
$($a(this.rec_label,'span')).html('Add a new contact').addClass('link_type').click(function(){ me.add_contact(); });
$dh(this.results);
}
else{
$ds(this.results);
}
}
}
// make list
// -----------
ContactList.prototype.make_list = function(){
var me = this;
var l = new Listing();
l.colwidths = ['5%','30%','30%','20%','20%'];
l.colnames = ['Sr.','Contact Name','Email Id','Contact No', 'Action'];
l.page_len = 10;
me.lst = l;
l.make(me.wrapper);
// Add contact button
me.add_btn = $btn(l.btn_area,'+ Add Contact', function(){ me.add_contact();}, {fontWeight:'bold'});
}
// make contact cell
// ------------------
ContactList.prototype.render_list = function(cell,ri,ci,d){
var me = this;
// name
if(ci == 0){
var nm = $a($a(cell,'div'),'span','',{cursor:'pointer'});
nm.innerHTML = d[ri][3];
nm.id = d[ri][0];
nm.onclick = function(){
loaddoc('Contact', this.id);
// on save callback - refresh list
}
// department and designation
var des = d[ri][7] ? d[ri][7] : '';
var dep = d[ri][6] ? d[ri][6] : '';
var sp = $a(cell,'div','comment');
sp.innerHTML = des + (dep ? (', ' + dep) : '');
}
// email id, contact no, department, designation
// -----------------------------------------------------
if(ci == 1) cell.innerHTML = d[ri][4] ? d[ri][4] : '-';
if(ci == 2) cell.innerHTML = d[ri][5] ? d[ri][5] : '-';
// actions
// --------------------------------------
if(ci== 3) me.make_actions(cell,ri,ci,d);
}
// make actions
// ---------------
ContactList.prototype.make_actions = function(cell,ri,ci,d){
var me = this;
var tab = make_table(cell,1,2,'100%',['40%','60%']);
// Edit and Delete
var t = make_table($td(tab,0,0),1,2);
var edit = $a($td(t,0,0),'div','wn-icon ic-doc_edit');
$(edit).click(function(){ loaddoc('Contact',d[ri][0]); });
edit.setAttribute('title','Edit');
// Below code should be uncommented once customer/venodr invitation process is stable
// ===========================================================================
/*
var del = $a($td(t,0,1),'div','wn-icon ic-trash');
$(del).click(function(){ me.delete_contact(d[ri][0],d[ri][4]) });
set_custom_tooltip(del, 'Delete');
// Invite, Enable and Disable - Integrate after gateway logic incorporated
if(d[ri][9] == 'Yes') {
if(d[ri][10] == 'Yes'){
var enb = $a($td(tab,0,1),'div','wn-icon ic-checkmark');
$(enb).click(function(){ me.enable_login(d[ri][0], d[ri][4]); });
}
else{
var dsb = $a($td(tab,0,1),'div','wn-icon ic-delete');
$(dsb).click(function(){ me.disable_login(d[ri][0], d[ri][4]) });
}
}
else{
var inv = $a($td(tab,0,1),'div','wn-icon ic-mail');
$(inv).click(function(){ me.invite_contact(d[ri][0], d[ri][4], d[ri][1], d[ri][2]) });
}*/
}
// enable login
// ----------------------------------------------------------
ContactList.prototype.enable_login = function(id, email_id){
var me = this;
var callback = function(r,rt){
me.get_list();
if(!r.exc) msgprint('Login for contact enabled',1);
else errprint(r.exc);
}
var args = {};
args.contact = id;
args.email = email_id;
$c_obj('Contact Control','enable_login',JSON.stringify(args),callback);
}
// disable login
// -------------------------------------------------------------
ContactList.prototype.disable_login = function(id, email_id){
var me = this;
var callback = function(r,rt){
me.get_list();
if(!r.exc) msgprint('Login for contact disabled',1);
else errprint(r.exc);
}
var args = {};
args.contact = id;
args.email = email_id;
$c_obj('Contact Control','disable_login',JSON.stringify(args),callback);
}
// delete contact
// -----------------
ContactList.prototype.delete_contact = function(id,email_id,has_login){
var me = this;
var callback = function(r,rt){
me.get_list();
if(!r.exc) msgprint('Contact deleted successfully');
else errprint(r.exc);
}
var args = {};
args.contact = id;
args.email = email_id;
args.has_login = has_login;
$c_obj('Contact Control','delete_contact',JSON.stringify(args),callback);
}
// invite user
// --------------------------------------------------------
ContactList.prototype.invite_contact = function(id,email_id,first_name,last_name){
var me = this;
if(!email_id){
msgprint("Please add email id and save the contact first. You can then invite contact to view transactions.")
}
else{
var callback = function(r,rt){
if(!r.exc) msgprint('Invitation sent');
else errprint(r.exc);
}
var args = {
'contact' : id,
'email' : email_id,
'first_name' : first_name ? first_name : '',
'last_name' : last_name ? last_name : '',
'usert_type' : 'Partner'
};
$c_obj('Contact Control','invite_contact',JSON.stringify(args),callback);
}
}
// address list
// --------------
AddressList = function(parent,dt,dn,dsn,dsa){
var me = this;
this.dt = dt;
this.dn = dn;
this.dsn = dsn ? dsn : dn;
this.dsa = dsa ? dsa : '';
this.wrapper = $a(parent,'div');
me.get_addr_list();
}
// add contact
// ------------
AddressList.prototype.add_address = function(){
var me = this;
// onload - set default values
var addr = LocalDB.create('Shipping Address');
var a = locals['Shipping Address'][addr];
a.customer = me.dn;
a.customer_name = me.dsn;
a.customer_address = me.dsa;
loaddoc('Shipping Address',a.name);
}
// get address list
// -----------------
AddressList.prototype.get_addr_list = function(){
var me = this;
me.make_addr_list();
var dt = me.dt.toLowerCase().split(' ').join('_');
// build query
me.lst.get_query = function(){
this.query = repl("select name, ship_to, shipping_address, is_primary_address, shipping_details from `tabShipping Address` where %(dt)s = '%(dn)s' and docstatus != 2",{'dt':dt, 'dn':me.dn});
this.query_max = repl("select count(name) from `tabShipping Address` where %(dt)s = '%(dn)s'",{'dt':dt, 'dn':me.dn});
}
// render list ui
me.lst.show_cell = function(cell,ri,ci,d){
me.render_list(cell,ri,ci,d);
}
// run query
me.lst.run();
// onrun
me.lst.onrun = function(){
if(!this.has_data()){
this.rec_label.innerHTML = '';
$a(this.rec_label,'span').innerHTML = "You do not have any shipping address.";
$($a(this.rec_label,'span')).html('Add a new address').addClass('link_type').click(function(){ me.add_address(); });
$dh(this.results);
}
else{
$ds(this.results);
}
}
}
// make list
// -----------
AddressList.prototype.make_addr_list = function(){
var me = this;
var l = new Listing();
l.colwidths = ['5%', '15%', '25%','10%','35%','10%'];
l.colnames = ['Sr.', 'Ship To', 'Shipping Address','Primary Address', 'Shipping Details', 'Action'];
l.page_len = 10;
me.lst = l;
l.make(me.wrapper);
// Add address button
me.add_btn = $btn(l.btn_area,'+ Add Address', function(){ me.add_address();}, {fontWeight:'bold'});
}
// make address cell
// ------------------
AddressList.prototype.render_list = function(cell,ri,ci,d){
var me = this;
// name
if(ci == 0){
var nm = $a($a(cell,'div'),'span','',{cursor:'pointer'});
nm.innerHTML = d[ri][1];
nm.id = d[ri][0];
nm.onclick = function(){
loaddoc('Shipping Address', this.id);
}
}
// shipping address, primary address, shipping details
// ----------------------------------------------------
if(ci == 1) cell.innerHTML = d[ri][2] ? d[ri][2] : '-';
if(ci == 2) cell.innerHTML = d[ri][3] ? d[ri][3] : '-';
if(ci == 3) cell.innerHTML = d[ri][4] ? d[ri][4] : '-';
// actions
// --------------------------------------
if(ci== 4) me.make_actions(cell,ri,ci,d);
}
// make actions
// ---------------
AddressList.prototype.make_actions = function(cell,ri,ci,d){
var me = this;
var tab = make_table(cell,1,2,'100%',['40%','60%']);
// Edit and Delete
var t = make_table($td(tab,0,0),1,2);
var edit = $a($td(t,0,0),'div','wn-icon ic-doc_edit');
$(edit).click(function(){ loaddoc('Shipping Address',d[ri][0]); });
edit.setAttribute('title','Edit');
}

View File

@@ -0,0 +1,103 @@
# 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, removechild, getchildren, make_autoname, SuperDocType
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
# -----------------------------------------------------------------------------------------
class DocType:
def __init__(self,doc,doclist=[]):
self.doc = doc
self.doclist = doclist
def enable_login(self,arg):
arg = eval(arg)
sql("update tabContact set disable_login = 'No' where name=%s",arg['contact'])
sql("update tabProfile set enabled=1 where name=%s",arg['email'])
def disable_login(self,arg):
arg = eval(arg)
sql("update tabContact set disable_login = 'Yes' where name=%s",arg['contact'])
sql("update tabProfile set enabled=0 where name=%s",arg['email'])
def create_login(self,arg):
arg = eval(arg)
cont_det = sql("select * from tabContact where name=%s",(arg['contact']),as_dict=1)
if cont_det[0]['docstatus'] !=0:
msgprint('Please save the corresponding contact first')
raise Exception
if sql("select name from tabProfile where name=%s",cont_det[0]['email_id']):
msgprint('Profile with same name already exist.')
raise Exception
else:
p = Document('Profile')
p.name = cont_det[0]['email_id']
p.first_name = cont_det[0]['first_name']
p.last_name = cont_det[0]['last_name']
p.email = cont_det[0]['email_id']
p.cell_no = cont_det[0]['contact_no']
p.password = 'password'
p.enabled = 1
p.user_type = 'Partner';
p.save(1)
get_obj(doc=p).on_update()
role = []
if cont_det[0]['contact_type'] == 'Individual':
role = ['Customer']
else:
if cont_det[0]['is_customer']:
role.append('Customer')
if cont_det[0]['is_supplier']:
role.append('Supplier')
if cont_det[0]['is_sales_partner']:
role.append('Partner')
if role:
prof_nm = p.name
for i in role:
r = Document('UserRole')
r.parent = p.name
r.role = i
r.parenttype = 'Profile'
r.parentfield = 'userroles'
r.save(1)
if i == 'Customer':
def_keys = ['from_company','customer_name','customer']
def_val = cont_det[0]['customer_name']
self.set_default_val(def_keys,def_val,prof_nm)
if i == 'Supplier':
def_keys = ['supplier_name','supplier']
def_val = cont_det[0]['supplier_name']
self.set_default_val(def_keys,def_val,prof_nm)
sql("update tabContact set has_login = 'Yes' where name=%s",cont_det[0]['name'])
sql("update tabContact set disable_login = 'No' where name=%s",cont_det[0]['name'])
msgprint('User login is created.')
#------set default values---------
def set_default_val(self,def_keys,def_val,prof_nm):
for d in def_keys:
kv = Document('DefaultValue')
kv.defkey = d
kv.defvalue = def_val
kv.parent = prof_nm
kv.parenttype = 'Profile'
kv.parentfield = 'defaults'
kv.save(1)

View File

@@ -0,0 +1 @@
[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-07-23 13:32:22', 'search_fields': None, 'module': 'Setup', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': 1, 'read_only': 1, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': 1, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 25, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'Contact Control', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'Administrator', 'name': 'PERM00411', 'parent': 'Contact Control', 'read': 1, 'create': 0, 'creation': '2009-09-09 12:17:33', 'modified': '2010-08-06 22:02:45', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2009-09-09 12:13:02', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Header', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Contact Control', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02926', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-08-06 22:02:45', 'parenttype': 'DocType', 'fieldname': 'header', 'fieldtype': 'Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2009-09-09 12:13:01', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Customer Intro', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Contact Control', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02924', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-08-06 22:02:45', 'parenttype': 'DocType', 'fieldname': 'customer_intro', 'fieldtype': 'Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': None, 'creation': '2009-09-09 12:13:02', 'doctype': 'DocField', 'oldfieldname': None, 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Supplier Intro', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Contact Control', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02925', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-08-06 22:02:45', 'parenttype': 'DocType', 'fieldname': 'supplier_intro', 'fieldtype': 'Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]

View File

View File

@@ -0,0 +1,13 @@
//Tips not required
/*
$import(Tips Common)
//--------- ONLOAD -------------
cur_frm.cscript.onload = function(doc, cdt, cdn) {
cur_frm.cscript.get_tips(doc, cdt, cdn);
}
cur_frm.cscript.refresh = function(doc, cdt, cdn) {
cur_frm.cscript.get_tips(doc, cdt, cdn);
}
*/

View File

@@ -0,0 +1 @@
[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-04-24 10:15:27', 'search_fields': '', 'module': 'Setup', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': 0, 'read_only': 0, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 12, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': 'field:country_name', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'ashwini@webnotestech.com', 'document_type': 'Master', 'name': 'Country', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': None, 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': '', 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': 0, 'amend': 0, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00501', 'parent': 'Country', 'read': 1, 'create': 1, 'creation': '2009-11-04 16:20:24', 'modified': '2010-09-20 09:22:06', 'submit': 0, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'Sales Master Manager', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00765', 'parent': 'Country', 'read': 1, 'create': 1, 'creation': '2010-04-08 14:09:38', 'modified': '2010-09-20 09:22:06', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 2, 'parenttype': 'DocType', 'role': 'Purchase Master Manager', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00829', 'parent': 'Country', 'read': 1, 'create': 1, 'creation': '2010-04-19 10:03:22', 'modified': '2010-09-20 09:22:06', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 3, 'parenttype': 'DocType', 'role': 'HR User', 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00830', 'parent': 'Country', 'read': 1, 'create': 1, 'creation': '2010-04-19 10:03:22', 'modified': '2010-09-20 09:22:06', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 4, 'parenttype': 'DocType', 'role': 'HR Manager', 'owner': 'harshada@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-04-24 10:15:27', 'doctype': 'DocField', 'oldfieldname': 'country_name', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Country Name', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Country', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01929', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-09-20 09:22:06', 'parenttype': 'DocType', 'fieldname': 'country_name', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]

View File

View File

@@ -0,0 +1 @@
[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-03-25 10:32:06', 'search_fields': None, 'module': 'Setup', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': 0, 'read_only': 0, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 4, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': 'field:currency_name', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'saumil@webnotestech.com', 'document_type': '', 'name': 'Currency', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-11-18 16:00:32', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'saumil@webnotestech.com', 'name': 'PERM00294', 'parent': 'Currency', 'read': 1, 'create': 1, 'creation': '2009-05-18 12:54:45', 'modified': '2010-11-18 16:00:32', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'Accounts Manager', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': 0, 'amend': 0, 'execute': None, 'modified_by': 'saumil@webnotestech.com', 'name': 'PERM00247', 'parent': 'Currency', 'read': 1, 'create': 1, 'creation': '2009-03-25 10:32:06', 'modified': '2010-11-18 16:00:32', 'submit': 0, 'doctype': 'DocPerm', 'write': 1, 'idx': 2, 'parenttype': 'DocType', 'role': 'Sales Master Manager', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': 0, 'amend': 0, 'execute': None, 'modified_by': 'saumil@webnotestech.com', 'name': 'PERM00248', 'parent': 'Currency', 'read': 1, 'create': 1, 'creation': '2009-03-25 10:32:06', 'modified': '2010-11-18 16:00:32', 'submit': 0, 'doctype': 'DocPerm', 'write': 1, 'idx': 3, 'parenttype': 'DocType', 'role': 'Purchase Master Manager', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'saumil@webnotestech.com', 'name': 'PERM01235', 'parent': 'Currency', 'read': 1, 'create': 1, 'creation': '2010-11-18 16:00:32', 'modified': '2010-11-18 16:00:32', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 4, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'saumil@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-03-25 10:32:06', 'doctype': 'DocField', 'oldfieldname': 'currency_name', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Currency Name', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Currency', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01465', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-11-18 16:00:32', 'parenttype': 'DocType', 'fieldname': 'currency_name', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]

View File

View File

@@ -0,0 +1,18 @@
$import(Tips Common)
cur_frm.cscript.onload = function(){
cur_frm.cscript.get_tips(doc, cdt, cdn);
if(doc.__islocal){
doc.parent_customer_group = 'Root';
refresh('parent_customer_group');
}
}
cur_frm.cscript.refresh = function(doc, cdt, cdn) {
cur_frm.cscript.get_tips(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';
}

View File

@@ -0,0 +1,45 @@
# 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, removechild, getchildren, make_autoname, SuperDocType
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
# -----------------------------------------------------------------------------------------
class DocType:
def __init__(self, doc, doclist=[]):
self.doc = doc
self.doclist = doclist
self.nsm_parent_field = 'parent_customer_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):
r = sql("select name from `tabCustomer Group` where name = '%s' and docstatus = 2"%(self.doc.customer_group_name))
if r:
msgprint("%s record is trashed. To untrash please go to Setup & click on Trash."%(self.doc.customer_group_name))
raise Exception

File diff suppressed because one or more lines are too long

View File

View File

@@ -0,0 +1,3 @@
cur_frm.cscript['Repost GL'] = function(doc,dt,dn) {
$c_obj('GL Control','repost_gl','',function(r,rt) {alert('Done')});
}

View File

@@ -0,0 +1,131 @@
# 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, removechild, getchildren, make_autoname, SuperDocType
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
# -----------------------------------------------------------------------------------------
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl
def get_bal(self,arg):
bal = sql("select `tabAccount Balance`.balance,`tabAccount`.debit_or_credit from `tabAccount`,`tabAccount Balance` where `tabAccount Balance`.account=%s and `tabAccount Balance`.period=%s and `tabAccount Balance`.account=`tabAccount`.name ",(arg,self.doc.current_fiscal_year))
if bal:
return fmt_money(flt(bal[0][0])) + ' ' + bal[0][1]
else:
return ''
def get_series(self):
self.doc.clear_table(self.doclist, 'series_details')
if self.doc.select_doctype:
sr= sql("Select options from `tabDocField` where fieldname='voucher_series' and parent='%s'"%(self.doc.select_doctype))
if sr:
sr_list=sr[0][0].split("\n")
for x in sr_list:
if cstr(x)!='':
c = addchild(self.doc, 'series_details', 'Series Detail', 1, self.doclist)
c.series=cstr(x)
else:
msgprint("No series is mentioned")
else :
msgprint("Please select Doctype")
def remove_series(self):
if not getlist(self.doclist, 'series_details'):
msgprint("Please pull already existed series for the selected doctype and check the series that you want to remove")
else:
sr= sql("Select options from `tabDocField` where fieldname='voucher_series' and parent='%s'"%(self.doc.select_doctype))
if sr:
sr_list=sr[0][0].split("\n")
for d in getlist(self.doclist, 'series_details'):
if d.remove == 1:
sr_list.remove(d.series)
sql("update `tabDocField` set options='%s' where fieldname='voucher_series' and parent='%s'"%("\n".join(sr_list),self.doc.select_doctype))
self.get_series()
def add_series(self):
if not self.doc.select_doctype or not self.doc.new_series:
msgprint("Please select Doctype and series name for which series will be added")
raise Exception
else:
sr_list = []
sr= sql("select options from `tabDocField` where fieldname='voucher_series' and parent='%s'"% (self.doc.select_doctype))
if sr[0][0]:
sr_list=sr[0][0].split("\n")
self.check_duplicate()
if not sr_list:
sr_list.append('')
sr_list.append(self.get_new_series())
else:
sr_list.append(self.get_new_series())
sql("update `tabDocField` set options='%s' where fieldname='voucher_series' and parent='%s'"%("\n".join(sr_list),self.doc.select_doctype))
self.get_series()
def check_duplicate(self):
sr_list = sql("Select options from `tabDocField` where fieldname='voucher_series' group by parent")
nw_sr = self.get_new_series()
#msgprint(sr_list)
for sr in sr_list:
if nw_sr in sr[0]:
idx=sql("Select current from `tabSeries` where name='%s'"% (nw_sr + '/'))
msgprint("Series name already exist with index '%s'" %(idx[0][0]))
raise Exception
def get_new_series(self):
if 'FY' in cstr((self.doc.new_series).upper()):
abb=sql("select abbreviation from `tabFiscal Year` where name='%s'"%(self.doc.current_fiscal_year))
if not abb:
msgprint("Abbreviation is not mentioned in Fiscal Year")
raise Exception
else:
return cstr((self.doc.new_series).upper()).strip().replace('FY',abb[0][0])
else:
return cstr((self.doc.new_series).upper()).strip()
def on_update(self):
# fiscal year
set_default('fiscal_year', self.doc.current_fiscal_year)
ysd = sql("select year_start_date from `tabFiscal Year` where name=%s", self.doc.current_fiscal_year, as_dict = 1)
set_default('year_start_date', ysd[0]['year_start_date'].strftime('%Y-%m-%d'))
set_default('year_end_date', get_last_day(get_first_day(ysd[0]['year_start_date'],0,11)).strftime('%Y-%m-%d'))
# company
set_default('company', self.doc.default_company)
set_default('stock_valuation', self.doc.stock_valuation or 'Moving Average')
set_default('default_currency', self.doc.default_currency or 'INR')
# Purchase in transit
if self.doc.purchase_in_transit_account:
set_default('purchase_in_transit_account', self.doc.purchase_in_transit_account)
def get_default_bank_account(self, company):
return sql("select default_bank_account from tabCompany where name = '%s'" % company)[0][0]
def get_bank_defaults(self, arg):
arg = eval(arg)
return {
'def_bv_type': self.doc.default_bank_voucher_type or '',
'def_bv_series': self.doc.default_bank_voucher_series or '',
'def_bank_account': self.get_default_bank_account(arg['company']) or '',
'bank_balance': self.get_bal(self.get_default_bank_account(arg['company'])) or 0.0,
'acc_balance': self.get_bal(arg['credit_to']) or 0.0
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,34 @@
# 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, removechild, getchildren, make_autoname, SuperDocType
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
# -----------------------------------------------------------------------------------------
class DocType:
def __init__(self,d,dl):
self.doc, self.doclist = d,dl
def get_master_lst(self):
return [r[0] for r in sql("select name from `tabDocType` where document_type = 'Master'")]
def get_child_lst(self,nm):
res = [nm]
ret=sql("select options from `tabDocField` where parent='%s' and fieldtype = 'Table'"%nm)
for r in ret:
res.append(r[0])
return res

View File

@@ -0,0 +1 @@
[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-09-17 16:54:59', 'search_fields': None, 'module': 'Setup', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'harshada@webnotestech.com', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': 1, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': None, 'max_attachments': None, 'version': 13, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'harshada@webnotestech.com', 'document_type': '', 'name': 'Import Data Control', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-10-14 12:26:41', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}]

View File

View File

@@ -0,0 +1,18 @@
$import(Tips Common)
cur_frm.cscript.onload = function(){
cur_frm.cscript.get_tips(doc, cdt, cdn);
if(doc.__islocal){
doc.parent_item_group = 'Root';
refresh('parent_item_group');
}
}
//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`.`rgt` > '+doc.rgt+' or `tabItem Group`.`lft` < '+doc.lft+') 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) {
cur_frm.cscript.get_tips(doc, cdt, cdn);
}

View File

@@ -0,0 +1,47 @@
# 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, removechild, getchildren, make_autoname, SuperDocType
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
# -----------------------------------------------------------------------------------------
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 (rgt > %s or lft < %s) and name ='%s' and name !='%s'"%(self.doc.rgt,self.doc.lft,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

File diff suppressed because one or more lines are too long

View File

View File

@@ -0,0 +1,6 @@
// Validate
cur_frm.cscript.validate = function(doc, cdt, cdn) {
$c_obj(make_doclist(cdt, cdn), 'update_cp', '', function(r, rt){
sys_defaults = r.message;
});
}

View File

@@ -0,0 +1,65 @@
# Please edit this list and import only required elements
import webnotes
from webnotes.utils import cint, cstr, get_defaults, set_default, fmt_money, get_last_day, get_first_day
from webnotes import session, form, is_testing, msgprint, errprint
sql = webnotes.conn.sql
# -----------------------------------------------------------------------------------------
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl
#---------------------------------------------------------------------------------------------------------------------------------------------
def get_bal(self,arg):
bal = sql("select `tabAccount Balance`.balance,`tabAccount`.debit_or_credit from `tabAccount`,`tabAccount Balance` where `tabAccount Balance`.account=%s and `tabAccount Balance`.period=%s and `tabAccount Balance`.account=`tabAccount`.name ",(arg,self.doc.current_fiscal_year))
if bal:
return fmt_money(flt(bal[0][0])) + ' ' + bal[0][1]
# =========================================================================================================================================
# Update Default
# ---------------
def set_system_default(self, defkey, defvalue):
set_default(defkey, defvalue)
if defkey == 'fiscal_year':
ysd = sql("select year_start_date from `tabFiscal Year` where name=%s", defvalue)
ysd = ysd and ysd[0][0] or ''
if ysd:
set_default('year_start_date', ysd.strftime('%Y-%m-%d'))
set_default('year_end_date', get_last_day(get_first_day(ysd,0,11)).strftime('%Y-%m-%d'))
# Update
# --------
def update_cp(self):
def_list = [['fiscal_year',self.doc.current_fiscal_year],
['company',self.doc.default_company],
['currency',self.doc.default_currency],
['price_list_name',self.doc.default_price_list],
['item_group',self.doc.default_item_group],
['customer_group',self.doc.default_customer_group],
['cust_master_name',self.doc.cust_master_name],
['supplier_type',self.doc.default_supplier_type],
['supp_master_name',self.doc.supp_master_name],
['territory',self.doc.default_territory],
['stock_uom',self.doc.default_stock_uom],
['fraction_currency',self.doc.default_currency_fraction],
['valuation_method',self.doc.default_valuation_method]]
for d in def_list:
self.set_system_default(d[0],d[1])
# Update Currency Format
sql("update `tabSingles` set value = '%s' where field = 'currency_format' and doctype = 'Control Panel'" % self.doc.default_currency_format)
sql("update `tabSingles` set value = '%s' where field = 'date_format' and doctype = 'Control Panel'" %self.doc.date_format)
return get_defaults()

File diff suppressed because it is too large Load Diff

View File

View File

@@ -0,0 +1 @@
[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-03-12 12:10:00', 'search_fields': None, 'module': 'Setup', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': 1, 'read_only': 0, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 1, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': '', 'allow_trash': 1, 'allow_print': None, 'autoname': 'field:segment_name', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'saumil@webnotestech.com', 'document_type': None, 'name': 'Market Segment', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': '', 'modified': '2010-09-20 14:06:57', 'server_code_error': None, 'name_case': 'Title Case', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2010-04-20 14:06:44', 'doctype': 'DocField', 'oldfieldname': 'trash_reason', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Trash Reason', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Market Segment', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04852', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-04-28 11:34:36', 'parenttype': 'DocType', 'fieldname': 'trash_reason', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-03-12 12:10:00', 'doctype': 'DocField', 'oldfieldname': 'segment_name', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Segment Name', 'width': '', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Market Segment', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL00912', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-04-28 11:34:36', 'parenttype': 'DocType', 'fieldname': 'segment_name', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Text', 'creation': '2009-03-12 12:10:00', 'doctype': 'DocField', 'oldfieldname': 'details', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'saumil@webnotestech.com', 'label': 'Details', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Market Segment', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL00913', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-04-28 11:34:36', 'parenttype': 'DocType', 'fieldname': 'details', 'fieldtype': 'Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]

View File

@@ -0,0 +1 @@
[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-04-16 12:55:19', 'search_fields': None, 'module': 'Setup', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': 1, 'read_only': 0, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': None, 'max_attachments': None, 'version': 4, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': '__NSO.#####', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'Naming Series Options', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'Administrator', 'name': 'PERM01027', 'parent': 'Naming Series Options', 'read': 1, 'create': None, 'creation': '2010-06-03 11:30:14', 'modified': '2010-06-03 11:40:21', 'submit': None, 'doctype': 'DocPerm', 'write': None, 'idx': 1, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2010-04-16 12:55:19', 'doctype': 'DocField', 'oldfieldname': 'doc_type', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Doc Type', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Naming Series Options', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04662', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-06-03 11:40:21', 'parenttype': 'DocType', 'fieldname': 'doc_type', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Text', 'creation': '2010-04-16 12:55:19', 'doctype': 'DocField', 'oldfieldname': 'series_options', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Series Options', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Naming Series Options', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04663', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-06-03 11:40:21', 'parenttype': 'DocType', 'fieldname': 'series_options', 'fieldtype': 'Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]

View File

@@ -0,0 +1,10 @@
$import(Tips Common)
//--------- ONLOAD -------------
cur_frm.cscript.onload = function(doc, cdt, cdn) {
cur_frm.cscript.get_tips(doc, cdt, cdn);
}
cur_frm.cscript.refresh = function(doc, cdt, cdn) {
cur_frm.cscript.get_tips(doc, cdt, cdn);
}

View File

@@ -0,0 +1 @@
[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-07-07 10:35:41', 'search_fields': None, 'module': 'Setup', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 5, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': 1, 'allow_print': None, 'autoname': 'field:order_lost_reason', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'ashwini@webnotestech.com', 'document_type': 'Master', 'name': 'Order Lost Reason', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': 1, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00344', 'parent': 'Order Lost Reason', 'read': 1, 'create': 1, 'creation': '2009-07-07 10:35:41', 'modified': '2010-09-20 09:51:33', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': 1, 'amend': 0, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00555', 'parent': 'Order Lost Reason', 'read': 1, 'create': 1, 'creation': '2009-12-31 12:18:01', 'modified': '2010-09-20 09:51:33', 'submit': 0, 'doctype': 'DocPerm', 'write': 1, 'idx': 2, 'parenttype': 'DocType', 'role': 'Sales Master Manager', 'owner': 'saumil@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2010-04-20 14:06:44', 'doctype': 'DocField', 'oldfieldname': 'trash_reason', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Trash Reason', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Order Lost Reason', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04854', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-09-20 09:51:33', 'parenttype': 'DocType', 'fieldname': 'trash_reason', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-07-07 10:35:41', 'doctype': 'DocField', 'oldfieldname': 'order_lost_reason', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Order Lost Reason', 'width': '', 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Order Lost Reason', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL02544', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-09-20 09:51:33', 'parenttype': 'DocType', 'fieldname': 'order_lost_reason', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]

View File

View File

@@ -0,0 +1,29 @@
cur_frm.cscript.onload=function(doc,cdt,cdn){}
cur_frm.pformat.other_charges=function(doc){var make_row=function(title,val,bold){var bstart='<b>';var bend='</b>';return'<tr><td style="width:50%;">'+(bold?bstart:'')+title+(bold?bend:'')+'</td>'
+'<td style="width:25%;text-align:right;">'+doc.currency+'</td>'
+'<td style="width:25%;text-align:right;">'+val+'</td>'
+'</tr>'}
function convert_rate(val){var new_val=flt(val)/flt(doc.conversion_rate);return new_val;}
out='';if(!doc.print_without_amount){var cl=getchildren('RV Tax Detail',doc.name,'other_charges');var out='<div><table class="noborder" style="width:100%"><tr><td style="width: 60%"></td><td>';out+='<table class="noborder" style="width:100%">'+make_row('Net Total',fmt_money(convert_rate(doc.net_total)),1);if(cl.length){for(var i=0;i<cl.length;i++){if(fmt_money(convert_rate(cl[i].tax_amount))!=0)
out+=make_row(cl[i].description,fmt_money(convert_rate(cl[i].tax_amount)),0);}}
out+=make_row('Grand Total',fmt_money(doc.grand_total_export),1)+make_row('Rounded Total',fmt_money(doc.rounded_total_export),1)
if(doc.in_words_export){out+='</table></td></tr>';out+='<tr><td colspan = "2">';out+='<table><tr><td style="width:25%;"><b>In Words</b></td>'
out+='<td style="width:50%;">'+doc.in_words_export+'</td></tr>'}
out+='</table></td></tr></table></div>';}
return out;}
cur_frm.cscript.charge_type=function(doc,cdt,cdn){var d=locals[cdt][cdn];if(d.idx==1&&(d.charge_type=='On Previous Row Amount'||d.charge_type=='On Previous Row Total')){alert("You cannot select Charge Type as 'On Previous Row Amount' or 'On Previous Row Total' for first row");d.charge_type='';}
validated=false;refresh_field('charge_type',d.name,'other_charges');cur_frm.cscript.row_id(doc,cdt,cdn);cur_frm.cscript.rate(doc,cdt,cdn);cur_frm.cscript.tax_amount(doc,cdt,cdn);}
cur_frm.cscript.row_id=function(doc,cdt,cdn){var d=locals[cdt][cdn];if(!d.charge_type&&d.row_id){alert("Please select Charge Type first");d.row_id='';}
else if((d.charge_type=='Actual'||d.charge_type=='On Net Total')&&d.row_id){alert("You can Enter Row only if your Charge Type is 'On Previous Row Amount' or ' Previous Row Total'");d.row_id='';}
else if((d.charge_type=='On Previous Row Amount'||d.charge_type=='On Previous Row Total')&&d.row_id){if(d.row_id>=d.idx){alert("You cannot Enter Row no. greater than or equal to current row no. for this Charge type");d.row_id='';}}
validated=false;refresh_field('row_id',d.name,'other_charges');}
cur_frm.fields_dict['other_charges'].grid.get_field("account_head").get_query=function(doc,cdt,cdn){return'SELECT tabAccount.name FROM tabAccount WHERE tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus != 2 AND (tabAccount.account_type = "Tax" OR tabAccount.account_type = "Chargeable") AND tabAccount.company = "'+doc.company+'" AND tabAccount.name LIKE "%s"'}
cur_frm.cscript.account_head=function(doc,cdt,cdn){var d=locals[cdt][cdn];if(!d.charge_type&&d.account_head){alert("Please select Charge Type first");validated=false;d.account_head='';}
else if(d.account_head&&d.charge_type){arg="{'charge_type' : '"+d.charge_type+"', 'account_head' : '"+d.account_head+"'}";get_server_fields('get_rate',arg,'other_charges',doc,cdt,cdn,1);}
refresh_field('account_head',d.name,'other_charges');}
cur_frm.cscript.rate=function(doc,cdt,cdn){var d=locals[cdt][cdn];if(!d.charge_type&&d.rate){alert("Please select Charge Type first");d.rate='';}
validated=false;refresh_field('rate',d.name,'other_charges');}
cur_frm.cscript.tax_amount=function(doc,cdt,cdn){var d=locals[cdt][cdn];if(!d.charge_type&&d.tax_amount){alert("Please select Charge Type first");d.tax_amount='';}
else if(d.charge_type&&d.tax_amount){alert("You cannot directly enter Amount and if your Charge Type is Actual enter your amount in Rate");d.tax_amount='';}
validated=false;refresh_field('tax_amount',d.name,'other_charges');}

View File

@@ -0,0 +1,139 @@
//--------- ONLOAD -------------
cur_frm.cscript.onload = function(doc, cdt, cdn) {
//cur_frm.cscript.get_tips(doc, cdt, cdn);
}
/*cur_frm.cscript.refresh = function(doc, cdt, cdn) {
cur_frm.cscript.get_tips(doc, cdt, cdn);
}*/
// For customizing print
cur_frm.pformat.other_charges= function(doc){
//function to make row of table
var make_row = function(title,val,bold){
var bstart = '<b>'; var bend = '</b>';
return '<tr><td style="width:50%;">'+(bold?bstart:'')+title+(bold?bend:'')+'</td>'
+'<td style="width:25%;text-align:right;">'+doc.currency+'</td>'
+'<td style="width:25%;text-align:right;">'+val+'</td>'
+'</tr>'
}
function convert_rate(val){
var new_val = flt(val)/flt(doc.conversion_rate);
return new_val;
}
out ='';
if (!doc.print_without_amount) {
var cl = getchildren('RV Tax Detail',doc.name,'other_charges');
// outer table
var out='<div><table class="noborder" style="width:100%"><tr><td style="width: 60%"></td><td>';
// main table
out +='<table class="noborder" style="width:100%">'+make_row('Net Total',fmt_money(convert_rate(doc.net_total)),1);
// add rows
if(cl.length){
for(var i=0;i<cl.length;i++){
if(fmt_money(convert_rate(cl[i].tax_amount))!=0)
out += make_row(cl[i].description,fmt_money(convert_rate(cl[i].tax_amount)),0);
}
}
// grand total
out +=make_row('Grand Total',fmt_money(doc.grand_total_export),1) +make_row('Rounded Total',fmt_money(doc.rounded_total_export),1)
if(doc.in_words_export){
out +='</table></td></tr>';
out += '<tr><td colspan = "2">';
out += '<table><tr><td style="width:25%;"><b>In Words</b></td>'
out+= '<td style="width:50%;">'+doc.in_words_export+'</td></tr>'
}
out +='</table></td></tr></table></div>';
}
return out;
}
cur_frm.cscript.charge_type = function(doc, cdt, cdn) {
var d = locals[cdt][cdn];
if(d.idx == 1 && (d.charge_type == 'On Previous Row Amount' || d.charge_type == 'On Previous Row Total')){
alert("You cannot select Charge Type as 'On Previous Row Amount' or 'On Previous Row Total' for first row");
d.charge_type = '';
}
validated = false;
refresh_field('charge_type',d.name,'other_charges');
cur_frm.cscript.row_id(doc, cdt, cdn);
cur_frm.cscript.rate(doc, cdt, cdn);
cur_frm.cscript.tax_amount(doc, cdt, cdn);
}
cur_frm.cscript.row_id = function(doc, cdt, cdn) {
var d = locals[cdt][cdn];
if(!d.charge_type && d.row_id){
alert("Please select Charge Type first");
d.row_id = '';
}
else if((d.charge_type == 'Actual' || d.charge_type == 'On Net Total') && d.row_id) {
alert("You can Enter Row only if your Charge Type is 'On Previous Row Amount' or ' Previous Row Total'");
d.row_id = '';
}
else if((d.charge_type == 'On Previous Row Amount' || d.charge_type == 'On Previous Row Total') && d.row_id){
if(d.row_id >= d.idx){
alert("You cannot Enter Row no. greater than or equal to current row no. for this Charge type");
d.row_id = '';
}
}
validated = false;
refresh_field('row_id',d.name,'other_charges');
}
/*---------------------- Get rate if account_head has account_type as TAX or CHARGEABLE-------------------------------------*/
cur_frm.fields_dict['other_charges'].grid.get_field("account_head").get_query = function(doc,cdt,cdn) {
return 'SELECT tabAccount.name FROM tabAccount WHERE tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus != 2 AND (tabAccount.account_type = "Tax" OR tabAccount.account_type = "Chargeable") AND tabAccount.company = "'+doc.company+'" AND tabAccount.name LIKE "%s"'
}
//--------------------filter other charges master company-wise-----------------------------------------
/*
cur_frm.fields_dict.charge.get_query = function(doc) {
return 'SELECT DISTINCT `tabOther Charges`.name FROM `tabOther Charges` WHERE `tabOther Charges`.company = "'+doc.company+'" AND `tabOther Charges`.company is not NULL AND `tabOther Charges`.name LIKE "%s" ORDER BY `tabOther Charges`.name LIMIT 50';
}
*/
cur_frm.cscript.account_head = function(doc, cdt, cdn) {
var d = locals[cdt][cdn];
if(!d.charge_type && d.account_head){
alert("Please select Charge Type first");
validated = false;
d.account_head = '';
}
else if(d.account_head && d.charge_type) {
arg = "{'charge_type' : '" + d.charge_type +"', 'account_head' : '" + d.account_head + "'}";
get_server_fields('get_rate', arg, 'other_charges', doc, cdt, cdn, 1);
}
refresh_field('account_head',d.name,'other_charges');
}
cur_frm.cscript.rate = function(doc, cdt, cdn) {
var d = locals[cdt][cdn];
if(!d.charge_type && d.rate) {
alert("Please select Charge Type first");
d.rate = '';
}
validated = false;
refresh_field('rate',d.name,'other_charges');
}
cur_frm.cscript.tax_amount = function(doc, cdt, cdn) {
var d = locals[cdt][cdn];
if(!d.charge_type && d.tax_amount){
alert("Please select Charge Type first");
d.tax_amount = '';
}
else if(d.charge_type && d.tax_amount) {
alert("You cannot directly enter Amount and if your Charge Type is Actual enter your amount in Rate");
d.tax_amount = '';
}
validated = false;
refresh_field('tax_amount',d.name,'other_charges');
}

View File

@@ -0,0 +1,34 @@
# 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, removechild, getchildren, make_autoname, SuperDocType
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
# -----------------------------------------------------------------------------------------
class DocType:
def __init__(self, doc, doclist=[]):
self.doc = doc
self.doclist = doclist
# Get Tax Rate if account type is Tax
# ===================================================================
def get_rate(self, arg):
get_obj('Sales Common').get_rate(arg, self)
def update_other_default_charges(self):
sql("update `tabOther Charges` set is_default = 0 where ifnull(is_default,0) = 1 and name != '%s' and company = '%s'" % (self.doc.name, self.doc.company))
def on_update(self):
self.update_other_default_charges()

File diff suppressed because one or more lines are too long

View File

View File

@@ -0,0 +1,10 @@
$import(Tips Common)
//--------- ONLOAD -------------
cur_frm.cscript.onload = function(doc, cdt, cdn) {
cur_frm.cscript.get_tips(doc, cdt, cdn);
}
cur_frm.cscript.refresh = function(doc, cdt, cdn) {
cur_frm.cscript.get_tips(doc, cdt, cdn);
}

File diff suppressed because one or more lines are too long

View File

View File

@@ -0,0 +1,61 @@
# 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, removechild, getchildren, make_autoname, SuperDocType
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
# -----------------------------------------------------------------------------------------
class DocType:
def __init__(self,d,dl):
self.doc, self.doclist = d, dl
# Generate Periods
#------------------
def generate_periods(self, fy):
ml = ('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec')
import webnotes.utils
from dateutil.relativedelta import relativedelta
if not sql("select name from `tabPeriod` where fiscal_year = '%s'" % fy):
ysd = sql("select year_start_date from `tabFiscal Year` where name = '%s'"%fy)[0][0]
#create period as fiscal year record name
#----------------------------------------------
arg = {'pn':fy,'sd':ysd,'ed':webnotes.utils.get_last_day(ysd + relativedelta(months=11)).strftime('%Y-%m-%d'),'pt':'Year','fy':fy}
self.create_period(arg)
for i in range(12):
msd = ysd + relativedelta(months=i)
arg = {'pn':ml[cint(msd.strftime('%m'))-1] + ' ' + msd.strftime('%Y'),'sd':msd.strftime('%Y-%m-%d'),'ed':webnotes.utils.get_last_day(msd).strftime('%Y-%m-%d'),'pt':'Month','fy':fy}
self.create_period(arg)
#---------------------------------------------------------
#create period common function
def create_period(self,arg):
p = Document('Period')
p.period_name = arg['pn']
p.start_date = arg['sd']
p.end_date = arg['ed']
p.period_type = arg['pt']
p.fiscal_year = arg['fy']
try:
p.save(1)
except NameError, e:
msgprint('Period %s already exists' % p.period_name)
raise Exception

View File

@@ -0,0 +1 @@
[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-05-27 12:47:10', 'search_fields': None, 'module': 'Setup', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'nabin@webnotestech.com', 'in_dialog': None, 'in_create': 1, 'read_only': 1, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': 1, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': None, 'max_attachments': None, 'version': 36, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'harshada@webnotestech.com', 'document_type': None, 'name': 'Period Control', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}]

View File

View File

@@ -0,0 +1,31 @@
import webnotes
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl
#
# load current banner
#
def onload(self):
self.doc.header_html = webnotes.conn.get_value('Control Panel', None, 'client_name')
#
# on update
#
def validate(self):
if self.doc.file_list and self.doc.set_from_attachment:
self.set_html_from_image()
# update control panel - so it loads new letter directly
webnotes.conn.set_value('Control Panel', None, 'client_name', self.doc.header_html)
# clear the cache so that the new letter head is uploaded
webnotes.conn.sql("delete from __SessionCache")
#
# set html for image
#
def set_html_from_image(self):
file_name = self.doc.file_list.split(',')[0]
self.doc.header_html = '<div><img src="cgi-bin/getfile.cgi?name=' + file_name + '"/></div>'

View File

@@ -0,0 +1,196 @@
[
{
'_last_update': None,
'allow_attach': 1,
'allow_copy': 1,
'allow_email': 1,
'allow_print': 1,
'allow_rename': None,
'allow_trash': None,
'autoname': None,
'change_log': None,
'client_script': None,
'client_script_core': None,
'client_string': None,
'colour': 'White:FFF',
'creation': '2011-05-09 10:50:47',
'description': None,
'docstatus': 0,
'doctype': 'DocType',
'document_type': 'Other',
'dt_template': None,
'hide_heading': None,
'hide_toolbar': None,
'idx': None,
'in_create': 1,
'in_dialog': None,
'is_transaction_doc': None,
'issingle': 1,
'istable': None,
'max_attachments': 1,
'menu_index': None,
'modified': '2011-03-17 12:20:29',
'modified_by': 'Administrator',
'module': 'Setup',
'name': 'Personalize',
'name_case': None,
'owner': 'Administrator',
'parent': None,
'parent_node': None,
'parentfield': None,
'parenttype': None,
'print_outline': None,
'read_only': 1,
'read_only_onload': None,
'search_fields': None,
'section_style': 'Simple',
'server_code': None,
'server_code_compiled': None,
'server_code_core': None,
'server_code_error': None,
'show_in_menu': None,
'smallicon': None,
'use_template': None,
'version': 4
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2011-05-09 10:50:47',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': None,
'fieldtype': 'HTML',
'hidden': None,
'icon': None,
'idx': 1,
'in_filter': None,
'label': 'Help HTML',
'modified': '2011-05-09 10:50:47',
'modified_by': 'Administrator',
'name': '000000158',
'no_copy': None,
'oldfieldname': None,
'oldfieldtype': None,
'options': '<div class="help_box">You can edit HTML for your banner or add an attachment and click on "Set from Attachment"</div>',
'owner': 'Administrator',
'parent': 'Personalize',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': None
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2011-05-09 10:50:47',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'header_html',
'fieldtype': 'Code',
'hidden': None,
'icon': None,
'idx': 2,
'in_filter': None,
'label': 'Banner HTML',
'modified': '2011-05-09 10:50:47',
'modified_by': 'Administrator',
'name': '000000159',
'no_copy': None,
'oldfieldname': None,
'oldfieldtype': None,
'options': None,
'owner': 'Administrator',
'parent': 'Personalize',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': None
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2011-05-09 10:50:47',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'set_from_attachment',
'fieldtype': 'Check',
'hidden': None,
'icon': None,
'idx': 3,
'in_filter': None,
'label': 'Set from attachment',
'modified': '2011-05-09 10:50:47',
'modified_by': 'Administrator',
'name': '000000160',
'no_copy': None,
'oldfieldname': None,
'oldfieldtype': None,
'options': None,
'owner': 'Administrator',
'parent': 'Personalize',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': None
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2011-05-09 10:50:47',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'file_list',
'fieldtype': 'Text',
'hidden': 1,
'icon': None,
'idx': 4,
'in_filter': None,
'label': 'File List',
'modified': '2011-05-09 10:50:47',
'modified_by': 'Administrator',
'name': '000000161',
'no_copy': None,
'oldfieldname': None,
'oldfieldtype': None,
'options': None,
'owner': 'Administrator',
'parent': 'Personalize',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': None
}
]

View File

View File

@@ -0,0 +1,21 @@
//--------- 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;
}
if(!doc.file_list) {
set_field_options('Price Help', '<div class="help_box">To upload a price list, please attach a (.csv) file with 3 columns - <b>Item Code, Price and Currency</b> (no headings necessary). See attachments box in the right column</div>')
} else {
set_field_options('Price Help', '<div class="help_box">To update prices from the attachment, please click on "Update Prices"</div>')
}
}
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([doc], 'clear_prices', '', function(r, rt) { });
}
}

View File

@@ -0,0 +1,92 @@
# 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, removechild, getchildren, make_autoname, SuperDocType
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
# -----------------------------------------------------------------------------------------
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl
self.cl = []
# validate currency
def is_currency_valid(self, currency):
if currency in self.cl:
return 1
if sql("select name from tabCurrency where name=%s", currency):
self.cl.append(currency)
return 1
else:
return 0
# update prices in Price List
def update_prices(self):
import csv
data = csv.reader(self.get_csv_data().splitlines())
updated = 0
for line in data:
if len(line)==3:
# if item exists
if 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 `tabRef Rate Detail` 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 `tabRef Rate Detail` set ref_rate=%s where name=%s", (line[1], ref_ret_detail[0][0]))
else:
d = Document('Ref Rate Detail')
d.parent = line[0]
d.parentfield = 'ref_rate_details'
d.parenttype = 'Item'
d.price_list_name = self.doc.name
d.ref_rate = line[1]
d.ref_currency = line[2]
d.save(1)
updated += 1
else:
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("<b>%s</b> items updated" % updated)
# clear prices
def clear_prices(self):
cnt = sql("select count(*) from `tabRef Rate Detail` where price_list_name = %s", self.doc.name)
sql("delete from `tabRef Rate Detail` 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:
msgprint("File not attached!")
raise Exception
fid = self.doc.file_list.split(',')[1]
from webnotes.utils import file_manager
fn, content = file_manager.get_file(fid)
if not type(content) == str:
content = content.tostring()
return content

View File

@@ -0,0 +1,380 @@
[
{
'allow_attach': 1,
'allow_copy': None,
'allow_email': None,
'allow_print': None,
'allow_rename': None,
'allow_trash': 1,
'autoname': 'field:price_list_name',
'change_log': None,
'client_script': None,
'client_script_core': None,
'client_string': None,
'colour': 'White:FFF',
'creation': '2010-08-08 17:09:13',
'description': None,
'docstatus': 0,
'doctype': 'DocType',
'document_type': 'Master',
'dt_template': None,
'hide_heading': None,
'hide_toolbar': None,
'idx': None,
'in_create': None,
'in_dialog': None,
'is_transaction_doc': None,
'issingle': None,
'istable': None,
'max_attachments': None,
'menu_index': None,
'modified': '2011-04-18 10:01:48',
'modified_by': 'Administrator',
'module': 'Setup',
'name': 'Price List',
'name_case': None,
'owner': 'Administrator',
'parent': None,
'parent_node': None,
'parentfield': None,
'parenttype': None,
'print_outline': None,
'read_only': None,
'read_only_onload': None,
'search_fields': None,
'section_style': 'Simple',
'server_code': None,
'server_code_compiled': None,
'server_code_core': None,
'server_code_error': ' ',
'show_in_menu': 0,
'smallicon': None,
'use_template': None,
'version': 6
},
{
'amend': 0,
'cancel': 0,
'create': 0,
'creation': '2010-08-08 17:09:13',
'docstatus': 0,
'doctype': 'DocPerm',
'execute': None,
'idx': 1,
'match': None,
'modified': '2010-08-08 17:09:13',
'modified_by': 'Administrator',
'name': 'PERM00392',
'owner': 'Administrator',
'parent': 'Price List',
'parentfield': 'permissions',
'parenttype': 'DocType',
'permlevel': 1,
'read': 1,
'role': 'Sales Manager',
'submit': 0,
'write': 0
},
{
'amend': 0,
'cancel': 0,
'create': 0,
'creation': '2010-08-08 17:09:13',
'docstatus': 0,
'doctype': 'DocPerm',
'execute': None,
'idx': 2,
'match': None,
'modified': '2010-08-08 17:09:13',
'modified_by': 'Administrator',
'name': 'PERM00393',
'owner': 'Administrator',
'parent': 'Price List',
'parentfield': 'permissions',
'parenttype': 'DocType',
'permlevel': 0,
'read': 1,
'role': 'Sales Manager',
'submit': 0,
'write': 0
},
{
'amend': 0,
'cancel': 0,
'create': 0,
'creation': '2010-08-08 17:09:13',
'docstatus': 0,
'doctype': 'DocPerm',
'execute': None,
'idx': 3,
'match': None,
'modified': '2010-08-08 17:09:13',
'modified_by': 'Administrator',
'name': 'PERM00394',
'owner': 'Administrator',
'parent': 'Price List',
'parentfield': 'permissions',
'parenttype': 'DocType',
'permlevel': 1,
'read': 1,
'role': 'Sales User',
'submit': 0,
'write': 0
},
{
'amend': 0,
'cancel': 0,
'create': 0,
'creation': '2010-08-08 17:09:13',
'docstatus': 0,
'doctype': 'DocPerm',
'execute': None,
'idx': 4,
'match': None,
'modified': '2010-08-08 17:09:13',
'modified_by': 'Administrator',
'name': 'PERM00395',
'owner': 'Administrator',
'parent': 'Price List',
'parentfield': 'permissions',
'parenttype': 'DocType',
'permlevel': 0,
'read': 1,
'role': 'Sales User',
'submit': 0,
'write': 0
},
{
'amend': 0,
'cancel': 1,
'create': 1,
'creation': '2010-08-08 17:09:13',
'docstatus': 0,
'doctype': 'DocPerm',
'execute': None,
'idx': 5,
'match': '',
'modified': '2010-08-08 17:09:13',
'modified_by': 'Administrator',
'name': 'PERM00396',
'owner': 'Administrator',
'parent': 'Price List',
'parentfield': 'permissions',
'parenttype': 'DocType',
'permlevel': 0,
'read': 1,
'role': 'Sales Master Manager',
'submit': 0,
'write': 1
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2010-08-08 17:09:13',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'trash_reason',
'fieldtype': 'Small Text',
'hidden': None,
'icon': None,
'idx': 1,
'in_filter': None,
'label': 'Trash Reason',
'modified': '2011-04-18 13:55:33',
'modified_by': 'Administrator',
'name': 'FL02242',
'no_copy': None,
'oldfieldname': 'trash_reason',
'oldfieldtype': 'Small Text',
'options': None,
'owner': 'Administrator',
'parent': 'Price List',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 1,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': None
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2010-08-08 17:09:13',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'price_list_name',
'fieldtype': 'Data',
'hidden': None,
'icon': None,
'idx': 2,
'in_filter': None,
'label': 'Price List Name',
'modified': '2011-04-18 13:55:33',
'modified_by': 'Administrator',
'name': 'FL02243',
'no_copy': None,
'oldfieldname': 'price_list_name',
'oldfieldtype': 'Data',
'options': None,
'owner': 'Administrator',
'parent': 'Price List',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': 1,
'search_index': None,
'trigger': None,
'width': None
},
{
'allow_on_submit': None,
'colour': 'White:FFF',
'creation': '2011-04-18 13:55:34',
'default': None,
'depends_on': 'eval:!doc.__islocal',
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': None,
'fieldtype': 'HTML',
'hidden': None,
'icon': None,
'idx': 3,
'in_filter': None,
'label': 'Price Help',
'modified': '2011-04-18 13:55:34',
'modified_by': 'Administrator',
'name': '000000143',
'no_copy': None,
'oldfieldname': None,
'oldfieldtype': None,
'options': None,
'owner': 'Administrator',
'parent': 'Price List',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': None
},
{
'allow_on_submit': None,
'colour': 'White:FFF',
'creation': '2011-04-18 13:55:33',
'default': None,
'depends_on': 'eval:!doc.__islocal',
'description': 'Click on this button to clear prices for this list in all items',
'docstatus': 0,
'doctype': 'DocField',
'fieldname': None,
'fieldtype': 'Button',
'hidden': None,
'icon': None,
'idx': 4,
'in_filter': None,
'label': 'Clear Prices',
'modified': '2011-04-18 13:55:33',
'modified_by': 'Administrator',
'name': '000000140',
'no_copy': None,
'oldfieldname': None,
'oldfieldtype': None,
'options': None,
'owner': 'Administrator',
'parent': 'Price List',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': 'Client',
'width': None
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2011-04-18 13:55:34',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'file_list',
'fieldtype': 'Text',
'hidden': 1,
'icon': None,
'idx': 5,
'in_filter': None,
'label': 'File List',
'modified': '2011-04-18 13:55:34',
'modified_by': 'Administrator',
'name': '000000141',
'no_copy': None,
'oldfieldname': None,
'oldfieldtype': None,
'options': None,
'owner': 'Administrator',
'parent': 'Price List',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': None
},
{
'allow_on_submit': None,
'colour': 'White:FFF',
'creation': '2011-04-18 13:55:34',
'default': None,
'depends_on': 'eval:!doc.__islocal',
'description': 'Update prices from the attachment',
'docstatus': 0,
'doctype': 'DocField',
'fieldname': None,
'fieldtype': 'Button',
'hidden': None,
'icon': None,
'idx': 6,
'in_filter': None,
'label': 'Update Prices',
'modified': '2011-04-18 13:55:34',
'modified_by': 'Administrator',
'name': '000000142',
'no_copy': None,
'oldfieldname': None,
'oldfieldtype': None,
'options': 'update_prices',
'owner': 'Administrator',
'parent': 'Price List',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': 'Server',
'width': None
}
]

View File

@@ -0,0 +1,215 @@
# 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, removechild, getchildren, make_autoname, SuperDocType
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
# -----------------------------------------------------------------------------------------
class DocType:
def __init__(self,doc,doclist=[]):
self.doc = doc
self.doclist = doclist
#=============================================================================================
def get_record_list(self,arg):
parent, type = arg.split(',')
pt_col = "parent_"+type.replace(' ','_').lower()
cl = sql("select name,is_group from `tab%s` where docstatus != 2 and %s ='%s' order by is_group desc"%(type,pt_col,parent),as_dict=1)
return {'parent':parent, 'cl':cl}
#=============================================================================================
# --------get root level records like all territories, all sales person etc---------
def get_fl_node(self,arg):
pt_col = "parent_"+arg.replace(' ','_').lower()
cl = sql("select name,is_group from `tab%s` where docstatus !=2 and %s=''"%(arg,pt_col),as_dict=1)
return {'cl':cl}
#=============================================================================================
def add_node(self,arg):
arg = eval(arg)
node_title = arg['node_title']
n = Document(node_title)
for d in arg.keys():
if d != 'node_title':
n.fields[d]=arg[d]
n.old_parent = ''
n_obj = get_obj(doc=n)
n_obj.validate()
n_obj.doc.save(1)
n_obj.on_update()
return n_obj.doc.name
#=============================================================================================
def trash_record(self,arg):
name,type = arg.split(',')
#validation for trash of default record
if not type == 'Sales Person':
field = 'default_'+type.lower().replace(' ','_')
chk = sql("select value from `tabSingles` where doctype = 'Manage Account' and field = '%s' and value = '%s'"%(field,name))
if chk:
msgprint("'%s' record is set as a default %s in Global Defaults. Please change default %s then try to trash '%s' record."%(name,type.lower(), type.lower(), name))
raise Exception
res = sql("select t1.name from `tab%s` t1, `tab%s` t2 where t1.lft > t2.lft and t1.rgt < t2.rgt and t1.docstatus != 2 and t2.name = '%s'"%(type,type,name))
if res:
msgprint("You can not trashed %s as it contains other nodes."%name)
raise Exception
sql("update `tab%s` set docstatus = 2 where name = '%s'"%(type,name))
#=============================================================================================
def get_parent_lst(self,type):
par_lst = [r[0] for r in sql("select name from `tab%s` where is_group = 'Yes' and docstatus != 2"%type)]
return par_lst
#=============================================================================================
def get_record(self,arg):
name, type = arg.split(',')
dict1 = {'Territory':'parent_territory','Customer Group':'parent_customer_group','Item Group':'parent_item_group','Sales Person':'parent_sales_person'}
parent_name = dict1[type]
query ="select name,"+dict1[type]+",is_group,rgt,lft from `tab"+cstr(type)+"` where name = '%s'"
sv = sql(query%(cstr(name)))
par_lst = [r[0] for r in sql("select distinct name from `tab"+cstr(type)+"` where docstatus !=2 and (rgt > %s or lft < %s) and is_group='Yes'"%(sv[0][3],sv[0][4]))]
dict2 = {}
dict2['name']=sv[0][0]
dict2['parent']=cstr(sv[0][1])
dict2['parent_lst']=par_lst
dict2['is_group']=sv[0][2]
return dict2
#=============================================================================================
def edit_node(self,arg):
arg = eval(arg)
nt = arg['node_title']
nm = nt == 'Territory' and arg['territory_name'] or nt == 'Sales Person' and arg['sales_person_name'] or nt=='Item Group' and arg['item_group_name'] or nt =='Customer Group' and arg['customer_group_name'] or ''
n_obj = get_obj(nt,nm)
for d in arg.keys():
if d != 'node_title':
n_obj.doc.fields[d]=arg[d]
n_obj.doc.save()
n_obj.on_update()
#=============== validation ======================================================================================
def mvalidate(self,args):
r = eval(args)
if r['lft'] == 0:
n = sql("select lft,rgt from `tab%s` where name = '%s'"%(r['node_title'],r['nm']))
r['lft'] = n[0][0]
r['rgt'] = n[0][1]
if r['action'] == 'Update':
#-----------------validate if current node has child node----------------------------------
v1 = self.val_group(r)
if v1 == 'true': return 'true'
#-------------------validation for parent sales person cannot be his child node------------
v1 = self.val_prt(r)
if v1 == 'true': return 'true'
#--------if current record has set as default record in manage account then should not allow to change 'has child node' to 'yes'
v1 = self.group_changed(r)
if v1 == 'true': return 'true'
elif r['action'] == 'Create':
#-------------------validation - record is already exist--------------------------------
v1 = self.duplicate_rcd(r)
if v1 == 'true': return 'true'
#-------------------------------------------------
v1 = self.trash_rcd(r)
if v1 == 'true': return 'true'
return 'false'
#-----------------validate if current node has child node----------------------------------
#------------------if yes then cannot change current node from group to leaf
#ON EDIT
def val_group(self,r):
if r['is_group'] == 'No':
ch = sql("select name from `tab%s` where lft>%s and rgt<%s and docstatus != 2"%(r['node_title'],r['lft'],r['rgt']))
if ch:
msgprint("You can not changed %s from group to leaf node as it contains other nodes."%r['nm'])
return 'true'
return 'false'
#-------------------validation for parent sales person cannot be his child node-------------
#ON EDIT
def val_prt(self,r):
res = sql("select name from `tab%s` where is_group = 'Yes' and docstatus!= 2 and (rgt > %s or lft < %s) and name ='%s' and name !='%s'"%(r['node_title'],r['rgt'],r['lft'],r['parent_nm'],r['nm']))
if not res:
msgprint("Please enter parent %s."%(r['node_title']))
return 'true'
return 'false'
#--------if current record has set as default record then not allowed to changed 'has child node' to 'yes'--------------------
#--------------------------------------------------------
#ON EDIT
def group_changed(self,r):
if r['node_title'] != 'Sales Person' and r['is_group'] == 'Yes':
field = 'default_'+r['node_title'].lower().replace(' ','_')
res = sql("select value from `tabSingles` where field = '%s' and value = '%s'"%(field,r['nm']))
if res:
msgprint("'%s' record is set as default record in Global Defaults.'Has Child Node' field cannot be changed to 'Yes' as only leaf nodes are allowed in transaction."%(r['nm']))
return 'true'
return 'false'
#-------------------validation - record is already exist--------------------------------
#ON CREATE
def trash_rcd(self,r):
res = sql("select name from `tab%s` where name = '%s' and docstatus = 2"%(r['node_title'],r['nm']))
if res:
msgprint("'%s' record is trashed. To untrash please go to Setup & click on Trash."%(r['nm']))
return 'true'
return 'false'
#----------------------------------------------------------------
#ON CREATE
def duplicate_rcd(self,r):
res = sql("select name from `tab%s` where name = '%s' and docstatus != 2"%(r['node_title'],r['nm']))
if res:
msgprint("'%s' record is already exist."%(r['nm']))
return 'true'
return 'false'

View File

@@ -0,0 +1 @@
[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-06-17 15:07:09', 'search_fields': None, 'module': 'Setup', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': 1, 'allow_rename': None, 'smallicon': None, 'allow_attach': None, 'show_in_menu': None, 'max_attachments': None, 'version': 157, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'harshada@webnotestech.com', 'document_type': None, 'name': 'Sales Browser Control', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}]

View File

View File

@@ -0,0 +1,148 @@
$import(Contact Control)
cur_frm.cscript.onload = function(doc,dt,dn){
// history doctypes and scripts
cur_frm.history_dict = {
'Sales Order' : 'cur_frm.cscript.make_so_list(this.body, this.doc)',
'Delivery Note' : 'cur_frm.cscript.make_dn_list(this.body, this.doc)',
'Sales Invoice' : 'cur_frm.cscript.make_si_list(this.body, this.doc)'
}
// make contact, history list body
//cur_frm.cscript.make_cl_body();
cur_frm.cscript.make_hl_body();
}
cur_frm.cscript.refresh = function(doc,dt,dn){
if(doc.__islocal){
hide_field(['Address HTML','Contact HTML']);
//cur_frm.cscript.set_cl_msg(doc);
//cur_frm.cscript.set_hl_msg(doc);
}
else{
unhide_field(['Address HTML','Contact HTML']);
// make lists
cur_frm.cscript.make_address(doc,dt,dn);
cur_frm.cscript.make_contact(doc,dt,dn);
cur_frm.cscript.make_history(doc,dt,dn);
}
}
cur_frm.cscript.make_address = function() {
if(!cur_frm.address_list) {
cur_frm.address_list = new wn.widgets.Listing({
parent: cur_frm.fields_dict['Address HTML'].wrapper,
page_length: 2,
new_doctype: "Address",
new_doc_onload: function(dn) {
ndoc = locals["Address"][dn];
ndoc.sales_partner = cur_frm.doc.name;
ndoc.address_type = 'Office';
},
new_doc_onsave: function(dn) {
cur_frm.address_list.run()
},
get_query: function() {
return "select name, address_type, address_line1, address_line2, city, state, country, pincode, fax, email_id, phone, is_primary_address, is_shipping_address from tabAddress where sales_partner='"+cur_frm.docname+"' and docstatus != 2 order by is_primary_address desc"
},
as_dict: 1,
no_results_message: 'No addresses created',
render_row: function(wrapper, data) {
$(wrapper).css('padding','5px 0px');
var link = $ln(wrapper,cstr(data.name), function() { loaddoc("Address", this.dn); }, {fontWeight:'bold'});
link.dn = data.name
$a(wrapper,'span','',{marginLeft:'5px', color: '#666'},(data.is_primary_address ? '[Primary]' : '') + (data.is_shipping_address ? '[Shipping]' : ''));
$a(wrapper,'div','',{marginTop:'5px', color:'#555'}, data.address_line1 + '<br />' + (data.address_line2 ? data.address_line2 + '<br />' : '') + data.city + '<br />' + (data.state ? data.state + ', ' : '') + data.country + '<br />' + (data.pincode ? 'Pincode: ' + data.pincode + '<br />' : '') + (data.phone ? 'Tel: ' + data.phone + '<br />' : '') + (data.fax ? 'Fax: ' + data.fax + '<br />' : '') + (data.email_id ? 'Email: ' + data.email_id + '<br />' : ''));
}
});
}
cur_frm.address_list.run();
}
cur_frm.cscript.make_contact = function() {
if(!cur_frm.contact_list) {
cur_frm.contact_list = new wn.widgets.Listing({
parent: cur_frm.fields_dict['Contact HTML'].wrapper,
page_length: 2,
new_doctype: "Contact",
new_doc_onload: function(dn) {
ndoc = locals["Contact"][dn];
ndoc.sales_partner = cur_frm.doc.name;
},
new_doc_onsave: function(dn) {
cur_frm.contact_list.run()
},
get_query: function() {
return "select name, first_name, last_name, email_id, phone, mobile_no, department, designation, is_primary_contact from tabContact where sales_partner='"+cur_frm.docname+"' and docstatus != 2 order by is_primary_contact desc"
},
as_dict: 1,
no_results_message: 'No contacts created',
render_row: function(wrapper, data) {
$(wrapper).css('padding', '5px 0px');
var link = $ln(wrapper, cstr(data.name), function() { loaddoc("Contact", this.dn); }, {fontWeight:'bold'});
link.dn = data.name
$a(wrapper,'span','',{marginLeft:'5px', color: '#666'},(data.is_primary_contact ? '[Primary]' : ''));
$a(wrapper,'div', '',{marginTop:'5px', color:'#555'}, data.first_name + (data.last_name ? ' ' + data.last_name + '<br />' : '<br>') + (data.phone ? 'Tel: ' + data.phone + '<br />' : '') + (data.mobile_no ? 'Mobile: ' + data.mobile_no + '<br />' : '') + (data.email_id ? 'Email: ' + data.email_id + '<br />' : '') + (data.department ? 'Department: ' + data.department + '<br />' : '') + (data.designation ? 'Designation: ' + data.designation + '<br />' : ''));
}
});
}
cur_frm.contact_list.run();
}
// ******************** 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 = ['','Receivable Voucher','','','',''];
cur_frm.cscript.set_list_opts(lst);
var q = repl("select name,posting_date, total_commission,grand_total from `tabReceivable Voucher` where sales_partner='%(sp)s'", {'sp':doc.name});
var q_max = repl("select count(name) from `tabReceivable Voucher` where sales_partner='%(cust)s'", {'sp':doc.name});
cur_frm.cscript.run_list(lst,parent,q,q_max,doc,'Sales Invoice','Receivable Voucher');
}

View File

@@ -0,0 +1,48 @@
# 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, removechild, getchildren, make_autoname, SuperDocType
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
# -----------------------------------------------------------------------------------------
class DocType:
def __init__(self, doc, doclist=[]):
self.doc = doc
self.doclist = doclist
self.prefix = is_testing and 'test' or 'tab'
def validate(self):
import string
if not (self.doc.address_line1) and not (self.doc.address_line2) and not (self.doc.city) and not (self.doc.state) and not (self.doc.country) and not (self.doc.pincode):
return "Please enter address"
else:
address =["address_line1", "address_line2", "city", "state", "country", "pincode"]
comp_address=''
for d in address:
if self.doc.fields[d]:
comp_address += self.doc.fields[d] + "\n"
self.doc.address = comp_address
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)])
def get_contacts(self,nm):
if nm:
contact_details =convert_to_lists(sql("select name, CONCAT(IFNULL(first_name,''),' ',IFNULL(last_name,'')),contact_no,email_id from `tabContact` where sales_partner = '%s'"%nm))
return contact_details
else:
return ''

View File

@@ -0,0 +1,927 @@
[
{
'_last_update': '1305622930',
'_user_tags': None,
'allow_attach': None,
'allow_copy': None,
'allow_email': None,
'allow_print': None,
'allow_rename': None,
'allow_trash': 1,
'autoname': 'field:partner_name',
'change_log': None,
'client_script': None,
'client_script_core': None,
'client_string': None,
'colour': 'White:FFF',
'creation': '2010-08-08 17:09:22',
'description': None,
'docstatus': 0,
'doctype': 'DocType',
'document_type': 'Master',
'dt_template': None,
'hide_heading': None,
'hide_toolbar': None,
'idx': None,
'in_create': 0,
'in_dialog': None,
'is_transaction_doc': None,
'issingle': None,
'istable': None,
'max_attachments': None,
'menu_index': None,
'modified': '2011-05-17 14:32:10',
'modified_by': 'Guest',
'module': 'Setup',
'name': 'Sales Partner',
'name_case': None,
'owner': 'Administrator',
'parent': None,
'parent_node': None,
'parentfield': None,
'parenttype': None,
'print_outline': None,
'read_only': 0,
'read_only_onload': None,
'search_fields': None,
'section_style': 'Tabbed',
'server_code': None,
'server_code_compiled': None,
'server_code_core': None,
'server_code_error': ' ',
'show_in_menu': 0,
'smallicon': None,
'subject': None,
'tag_fields': None,
'use_template': None,
'version': 72
},
{
'amend': 0,
'cancel': 0,
'create': 0,
'creation': '2010-08-08 17:09:22',
'docstatus': 0,
'doctype': 'DocPerm',
'execute': None,
'idx': 1,
'match': None,
'modified': '2010-08-08 17:09:22',
'modified_by': 'Administrator',
'name': 'PERM00504',
'owner': 'Administrator',
'parent': 'Sales Partner',
'parentfield': 'permissions',
'parenttype': 'DocType',
'permlevel': 1,
'read': 1,
'role': 'Sales Manager',
'submit': 0,
'write': 0
},
{
'amend': 0,
'cancel': 0,
'create': 0,
'creation': '2010-08-08 17:09:22',
'docstatus': 0,
'doctype': 'DocPerm',
'execute': None,
'idx': 2,
'match': None,
'modified': '2010-08-08 17:09:22',
'modified_by': 'Administrator',
'name': 'PERM00505',
'owner': 'Administrator',
'parent': 'Sales Partner',
'parentfield': 'permissions',
'parenttype': 'DocType',
'permlevel': 0,
'read': 1,
'role': 'Sales Manager',
'submit': 0,
'write': 0
},
{
'amend': 0,
'cancel': 0,
'create': 0,
'creation': '2010-08-08 17:09:22',
'docstatus': 0,
'doctype': 'DocPerm',
'execute': None,
'idx': 3,
'match': None,
'modified': '2010-08-08 17:09:22',
'modified_by': 'Administrator',
'name': 'PERM00506',
'owner': 'Administrator',
'parent': 'Sales Partner',
'parentfield': 'permissions',
'parenttype': 'DocType',
'permlevel': 1,
'read': 1,
'role': 'Sales User',
'submit': 0,
'write': 0
},
{
'amend': 0,
'cancel': 0,
'create': 0,
'creation': '2010-08-08 17:09:22',
'docstatus': 0,
'doctype': 'DocPerm',
'execute': None,
'idx': 4,
'match': None,
'modified': '2010-08-08 17:09:22',
'modified_by': 'Administrator',
'name': 'PERM00507',
'owner': 'Administrator',
'parent': 'Sales Partner',
'parentfield': 'permissions',
'parenttype': 'DocType',
'permlevel': 0,
'read': 1,
'role': 'Sales User',
'submit': 0,
'write': 0
},
{
'amend': 0,
'cancel': 1,
'create': 1,
'creation': '2010-08-08 17:09:22',
'docstatus': 0,
'doctype': 'DocPerm',
'execute': None,
'idx': 5,
'match': None,
'modified': '2010-08-08 17:09:22',
'modified_by': 'Administrator',
'name': 'PERM00508',
'owner': 'Administrator',
'parent': 'Sales Partner',
'parentfield': 'permissions',
'parenttype': 'DocType',
'permlevel': 0,
'read': 1,
'role': 'Sales Master Manager',
'submit': 0,
'write': 1
},
{
'amend': 0,
'cancel': 0,
'create': 0,
'creation': '2010-08-08 17:09:22',
'docstatus': 0,
'doctype': 'DocPerm',
'execute': None,
'idx': 6,
'match': None,
'modified': '2010-08-08 17:09:22',
'modified_by': 'Administrator',
'name': 'PERM00509',
'owner': 'Administrator',
'parent': 'Sales Partner',
'parentfield': 'permissions',
'parenttype': 'DocType',
'permlevel': 1,
'read': 1,
'role': 'Sales Master Manager',
'submit': 0,
'write': 0
},
{
'amend': None,
'cancel': 1,
'create': 1,
'creation': '2010-08-08 17:09:22',
'docstatus': 0,
'doctype': 'DocPerm',
'execute': None,
'idx': 7,
'match': None,
'modified': '2010-08-08 17:09:22',
'modified_by': 'Administrator',
'name': 'PERM00510',
'owner': 'Administrator',
'parent': 'Sales Partner',
'parentfield': 'permissions',
'parenttype': 'DocType',
'permlevel': 0,
'read': 1,
'role': 'System Manager',
'submit': None,
'write': 1
},
{
'amend': None,
'cancel': None,
'create': 0,
'creation': '2010-08-08 17:09:22',
'docstatus': 0,
'doctype': 'DocPerm',
'execute': None,
'idx': 8,
'match': None,
'modified': '2010-08-08 17:09:22',
'modified_by': 'Administrator',
'name': 'PERM00511',
'owner': 'Administrator',
'parent': 'Sales Partner',
'parentfield': 'permissions',
'parenttype': 'DocType',
'permlevel': 1,
'read': 1,
'role': 'System Manager',
'submit': None,
'write': 0
},
{
'allow_on_submit': None,
'colour': 'White:FFF',
'creation': '2011-05-25 12:45:33',
'default': None,
'depends_on': None,
'description': 'Note: You Can Manage Multiple Address or Contacts via Addresses & Contacts',
'docstatus': 0,
'doctype': 'DocField',
'fieldname': None,
'fieldtype': 'Section Break',
'hidden': None,
'icon': None,
'idx': 1,
'in_filter': None,
'label': 'Basic Info',
'modified': '2011-05-25 12:45:33',
'modified_by': 'Guest',
'name': 'FL05429',
'no_column': None,
'no_copy': None,
'oldfieldname': None,
'oldfieldtype': 'Section Break',
'options': None,
'owner': 'Administrator',
'parent': 'Sales Partner',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': None
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2010-08-08 17:09:22',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'partner_name',
'fieldtype': 'Data',
'hidden': None,
'icon': None,
'idx': 2,
'in_filter': 1,
'label': 'Sales Partner Name',
'modified': '2011-05-25 12:45:32',
'modified_by': 'Guest',
'name': 'FL03128',
'no_column': None,
'no_copy': None,
'oldfieldname': 'partner_name',
'oldfieldtype': 'Data',
'options': None,
'owner': 'Administrator',
'parent': 'Sales Partner',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': 1,
'search_index': 1,
'trigger': None,
'width': None
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2010-08-08 17:09:22',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'partner_type',
'fieldtype': 'Select',
'hidden': None,
'icon': None,
'idx': 3,
'in_filter': 1,
'label': 'Partner Type',
'modified': '2011-05-25 12:45:32',
'modified_by': 'Guest',
'name': 'FL03129',
'no_column': None,
'no_copy': None,
'oldfieldname': 'partner_type',
'oldfieldtype': 'Select',
'options': '\nChannel Partner\nDistributor\nDealer\nAgent\nRetailer\nImplementation Partner\nReseller',
'owner': 'Administrator',
'parent': 'Sales Partner',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': 1,
'trigger': None,
'width': None
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2011-05-25 12:45:33',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': None,
'fieldtype': 'Column Break',
'hidden': None,
'icon': None,
'idx': 4,
'in_filter': None,
'label': None,
'modified': '2011-05-25 12:45:33',
'modified_by': 'Guest',
'name': 'FL05430',
'no_column': None,
'no_copy': None,
'oldfieldname': None,
'oldfieldtype': 'Column Break',
'options': None,
'owner': 'Administrator',
'parent': 'Sales Partner',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': '50%'
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2010-08-08 17:09:22',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'commission_rate',
'fieldtype': 'Currency',
'hidden': None,
'icon': None,
'idx': 5,
'in_filter': None,
'label': 'Commission Rate',
'modified': '2011-05-25 12:45:32',
'modified_by': 'Guest',
'name': 'FL03130',
'no_column': None,
'no_copy': None,
'oldfieldname': 'commission_rate',
'oldfieldtype': 'Currency',
'options': None,
'owner': 'Administrator',
'parent': 'Sales Partner',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': 1,
'search_index': None,
'trigger': None,
'width': None
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2010-08-08 17:09:22',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'territory',
'fieldtype': 'Link',
'hidden': None,
'icon': None,
'idx': 6,
'in_filter': None,
'label': 'Territory',
'modified': '2011-05-25 12:45:32',
'modified_by': 'Guest',
'name': 'FL03143',
'no_column': None,
'no_copy': None,
'oldfieldname': None,
'oldfieldtype': None,
'options': 'Territory',
'owner': 'Administrator',
'parent': 'Sales Partner',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': 1,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': None
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2011-05-25 12:45:33',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': None,
'fieldtype': 'Section Break',
'hidden': None,
'icon': None,
'idx': 7,
'in_filter': None,
'label': 'Address & Contacts',
'modified': '2011-05-25 12:45:33',
'modified_by': 'Guest',
'name': 'FL05431',
'no_column': None,
'no_copy': None,
'oldfieldname': None,
'oldfieldtype': None,
'options': None,
'owner': 'Administrator',
'parent': 'Sales Partner',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': None
},
{
'allow_on_submit': None,
'colour': 'White:FFF',
'creation': '2011-05-25 12:45:33',
'default': None,
'depends_on': 'eval:doc.__islocal',
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': None,
'fieldtype': 'HTML',
'hidden': None,
'icon': None,
'idx': 8,
'in_filter': None,
'label': 'Address Desc',
'modified': '2011-05-25 12:45:33',
'modified_by': 'Guest',
'name': 'FL05432',
'no_column': None,
'no_copy': None,
'oldfieldname': None,
'oldfieldtype': None,
'options': '<em>Addresses will appear only when you save the customer</em>',
'owner': 'Administrator',
'parent': 'Sales Partner',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': None
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2011-05-25 12:45:33',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': None,
'fieldtype': 'HTML',
'hidden': None,
'icon': None,
'idx': 9,
'in_filter': None,
'label': 'Address HTML',
'modified': '2011-05-25 12:45:33',
'modified_by': 'Guest',
'name': 'FL05433',
'no_column': None,
'no_copy': None,
'oldfieldname': None,
'oldfieldtype': None,
'options': None,
'owner': 'Administrator',
'parent': 'Sales Partner',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 1,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': None
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2011-05-25 12:45:33',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': None,
'fieldtype': 'Column Break',
'hidden': None,
'icon': None,
'idx': 10,
'in_filter': None,
'label': None,
'modified': '2011-05-25 12:45:33',
'modified_by': 'Guest',
'name': 'FL05434',
'no_column': None,
'no_copy': None,
'oldfieldname': None,
'oldfieldtype': None,
'options': None,
'owner': 'Administrator',
'parent': 'Sales Partner',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': None
},
{
'allow_on_submit': None,
'colour': 'White:FFF',
'creation': '2011-05-25 12:45:33',
'default': None,
'depends_on': 'eval:doc.__islocal',
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': None,
'fieldtype': 'HTML',
'hidden': None,
'icon': None,
'idx': 11,
'in_filter': None,
'label': 'Contact Desc',
'modified': '2011-05-25 12:45:33',
'modified_by': 'Guest',
'name': 'FL05435',
'no_column': None,
'no_copy': None,
'oldfieldname': None,
'oldfieldtype': None,
'options': '<em>Contact Details will appear only when you save the customer</em>',
'owner': 'Administrator',
'parent': 'Sales Partner',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': None
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2011-05-25 12:45:33',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': None,
'fieldtype': 'HTML',
'hidden': None,
'icon': None,
'idx': 12,
'in_filter': None,
'label': 'Contact HTML',
'modified': '2011-05-25 12:45:33',
'modified_by': 'Guest',
'name': 'FL05436',
'no_column': None,
'no_copy': None,
'oldfieldname': None,
'oldfieldtype': None,
'options': None,
'owner': 'Administrator',
'parent': 'Sales Partner',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 1,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': None
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2011-05-25 12:45:33',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': None,
'fieldtype': 'Section Break',
'hidden': None,
'icon': None,
'idx': 13,
'in_filter': None,
'label': 'Partner Target Details',
'modified': '2011-05-25 12:45:33',
'modified_by': 'Guest',
'name': 'FL05437',
'no_column': None,
'no_copy': None,
'oldfieldname': None,
'oldfieldtype': 'Section Break',
'options': None,
'owner': 'harshada@webnotestech.com',
'parent': 'Sales Partner',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': None
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2010-08-08 17:09:22',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'distribution_id',
'fieldtype': 'Link',
'hidden': None,
'icon': None,
'idx': 14,
'in_filter': None,
'label': 'Distribution Id',
'modified': '2011-05-25 12:45:33',
'modified_by': 'Guest',
'name': 'FL03148',
'no_column': None,
'no_copy': None,
'oldfieldname': 'distribution_id',
'oldfieldtype': 'Link',
'options': 'Budget Distribution',
'owner': 'Administrator',
'parent': 'Sales Partner',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': None
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2010-08-08 17:09:22',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'partner_target_details',
'fieldtype': 'Table',
'hidden': None,
'icon': None,
'idx': 15,
'in_filter': None,
'label': 'Partner Target Detail',
'modified': '2011-05-25 12:45:33',
'modified_by': 'Guest',
'name': 'FL03149',
'no_column': None,
'no_copy': None,
'oldfieldname': 'partner_target_details',
'oldfieldtype': 'Table',
'options': 'Target Detail',
'owner': 'Administrator',
'parent': 'Sales Partner',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': 0,
'search_index': None,
'trigger': None,
'width': None
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2011-05-25 12:45:33',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': None,
'fieldtype': 'HTML',
'hidden': 1,
'icon': None,
'idx': 16,
'in_filter': None,
'label': 'Manage HTML',
'modified': '2011-05-25 12:45:33',
'modified_by': 'Guest',
'name': 'FL05438',
'no_column': None,
'no_copy': None,
'oldfieldname': None,
'oldfieldtype': 'HTML',
'options': None,
'owner': 'Administrator',
'parent': 'Sales Partner',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': 1,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': None
},
{
'allow_on_submit': None,
'colour': 'White:FFF',
'creation': '2011-05-25 12:45:33',
'default': None,
'depends_on': 'eval:!doc.__islocal',
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': None,
'fieldtype': 'Section Break',
'hidden': None,
'icon': None,
'idx': 17,
'in_filter': None,
'label': 'Transaction History',
'modified': '2011-05-25 12:45:33',
'modified_by': 'Guest',
'name': 'FL05439',
'no_column': None,
'no_copy': None,
'oldfieldname': None,
'oldfieldtype': 'Section Break',
'options': None,
'owner': 'yogesh@webnotestech.com',
'parent': 'Sales Partner',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': None
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2011-05-25 12:45:33',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': None,
'fieldtype': 'HTML',
'hidden': None,
'icon': None,
'idx': 18,
'in_filter': None,
'label': 'History HTML',
'modified': '2011-05-25 12:45:33',
'modified_by': 'Guest',
'name': 'FL05440',
'no_column': None,
'no_copy': None,
'oldfieldname': None,
'oldfieldtype': 'HTML',
'options': None,
'owner': 'yogesh@webnotestech.com',
'parent': 'Sales Partner',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': None
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2010-08-08 17:09:22',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'trash_reason',
'fieldtype': 'Small Text',
'hidden': None,
'icon': None,
'idx': 19,
'in_filter': None,
'label': 'Trash Reason',
'modified': '2011-05-25 12:45:33',
'modified_by': 'Guest',
'name': 'FL03124',
'no_column': None,
'no_copy': None,
'oldfieldname': 'trash_reason',
'oldfieldtype': 'Small Text',
'options': None,
'owner': 'Administrator',
'parent': 'Sales Partner',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 1,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': None
}
]

View File

View File

@@ -0,0 +1,48 @@
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([doc])},
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');
}
}
);
}
cur_frm.cscript.TreePage = function(nm){
var call_back = function(){
var sb_obj = new SalesBrowser();
sb_obj.set_val(nm);
}
loadpage('Sales Browser',call_back);
}
//get query select sales person
cur_frm.fields_dict['parent_sales_person'].get_query = function(doc,cdt,cdn) {
return 'SELECT `tabSales Person`.`name`,`tabSales Person`.`parent_sales_person` FROM `tabSales Person` WHERE `tabSales Person`.`is_group` = "Yes" AND `tabSales Person`.`docstatus`!= 2 AND (`tabSales Person`.`rgt` > '+doc.rgt+' or `tabSales Person`.`lft` < '+doc.lft+') AND `tabSales Person`.`name` !="'+doc.sales_person_name+'" AND `tabSales Person`.%(key)s LIKE "%s" ORDER BY `tabSales Person`.`name` ASC LIMIT 50';
}
//get query select Territory
cur_frm.fields_dict['territory'].get_query = function(doc,cdt,cdn) {
return 'SELECT `tabTerritory`.`name` FROM `tabTerritory` WHERE `tabTerritory`.`is_group` = "No" AND `tabTerritory`.`docstatus`!= 2 AND `tabTerritory`.%(key)s LIKE "%s" ORDER BY `tabTerritory`.`name` ASC LIMIT 50';
}
// ******************** ITEM Group ********************************
cur_frm.fields_dict['target_details'].grid.get_field("item_group").get_query = function(doc, cdt, cdn) {
return 'SELECT `tabItem Group`.name FROM `tabItem Group` WHERE `tabItem Group`.is_group="No" AND `tabItem Group`.docstatus != 2 AND `tabItem Group`.%(key)s LIKE "%s" LIMIT 50'
}

View File

@@ -0,0 +1,67 @@
# 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
sql = webnotes.conn.sql
convert_to_lists = webnotes.conn.convert_to_lists
# -----------------------------------------------------------------------------------------
class DocType:
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.")
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))

File diff suppressed because it is too large Load Diff

View File

View File

@@ -0,0 +1,177 @@
# 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, removechild, getchildren, make_autoname, SuperDocType
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
# -----------------------------------------------------------------------------------------
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl
#Default Naming Series
#---------------------------------------------------
def naming_series(self):
ns = [['TDS Payment', 'TDSP'], ['Payable Voucher', 'BILL'], ['Journal Voucher', 'JV'], ['Receivable Voucher', 'INV'], ['Lead', 'Lead'], ['Indent', 'IDT'], ['Enquiry', 'Enquiry'], ['Purchase Order', 'PO'], ['Quotation', 'QTN'], ['Purchase Receipt', 'GRN'], ['Stock Entry', 'STE'], ['Sales Order', 'SO'], ['Delivery Note', 'DN'], ['Employee', 'EMP/']]
for r in ns:
rec = Document('Naming Series')
rec.select_doc_for_series = r[0]
rec.new_series = r[1]
rec_obj = get_obj(doc=rec)
rec_obj.add_series()
# set account details
#-----------------------
def set_account_details(self, args):
args = eval(args)
self.set_cp_defaults(args['company_name'], args['industry'], args['time_zone'], args['country'], args['account_name'])
self.create_profile(args['user'], args['first_name'], args['last_name'])
self.update_client_control()
# Account Setup
# ---------------
def setup_account(self, args):
company_name, comp_abbr, fy_start, currency = eval(args)
curr_fiscal_year,fy_start_date = self.get_fy_details(fy_start)
self.currency = currency
# Fiscal Year
master_dict = {'Fiscal Year':{'year':curr_fiscal_year,
'year_start_date':fy_start_date}}
self.create_records(master_dict)
# Company
master_dict = {'Company':{'company_name':company_name,
'abbr':comp_abbr
}}
self.create_records(master_dict)
def_args = {'current_fiscal_year':curr_fiscal_year,
'default_currency': currency,
'default_company':company_name,
'default_valuation_method':'FIFO',
'date_format':'dd-mm-yyyy',
'default_currency_format':'Lacs',
'so_required':'No',
'dn_required':'No',
'po_required':'No',
'pr_required':'No',
'emp_created_by':'Naming Series',
'cust_master_name':'Customer Name',
'supp_master_name':'Supplier Name'}
# Set
self.set_defaults(def_args)
# Set Registration Complete
set_default('registration_complete','1')
import webnotes.utils
return webnotes.utils.get_defaults()
# Get Fiscal year Details
# ------------------------
def get_fy_details(self, fy_start):
st = {'1st Jan':'01-01','1st Apr':'04-01','1st Jul':'07-01', '1st Oct': '10-01'}
curr_year = getdate(nowdate()).year
if cint(getdate(nowdate()).month) < cint((st[fy_start].split('-'))[0]):
curr_year = getdate(nowdate()).year - 1
stdt = cstr(curr_year)+'-'+cstr(st[fy_start])
#eddt = sql("select DATE_FORMAT(DATE_SUB(DATE_ADD('%s', INTERVAL 1 YEAR), INTERVAL 1 DAY),'%%d-%%m-%%Y')" % (stdt.split('-')[2]+ '-' + stdt.split('-')[1] + '-' + stdt.split('-')[0]))
if(fy_start == '1st Jan'):
fy = cstr(getdate(nowdate()).year)
else:
fy = cstr(curr_year) + '-' + cstr(curr_year+1)
return fy,stdt
# Create Company and Fiscal Year
# -------------------------------
def create_records(self, master_dict):
for d in master_dict.keys():
rec = Document(d)
for fn in master_dict[d].keys():
rec.fields[fn] = master_dict[d][fn]
# add blank fields
for fn in rec.fields:
if fn not in master_dict[d].keys()+['name','owner','doctype']:
rec.fields[fn] = ''
rec_obj = get_obj(doc=rec)
rec_obj.doc.save(1)
if hasattr(rec_obj, 'on_update'):
rec_obj.on_update()
# Set System Defaults
# --------------------
def set_defaults(self, def_args):
ma_obj = get_obj('Manage Account','Manage Account')
for d in def_args.keys():
ma_obj.doc.fields[d] = def_args[d]
ma_obj.doc.save()
ma_obj.update_cp()
# Set Control Panel Defaults
# --------------------------
def set_cp_defaults(self, cname, industry, timezone, country, acc_name):
cp = Document('Control Panel','Control Panel')
cp.account_id = acc_name
cp.company_name = cname
cp.industry = industry
cp.time_zone = timezone
cp.country = country
cp.client_name = '<div style="padding:4px; font-size:20px;">'+cname+'</div>'
cp.save()
# Create Profile
# --------------
def create_profile(self, user_email, user_fname, user_lname):
roles_list = ['System Manager','Sales Manager','Sales User','Purchase Manager','Purchase User','Material Manager','Material User','Accounts Manager','Accounts User','HR Manager','HR User','Production Manager','Production User','Sales Master Manager','Purchase Master Manager','Material Master Manager','Quality Manager','Maintenance User','Maintenance Manager']
pr = Document('Profile')
pr.first_name = user_fname
pr.last_name = user_lname
pr.email = user_email
pr.enabled = 1
pr.save(1)
for r in roles_list:
d = addchild(pr, 'userroles', 'UserRole', 1)
d.role = r
d.save()
# Add roles to Administrator profile
pr_obj = get_obj('Profile','Administrator')
for r in roles_list:
d = addchild(pr_obj.doc,'userroles', 'UserRole', 1)
d.role = r
d.save()
# Update WN ERP Client Control
# -----------------------------
def update_client_control(self):
cl = Document('WN ERP Client Control','WN ERP Client Control')
cl.account_start_date = nowdate()
cl.total_users = 1
cl.is_trial_account = 1
cl.save()
# Sync DB
# -------
def sync_db(arg=''):
import webnotes.model.db_schema
sql("delete from `tabDocType Update Register`")
webnotes.model.db_schema.sync_all()

View File

@@ -0,0 +1 @@
[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2010-04-03 13:32:18', 'search_fields': None, 'module': 'Setup', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': 1, 'read_only': 1, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': 1, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': None, 'max_attachments': None, 'version': 87, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 0, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'saumil@webnotestech.com', 'document_type': None, 'name': 'Setup Control', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}]

View File

View File

@@ -0,0 +1,10 @@
$import(Tips Common)
//--------- ONLOAD -------------
cur_frm.cscript.onload = function(doc, cdt, cdn) {
cur_frm.cscript.get_tips(doc, cdt, cdn);
}
cur_frm.cscript.refresh = function(doc, cdt, cdn) {
cur_frm.cscript.get_tips(doc, cdt, cdn);
}

View File

@@ -0,0 +1 @@
[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-03-31 16:47:00', 'search_fields': None, 'module': 'Setup', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': 0, 'read_only': 0, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 15, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': 'field:state_name', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'ashwini@webnotestech.com', 'document_type': 'Master', 'name': 'State', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': '', 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00533', 'parent': 'State', 'read': 1, 'create': 1, 'creation': '2009-12-15 16:10:15', 'modified': '2010-09-20 11:03:36', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 1, 'parenttype': 'DocType', 'role': 'Administrator', 'owner': 'dhanalekshmi@webnotestech.com', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': 0, 'amend': 0, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00582', 'parent': 'State', 'read': 1, 'create': 1, 'creation': '2010-01-12 16:42:57', 'modified': '2010-09-20 11:03:36', 'submit': 0, 'doctype': 'DocPerm', 'write': 1, 'idx': 2, 'parenttype': 'DocType', 'role': 'Sales Master Manager', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': None, 'amend': None, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00759', 'parent': 'State', 'read': 1, 'create': 1, 'creation': '2010-04-08 13:47:15', 'modified': '2010-09-20 11:03:36', 'submit': None, 'doctype': 'DocPerm', 'write': 1, 'idx': 3, 'parenttype': 'DocType', 'role': 'Purchase Master Manager', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-03-31 16:47:00', 'doctype': 'DocField', 'oldfieldname': 'state_name', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'State Name', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'State', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01598', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-09-20 11:03:36', 'parenttype': 'DocType', 'fieldname': 'state_name', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2009-03-31 16:47:00', 'doctype': 'DocField', 'oldfieldname': 'country', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Country', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'State', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01599', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-09-20 11:03:36', 'parenttype': 'DocType', 'fieldname': 'country', 'fieldtype': 'Select', 'options': 'link:Country', 'report_hide': None, 'parentfield': 'fields'}]

View File

View File

@@ -0,0 +1,11 @@
$import(Tips Common)
// ONLOAD
// ===================================================================================
cur_frm.cscript.onload = function(doc, cdt, cdn) {
cur_frm.cscript.get_tips(doc, cdt, cdn);
}
cur_frm.cscript.refresh = function(doc, cdt, cdn) {
cur_frm.cscript.get_tips(doc, cdt, cdn);
}

View File

@@ -0,0 +1 @@
[{'section_style': 'Simple', 'is_transaction_doc': None, 'creation': '2009-03-12 12:10:22', 'search_fields': None, 'module': 'Setup', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 4, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': None, 'description': None, 'parent': None, 'server_code': '', 'allow_trash': 1, 'allow_print': None, 'autoname': 'field:supplier_type', 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'ashwini@webnotestech.com', 'document_type': 'Master', 'name': 'Supplier Type', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': '', 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'cancel': 0, 'amend': 0, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00917', 'parent': 'Supplier Type', 'read': 1, 'create': 0, 'creation': '2010-04-26 16:54:46', 'modified': '2010-09-17 14:57:24', 'submit': 0, 'doctype': 'DocPerm', 'write': 0, 'idx': 1, 'parenttype': 'DocType', 'role': 'Purchase Manager', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'cancel': 0, 'amend': 0, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00918', 'parent': 'Supplier Type', 'read': 1, 'create': 0, 'creation': '2010-04-26 16:54:46', 'modified': '2010-09-17 14:57:24', 'submit': 0, 'doctype': 'DocPerm', 'write': 0, 'idx': 2, 'parenttype': 'DocType', 'role': 'Purchase Manager', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': 0, 'amend': 0, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00919', 'parent': 'Supplier Type', 'read': 1, 'create': 0, 'creation': '2010-04-26 17:00:26', 'modified': '2010-09-17 14:57:24', 'submit': 0, 'doctype': 'DocPerm', 'write': 0, 'idx': 3, 'parenttype': 'DocType', 'role': 'Purchase User', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 1, 'match': None, 'parentfield': 'permissions'}, {'cancel': 0, 'amend': 0, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00920', 'parent': 'Supplier Type', 'read': 1, 'create': 0, 'creation': '2010-04-26 17:00:26', 'modified': '2010-09-17 14:57:24', 'submit': 0, 'doctype': 'DocPerm', 'write': 0, 'idx': 4, 'parenttype': 'DocType', 'role': 'Purchase User', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': None, 'parentfield': 'permissions'}, {'cancel': 1, 'amend': 0, 'execute': None, 'modified_by': 'ashwini@webnotestech.com', 'name': 'PERM00224', 'parent': 'Supplier Type', 'read': 1, 'create': 1, 'creation': '2009-03-12 16:40:23', 'modified': '2010-09-17 14:57:24', 'submit': 0, 'doctype': 'DocPerm', 'write': 1, 'idx': 5, 'parenttype': 'DocType', 'role': 'Purchase Master Manager', 'owner': 'Administrator', 'docstatus': 0, 'permlevel': 0, 'match': '', 'parentfield': 'permissions'}, {'no_copy': None, 'oldfieldtype': 'Small Text', 'creation': '2010-04-20 14:06:44', 'doctype': 'DocField', 'oldfieldname': 'trash_reason', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Trash Reason', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 1, 'description': None, 'parent': 'Supplier Type', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL04863', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-09-17 14:57:24', 'parenttype': 'DocType', 'fieldname': 'trash_reason', 'fieldtype': 'Small Text', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Data', 'creation': '2009-03-12 12:10:22', 'doctype': 'DocField', 'oldfieldname': 'supplier_type', 'owner': 'Administrator', 'reqd': 1, 'in_filter': None, 'print_hide': None, 'modified_by': 'ashwini@webnotestech.com', 'label': 'Supplier Type', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Supplier Type', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL01322', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-09-17 14:57:24', 'parenttype': 'DocType', 'fieldname': 'supplier_type', 'fieldtype': 'Data', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]

View File

@@ -0,0 +1,18 @@
import webnotes
from webnotes.utils import cint
class DocType:
def __init__(self,dt,dn):
self.doc, self.doctype = dt,dn
def on_update(self):
"""
Sets or cancels the event in the scheduler
"""
if cint(self.doc.integrate_incoming):
from webnotes.utils.scheduler import set_event
set_event('maintenance.doctype.support_ticket.get_support_mails', 60*5, 1)
else:
from webnotes.utils.scheduler import cancel_event
cancel_event('maintenance.doctype.support_ticket.get_support_mails')

View File

@@ -0,0 +1,369 @@
[
{
'_last_update': '1306554355',
'allow_attach': None,
'allow_copy': None,
'allow_email': None,
'allow_print': None,
'allow_rename': None,
'allow_trash': None,
'autoname': None,
'change_log': None,
'client_script': None,
'client_script_core': None,
'client_string': None,
'colour': 'White:FFF',
'creation': '2011-05-17 14:04:30',
'description': None,
'docstatus': 0,
'doctype': 'DocType',
'document_type': None,
'dt_template': None,
'hide_heading': None,
'hide_toolbar': None,
'idx': None,
'in_create': None,
'in_dialog': 1,
'is_transaction_doc': None,
'issingle': 1,
'istable': None,
'max_attachments': None,
'menu_index': None,
'modified': '2011-05-28 09:25:53',
'modified_by': 'Administrator',
'module': 'Setup',
'name': 'Support Email Settings',
'name_case': None,
'owner': 'Administrator',
'parent': None,
'parent_node': None,
'parentfield': None,
'parenttype': None,
'print_outline': None,
'read_only': 1,
'read_only_onload': None,
'search_fields': None,
'section_style': 'Simple',
'server_code': None,
'server_code_compiled': None,
'server_code_core': None,
'server_code_error': None,
'show_in_menu': 1,
'smallicon': None,
'subject': None,
'tag_fields': None,
'use_template': None,
'version': 8
},
{
'amend': None,
'cancel': None,
'create': 1,
'creation': '2011-05-17 14:04:30',
'docstatus': 0,
'doctype': 'DocPerm',
'execute': None,
'idx': 1,
'match': None,
'modified': '2011-05-28 09:25:53',
'modified_by': 'Administrator',
'name': '000000798',
'owner': 'Administrator',
'parent': 'Support Email Settings',
'parentfield': 'permissions',
'parenttype': 'DocType',
'permlevel': 0,
'read': 1,
'role': 'System Manager',
'submit': None,
'write': 1
},
{
'allow_on_submit': None,
'colour': 'White:FFF',
'creation': '2011-05-19 12:41:15',
'default': None,
'depends_on': None,
'description': 'The full email id of your incoming support emails',
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'email',
'fieldtype': 'Data',
'hidden': None,
'icon': None,
'idx': 1,
'in_filter': None,
'label': 'Email',
'modified': '2011-05-28 09:25:53',
'modified_by': 'Administrator',
'name': '000000811',
'no_column': None,
'no_copy': None,
'oldfieldname': None,
'oldfieldtype': None,
'options': 'Email',
'owner': 'Administrator',
'parent': 'Support Email Settings',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': None
},
{
'allow_on_submit': None,
'colour': 'White:FFF',
'creation': '2011-05-20 11:34:49',
'default': None,
'depends_on': None,
'description': 'By checking this, your incoming mails will automatically be integrated with the Support Ticket',
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'integrate_incoming',
'fieldtype': 'Check',
'hidden': None,
'icon': None,
'idx': 2,
'in_filter': None,
'label': 'Integrate Incoming',
'modified': '2011-05-28 09:25:53',
'modified_by': 'Administrator',
'name': '000000824',
'no_column': None,
'no_copy': None,
'oldfieldname': None,
'oldfieldtype': None,
'options': None,
'owner': 'Administrator',
'parent': 'Support Email Settings',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': None
},
{
'allow_on_submit': None,
'colour': 'White:FFF',
'creation': '2011-05-28 09:15:55',
'default': None,
'depends_on': None,
'description': 'Signature appended to the outgoing email (Text / HTML)',
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'signature',
'fieldtype': 'Text',
'hidden': None,
'icon': None,
'idx': 3,
'in_filter': None,
'label': 'Signature',
'modified': '2011-05-28 09:25:53',
'modified_by': 'Administrator',
'name': 'FL05195',
'no_column': None,
'no_copy': None,
'oldfieldname': None,
'oldfieldtype': None,
'options': None,
'owner': 'Administrator',
'parent': 'Support Email Settings',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': None
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2011-05-20 11:34:49',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': None,
'fieldtype': 'Column Break',
'hidden': None,
'icon': None,
'idx': 4,
'in_filter': None,
'label': None,
'modified': '2011-05-28 09:25:53',
'modified_by': 'Administrator',
'name': '000000823',
'no_column': None,
'no_copy': None,
'oldfieldname': None,
'oldfieldtype': None,
'options': None,
'owner': 'Administrator',
'parent': 'Support Email Settings',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': None
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2011-05-17 14:04:30',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'use_ssl',
'fieldtype': 'Check',
'hidden': None,
'icon': None,
'idx': 5,
'in_filter': None,
'label': 'Use SSL',
'modified': '2011-05-28 09:25:53',
'modified_by': 'Administrator',
'name': '000000799',
'no_column': None,
'no_copy': None,
'oldfieldname': None,
'oldfieldtype': None,
'options': None,
'owner': 'Administrator',
'parent': 'Support Email Settings',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': None
},
{
'allow_on_submit': None,
'colour': 'White:FFF',
'creation': '2011-05-17 14:04:30',
'default': None,
'depends_on': None,
'description': 'eg. pop.gmail.com',
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'host',
'fieldtype': 'Data',
'hidden': None,
'icon': None,
'idx': 6,
'in_filter': None,
'label': 'Host',
'modified': '2011-05-28 09:25:53',
'modified_by': 'Administrator',
'name': '000000800',
'no_column': None,
'no_copy': None,
'oldfieldname': None,
'oldfieldtype': None,
'options': None,
'owner': 'Administrator',
'parent': 'Support Email Settings',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': None
},
{
'allow_on_submit': None,
'colour': 'White:FFF',
'creation': '2011-05-17 14:04:30',
'default': None,
'depends_on': None,
'description': 'Support Email Id',
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'username',
'fieldtype': 'Data',
'hidden': None,
'icon': None,
'idx': 7,
'in_filter': None,
'label': 'Username',
'modified': '2011-05-28 09:25:53',
'modified_by': 'Administrator',
'name': '000000801',
'no_column': None,
'no_copy': None,
'oldfieldname': None,
'oldfieldtype': None,
'options': None,
'owner': 'Administrator',
'parent': 'Support Email Settings',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': None
},
{
'allow_on_submit': None,
'colour': None,
'creation': '2011-05-17 14:04:30',
'default': None,
'depends_on': None,
'description': None,
'docstatus': 0,
'doctype': 'DocField',
'fieldname': 'password',
'fieldtype': 'Password',
'hidden': None,
'icon': None,
'idx': 8,
'in_filter': None,
'label': 'Password',
'modified': '2011-05-28 09:25:53',
'modified_by': 'Administrator',
'name': '000000802',
'no_column': None,
'no_copy': None,
'oldfieldname': None,
'oldfieldtype': None,
'options': None,
'owner': 'Administrator',
'parent': 'Support Email Settings',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0,
'print_hide': None,
'report_hide': None,
'reqd': None,
'search_index': None,
'trigger': None,
'width': None
}
]

View File

View File

@@ -0,0 +1 @@
[{'section_style': 'Tray', 'is_transaction_doc': None, 'creation': '2009-03-16 18:17:59', 'search_fields': None, 'module': 'Setup', 'doctype': 'DocType', 'change_log': None, 'print_outline': '', 'owner': 'Administrator', 'in_dialog': None, 'in_create': None, 'read_only': None, 'allow_email': None, 'dt_template': None, 'hide_heading': None, 'issingle': None, 'allow_rename': None, 'smallicon': '', 'allow_attach': None, 'show_in_menu': 0, 'max_attachments': None, 'version': 15, 'menu_index': None, 'docstatus': 0, 'allow_copy': None, 'istable': 1, 'description': None, 'parent': None, 'server_code': None, 'allow_trash': None, 'allow_print': None, 'autoname': None, 'client_script_core': None, 'client_string': None, 'use_template': None, 'modified_by': 'Administrator', 'document_type': None, 'name': 'Target Detail', 'idx': None, 'hide_toolbar': None, 'colour': 'White:FFF', 'client_script': None, 'modified': '2010-09-20 14:06:57', 'server_code_error': ' ', 'name_case': '', 'parenttype': None, 'read_only_onload': None, 'server_code_core': None, 'server_code_compiled': None, 'parent_node': None, 'parentfield': None}, {'no_copy': None, 'oldfieldtype': 'Link', 'creation': '2009-05-22 13:08:10', 'doctype': 'DocField', 'oldfieldname': 'item_group', 'owner': 'Administrator', 'reqd': 0, 'in_filter': 1, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Item Group', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Target Detail', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL02123', 'idx': 1, 'default': None, 'colour': None, 'modified': '2010-06-30 13:03:15', 'parenttype': 'DocType', 'fieldname': 'item_group', 'fieldtype': 'Link', 'options': 'Item Group', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Select', 'creation': '2009-03-16 18:17:59', 'doctype': 'DocField', 'oldfieldname': 'fiscal_year', 'owner': 'Administrator', 'reqd': 1, 'in_filter': 1, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Fiscal Year', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Target Detail', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL01419', 'idx': 2, 'default': None, 'colour': None, 'modified': '2010-06-30 13:03:15', 'parenttype': 'DocType', 'fieldname': 'fiscal_year', 'fieldtype': 'Select', 'options': 'link:Fiscal Year', 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2010-06-22 12:03:16', 'doctype': 'DocField', 'oldfieldname': 'target_qty', 'owner': 'Administrator', 'reqd': None, 'in_filter': None, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Target Qty', 'width': None, 'trigger': None, 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Target Detail', 'search_index': None, 'allow_on_submit': None, 'icon': None, 'name': 'FL05403', 'idx': 3, 'default': None, 'colour': None, 'modified': '2010-06-30 13:03:15', 'parenttype': 'DocType', 'fieldname': 'target_qty', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}, {'no_copy': None, 'oldfieldtype': 'Currency', 'creation': '2009-03-16 18:17:59', 'doctype': 'DocField', 'oldfieldname': 'target_amount', 'owner': 'Administrator', 'reqd': 0, 'in_filter': 1, 'print_hide': None, 'modified_by': 'Administrator', 'label': 'Target Amount', 'width': None, 'trigger': '', 'depends_on': None, 'docstatus': 0, 'hidden': None, 'permlevel': 0, 'description': None, 'parent': 'Target Detail', 'search_index': 1, 'allow_on_submit': None, 'icon': None, 'name': 'FL01420', 'idx': 4, 'default': None, 'colour': None, 'modified': '2010-06-30 13:03:15', 'parenttype': 'DocType', 'fieldname': 'target_amount', 'fieldtype': 'Currency', 'options': None, 'report_hide': None, 'parentfield': 'fields'}]

View File

View File

@@ -0,0 +1,10 @@
$import(Tips Common)
//--------- ONLOAD -------------
cur_frm.cscript.onload = function(doc, cdt, cdn) {
cur_frm.cscript.get_tips(doc, cdt, cdn);
}
cur_frm.cscript.refresh = function(doc, cdt, cdn) {
cur_frm.cscript.get_tips(doc, cdt, cdn);
}

File diff suppressed because one or more lines are too long

View File

View File

@@ -0,0 +1,35 @@
$import(Tips Common)
cur_frm.cscript.refresh = function(doc, cdt, cdn) {
cur_frm.cscript.get_tips(doc, cdt, cdn);
}
cur_frm.cscript.onload = function(){
cur_frm.cscript.get_tips(doc, cdt, cdn);
if(doc.__islocal){
doc.parent_territory = 'All Territories';
refresh('parent_territory');
}
}
//get query select territory
cur_frm.fields_dict['parent_territory'].get_query = function(doc,cdt,cdn) {
return 'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` FROM `tabTerritory` WHERE `tabTerritory`.`is_group` = "Yes" AND `tabTerritory`.`docstatus`!= 2 AND (`tabTerritory`.`rgt` > '+doc.rgt+' or `tabTerritory`.`lft` < '+doc.lft+') AND `tabTerritory`.`name` !="'+doc.territory_name+'" AND `tabTerritory`.%(key)s LIKE "%s" ORDER BY `tabTerritory`.`name` ASC LIMIT 50';
}
// ******************** ITEM Group ********************************
cur_frm.fields_dict['target_details'].grid.get_field("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="No" AND `tabItem Group`.docstatus != 2 AND `tabItem Group`.%(key)s LIKE "%s" LIMIT 50'
}
cur_frm.cscript.TerritoryHelp = function(doc,dt,dn){
var call_back = function(){
var sb_obj = new SalesBrowser();
sb_obj.set_val('Territory');
}
loadpage('Sales Browser',call_back);
}

View File

@@ -0,0 +1,61 @@
# 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, removechild, getchildren, make_autoname, SuperDocType
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
# -----------------------------------------------------------------------------------------
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 (rgt > %s or lft < %s) and name ='%s' and name !='%s'"%(self.doc.rgt,self.doc.lft,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

File diff suppressed because one or more lines are too long

View File

10
setup/doctype/uom/uom.js Normal file
View File

@@ -0,0 +1,10 @@
$import(Tips Common)
//--------- ONLOAD -------------
cur_frm.cscript.onload = function(doc, cdt, cdn) {
cur_frm.cscript.get_tips(doc, cdt, cdn);
}
cur_frm.cscript.refresh = function(doc, cdt, cdn) {
cur_frm.cscript.get_tips(doc, cdt, cdn);
}

File diff suppressed because one or more lines are too long

View File

View File

@@ -0,0 +1,10 @@
$import(Tips Common)
//--------- ONLOAD -------------
cur_frm.cscript.onload = function(doc, cdt, cdn) {
cur_frm.cscript.get_tips(doc, cdt, cdn);
}
cur_frm.cscript.refresh = function(doc, cdt, cdn) {
cur_frm.cscript.get_tips(doc, cdt, cdn);
}

Some files were not shown because too many files have changed in this diff Show More