Merge branch 'unicode' of github.com:webnotes/erpnext
Conflicts: erpnext/setup/doctype/email_digest/email_digest.py
This commit is contained in:
commit
a76af79302
@ -17,10 +17,4 @@
|
||||
"erpnext/startup/js/feature_setup.js",
|
||||
"conf.js"
|
||||
],
|
||||
"public/js/kb_common.js": [
|
||||
"erpnext/utilities/page/kb_common/kb_common.js",
|
||||
],
|
||||
"public/js/complete_setup.js": [
|
||||
"erpnext/startup/js/complete_setup.js",
|
||||
],
|
||||
}
|
@ -14,6 +14,7 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
from webnotes.utils import flt
|
||||
from webnotes.model.code import get_obj
|
||||
|
@ -0,0 +1 @@
|
||||
from __future__ import unicode_literals
|
@ -0,0 +1 @@
|
||||
from __future__ import unicode_literals
|
@ -14,6 +14,47 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
// Onload
|
||||
// -----------------------------------------
|
||||
cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
||||
}
|
||||
|
||||
cur_frm.cscript.set_breadcrumbs = function(barea) {
|
||||
cur_frm.frm_head.appframe.add_breadcrumb(cur_frm.docname);
|
||||
cur_frm.frm_head.appframe.add_breadcrumb(' in <a href="#!Accounts Browser/Account">\
|
||||
Chart of Accounts</a>');
|
||||
cur_frm.frm_head.appframe.add_breadcrumb(' in <a href="#!accounts-home">Accounts</a>');
|
||||
}
|
||||
|
||||
// Refresh
|
||||
// -----------------------------------------
|
||||
cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
||||
cur_frm.toggle_display('account_name', doc.__islocal);
|
||||
|
||||
// hide fields if group
|
||||
cur_frm.toggle_display(['account_type', 'master_type', 'master_name', 'freeze_account',
|
||||
'credit_days', 'credit_limit', 'tax_rate'], doc.group_or_ledger=='Ledger')
|
||||
|
||||
// read-only for root accounts
|
||||
root_acc = ['Application of Funds (Assets)','Expenses','Income','Source of Funds (Liabilities)'];
|
||||
if(in_list(root_acc, doc.account_name)) {
|
||||
cur_frm.perm = [[1,0,0], [1,0,0]];
|
||||
cur_frm.set_intro("This is a root account and cannot be edited.");
|
||||
} else {
|
||||
// credit days and type if customer or supplier
|
||||
cur_frm.set_intro(null);
|
||||
cur_frm.toggle_display(['credit_days', 'credit_limit'],
|
||||
in_list(['Customer', 'Supplier'], doc.master_type))
|
||||
|
||||
// hide tax_rate
|
||||
cur_frm.cscript.account_type(doc, cdt, cdn);
|
||||
|
||||
// show / hide convert buttons
|
||||
cur_frm.cscript.hide_unhide_group_ledger(doc);
|
||||
}
|
||||
}
|
||||
|
||||
// Fetch parent details
|
||||
// -----------------------------------------
|
||||
cur_frm.add_fetch('parent_account', 'debit_or_credit', 'debit_or_credit');
|
||||
@ -22,47 +63,31 @@ cur_frm.add_fetch('parent_account', 'is_pl_account', 'is_pl_account');
|
||||
// Hide tax rate based on account type
|
||||
// -----------------------------------------
|
||||
cur_frm.cscript.account_type = function(doc, cdt, cdn) {
|
||||
if(doc.account_type == 'Tax') unhide_field(['tax_rate']);
|
||||
else hide_field(['tax_rate']);
|
||||
}
|
||||
|
||||
// Onload
|
||||
// -----------------------------------------
|
||||
cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
||||
cur_frm.cscript.account_type(doc, cdt, cdn);
|
||||
// hide India specific fields
|
||||
var cp = wn.control_panel;
|
||||
if(cp.country == 'India')
|
||||
unhide_field(['pan_number', 'tds_applicable', 'tds_details', 'tds']);
|
||||
else
|
||||
hide_field(['pan_number', 'tds_applicable', 'tds_details', 'tds']);
|
||||
}
|
||||
|
||||
// Refresh
|
||||
// -----------------------------------------
|
||||
cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
||||
root_acc = [' Application of Funds (Assets)','Expenses','Income','Source of Funds (Liabilities)'];
|
||||
if(inList(root_acc, doc.account_name))
|
||||
cur_frm.perm = [[1,0,0], [1,0,0]];
|
||||
cur_frm.cscript.hide_unhide_group_ledger(doc);
|
||||
if(doc.group_or_ledger=='Ledger') {
|
||||
cur_frm.toggle_display(['tax_rate'],
|
||||
doc.account_type == 'Tax');
|
||||
cur_frm.toggle_display(['master_type', 'master_name'],
|
||||
cstr(doc.account_type)=='');
|
||||
}
|
||||
}
|
||||
|
||||
// Hide/unhide group or ledger
|
||||
// -----------------------------------------
|
||||
cur_frm.cscript.hide_unhide_group_ledger = function(doc) {
|
||||
hide_field(['convert_to_group', 'convert_to_ledger']);
|
||||
if (cstr(doc.group_or_ledger) == 'Group') unhide_field('convert_to_ledger');
|
||||
else if (cstr(doc.group_or_ledger) == 'Ledger') unhide_field('convert_to_group');
|
||||
if (cstr(doc.group_or_ledger) == 'Group') {
|
||||
cur_frm.add_custom_button('Convert to Ledger',
|
||||
function() { cur_frm.cscript.convert_to_ledger(); }, 'icon-retweet')
|
||||
} else if (cstr(doc.group_or_ledger) == 'Ledger') {
|
||||
cur_frm.add_custom_button('Convert to Group',
|
||||
function() { cur_frm.cscript.convert_to_group(); }, 'icon-retweet')
|
||||
}
|
||||
}
|
||||
|
||||
// Convert group to ledger
|
||||
// -----------------------------------------
|
||||
cur_frm.cscript.convert_to_ledger = function(doc, cdt, cdn) {
|
||||
$c_obj(make_doclist(cdt,cdn),'convert_group_to_ledger','',function(r,rt) {
|
||||
if(r.message == 1) {
|
||||
doc.group_or_ledger = 'Ledger';
|
||||
refresh_field('group_or_ledger');
|
||||
cur_frm.cscript.hide_unhide_group_ledger(doc);
|
||||
$c_obj(cur_frm.get_doclist(),'convert_group_to_ledger','',function(r,rt) {
|
||||
if(r.message == 1) {
|
||||
cur_frm.refresh();
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -70,11 +95,9 @@ cur_frm.cscript.convert_to_ledger = function(doc, cdt, cdn) {
|
||||
// Convert ledger to group
|
||||
// -----------------------------------------
|
||||
cur_frm.cscript.convert_to_group = function(doc, cdt, cdn) {
|
||||
$c_obj(make_doclist(cdt,cdn),'convert_ledger_to_group','',function(r,rt) {
|
||||
$c_obj(cur_frm.get_doclist(),'convert_ledger_to_group','',function(r,rt) {
|
||||
if(r.message == 1) {
|
||||
doc.group_or_ledger = 'Group';
|
||||
refresh_field('group_or_ledger');
|
||||
cur_frm.cscript.hide_unhide_group_ledger(doc);
|
||||
cur_frm.refresh();
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -85,11 +108,13 @@ cur_frm.fields_dict['master_name'].get_query=function(doc){
|
||||
if (doc.master_type){
|
||||
return 'SELECT `tab'+doc.master_type+'`.name FROM `tab'+doc.master_type+'` WHERE `tab'+doc.master_type+'`.name LIKE "%s" and `tab'+doc.master_type+'`.docstatus != 2 ORDER BY `tab'+doc.master_type+'`.name LIMIT 50';
|
||||
}
|
||||
else alert("Please select master type");
|
||||
}
|
||||
|
||||
// parent account get query
|
||||
// -----------------------------------------
|
||||
cur_frm.fields_dict['parent_account'].get_query = function(doc){
|
||||
return 'SELECT DISTINCT `tabAccount`.name FROM `tabAccount` WHERE `tabAccount`.group_or_ledger="Group" AND `tabAccount`.docstatus != 2 AND `tabAccount`.company="'+ doc.company+'" AND `tabAccount`.company is not NULL AND `tabAccount`.name LIKE "%s" ORDER BY `tabAccount`.name LIMIT 50';
|
||||
return 'SELECT DISTINCT `tabAccount`.name FROM `tabAccount` WHERE \
|
||||
`tabAccount`.group_or_ledger="Group" AND `tabAccount`.docstatus != 2 AND \
|
||||
`tabAccount`.company="'+ doc.company+'" AND `tabAccount`.company is not NULL AND \
|
||||
`tabAccount`.name LIKE "%s" ORDER BY `tabAccount`.name LIMIT 50';
|
||||
}
|
||||
|
@ -15,6 +15,7 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Please edit this list and import only required elements
|
||||
from __future__ import unicode_literals
|
||||
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
|
||||
@ -43,7 +44,6 @@ class DocType:
|
||||
self.doc.name = self.doc.account_name.strip() + ' - ' + company_abbr
|
||||
|
||||
# Get customer/supplier address
|
||||
# ==================================================================
|
||||
def get_address(self):
|
||||
add=sql("Select address from `tab%s` where name='%s'"%(self.doc.master_type,self.doc.master_name))
|
||||
ret={'address':add[0][0]}
|
||||
@ -51,20 +51,17 @@ class DocType:
|
||||
|
||||
|
||||
# check whether master name entered for supplier/customer
|
||||
# ==================================================================
|
||||
def validate_master_name(self):
|
||||
if (self.doc.master_type == 'Customer' or self.doc.master_type == 'Supplier') and not self.doc.master_name:
|
||||
msgprint("Message: Please enter Master Name once the account is created.")
|
||||
|
||||
|
||||
# Rate is mandatory for tax account
|
||||
# ==================================================================
|
||||
def validate_rate_for_tax(self):
|
||||
if self.doc.account_type == 'Tax' and not self.doc.tax_rate:
|
||||
msgprint("Please Enter Rate", raise_exception=1)
|
||||
|
||||
# Fetch Parent Details and validation for account not to be created under ledger
|
||||
# ==================================================================
|
||||
def validate_parent(self):
|
||||
if self.doc.parent_account:
|
||||
par = sql("select name, group_or_ledger, is_pl_account, debit_or_credit from tabAccount where name =%s",self.doc.parent_account)
|
||||
@ -85,13 +82,11 @@ class DocType:
|
||||
|
||||
|
||||
# Account name must be unique
|
||||
# ==================================================================
|
||||
def validate_duplicate_account(self):
|
||||
if (self.doc.__islocal or (not self.doc.name)) and sql("select name from tabAccount where account_name=%s and company=%s", (self.doc.account_name, self.doc.company)):
|
||||
msgprint("Account Name already exists, please rename", raise_exception=1)
|
||||
|
||||
# validate root details
|
||||
# ==================================================================
|
||||
def validate_root_details(self):
|
||||
#does not exists parent
|
||||
if self.doc.account_name in ['Income','Source of Funds', 'Expenses','Application of Funds'] and self.doc.parent_account:
|
||||
@ -110,7 +105,6 @@ class DocType:
|
||||
self.doc.is_pl_account = 'No'
|
||||
|
||||
# Convert group to ledger
|
||||
# ==================================================================
|
||||
def convert_group_to_ledger(self):
|
||||
if self.check_if_child_exists():
|
||||
msgprint("Account: %s has existing child. You can not convert this account to ledger" % (self.doc.name), raise_exception=1)
|
||||
@ -122,28 +116,28 @@ class DocType:
|
||||
return 1
|
||||
|
||||
# Convert ledger to group
|
||||
# ==================================================================
|
||||
def convert_ledger_to_group(self):
|
||||
if self.check_gle_exists():
|
||||
msgprint("Account with existing transaction can not be converted to group.", raise_exception=1)
|
||||
msgprint("Account with existing transaction can not be converted to group.",
|
||||
raise_exception=1)
|
||||
elif self.doc.master_type or self.doc.account_type:
|
||||
msgprint("Cannot covert to Group because Master Type or Account Type is selected.",
|
||||
raise_exception=1)
|
||||
else:
|
||||
self.doc.group_or_ledger = 'Group'
|
||||
self.doc.save()
|
||||
return 1
|
||||
|
||||
# Check if any previous balance exists
|
||||
# ==================================================================
|
||||
def check_gle_exists(self):
|
||||
exists = sql("select name from `tabGL Entry` where account = '%s' and ifnull(is_cancelled, 'No') = 'No'" % (self.doc.name))
|
||||
return exists and exists[0][0] or ''
|
||||
|
||||
# check if child exists
|
||||
# ==================================================================
|
||||
def check_if_child_exists(self):
|
||||
return sql("select name from `tabAccount` where parent_account = %s and docstatus != 2", self.doc.name)
|
||||
|
||||
# Update balance
|
||||
# ==================================================================
|
||||
def update_balance(self, fy, period_det, flag = 1):
|
||||
# update in all parents
|
||||
for p in period_det:
|
||||
@ -151,7 +145,6 @@ class DocType:
|
||||
|
||||
|
||||
# change parent balance
|
||||
# ==================================================================
|
||||
def change_parent_bal(self):
|
||||
period_det = []
|
||||
fy = sql("select name from `tabFiscal Year` where if(ifnull(is_fiscal_year_closed, 'No'),ifnull(is_fiscal_year_closed, 'No'), 'No') = 'No'")
|
||||
@ -181,7 +174,6 @@ class DocType:
|
||||
|
||||
|
||||
# VALIDATE
|
||||
# ==================================================================
|
||||
def validate(self):
|
||||
self.validate_master_name()
|
||||
self.validate_rate_for_tax()
|
||||
@ -199,7 +191,6 @@ class DocType:
|
||||
self.change_parent_bal()
|
||||
|
||||
# Add current fiscal year balance
|
||||
# ==================================================================
|
||||
def set_year_balance(self):
|
||||
p = sql("select name, start_date, end_date, fiscal_year from `tabPeriod` where docstatus != 2 and period_type in ('Month', 'Year')")
|
||||
for d in p:
|
||||
@ -217,29 +208,26 @@ class DocType:
|
||||
ac.save(1)
|
||||
|
||||
# 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()
|
||||
# Add curret year balance
|
||||
self.set_year_balance()
|
||||
|
||||
# Check user role for approval process
|
||||
# ==================================================================
|
||||
def get_authorized_user(self):
|
||||
# Check logged-in user is authorized
|
||||
if get_value('Global Defaults', None, 'credit_controller') in webnotes.user.get_roles():
|
||||
return 1
|
||||
|
||||
# Check Credit limit for customer
|
||||
# ==================================================================
|
||||
def check_credit_limit(self, account, company, tot_outstanding):
|
||||
# Get credit limit
|
||||
credit_limit_from = 'Customer'
|
||||
@ -256,7 +244,6 @@ class DocType:
|
||||
% (fmt_money(tot_outstanding), account, fmt_money(credit_limit), credit_limit_from), raise_exception=1)
|
||||
|
||||
# Account with balance cannot be inactive
|
||||
# ==================================================================
|
||||
def check_balance_before_trash(self):
|
||||
if self.check_gle_exists():
|
||||
msgprint("Account with existing transaction (Sales Invoice / Purchase Invoice / Journal Voucher) can not be trashed", raise_exception=1)
|
||||
@ -265,20 +252,18 @@ class DocType:
|
||||
|
||||
|
||||
# get current year balance
|
||||
# ==================================================================
|
||||
def get_curr_bal(self):
|
||||
bal = sql("select balance from `tabAccount Balance` where period = '%s' and parent = '%s'" % (get_defaults()['fiscal_year'], self.doc.name),debug=0)
|
||||
return bal and flt(bal[0][0]) or 0
|
||||
|
||||
# On Trash
|
||||
# ==================================================================
|
||||
def on_trash(self):
|
||||
# Check balance before trash
|
||||
self.check_balance_before_trash()
|
||||
|
||||
# rebuild tree
|
||||
set(self.doc,'old_parent', '')
|
||||
self.update_nsm_model()
|
||||
from webnotes.utils.nestedset import update_remove_node
|
||||
update_remove_node('Account', self.doc.name)
|
||||
|
||||
# delete all cancelled gl entry of this account
|
||||
sql("delete from `tabGL Entry` where account = %s and ifnull(is_cancelled, 'No') = 'Yes'", self.doc.name)
|
||||
@ -287,7 +272,6 @@ class DocType:
|
||||
sql("delete from `tabAccount Balance` where account = %s", self.doc.name)
|
||||
|
||||
# On restore
|
||||
# ==================================================================
|
||||
def on_restore(self):
|
||||
# rebuild tree
|
||||
self.update_nsm_model()
|
||||
@ -295,7 +279,6 @@ class DocType:
|
||||
self.set_year_balance()
|
||||
|
||||
# on rename
|
||||
# ---------
|
||||
def on_rename(self,newdn,olddn):
|
||||
company_abbr = sql("select tc.abbr from `tabAccount` ta, `tabCompany` tc where ta.company = tc.name and ta.name=%s", olddn)[0][0]
|
||||
|
||||
|
@ -3,9 +3,9 @@
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2012-03-27 14:35:39',
|
||||
'creation': '2012-07-03 13:30:50',
|
||||
'docstatus': 0,
|
||||
'modified': '2012-03-27 14:35:39',
|
||||
'modified': '2012-07-11 13:58:44',
|
||||
'modified_by': u'Administrator',
|
||||
'owner': u'Administrator'
|
||||
},
|
||||
@ -17,6 +17,7 @@
|
||||
'allow_trash': 1,
|
||||
'colour': u'White:FFF',
|
||||
'default_print_format': u'Standard',
|
||||
'description': u'An **Account** is heading under which financial and business transactions are carried on. For example, \u201cTravel Expense\u201d is an account, \u201cCustomer Zoe\u201d, \u201cSupplier Mae\u201d are accounts. \n\n**Note:** ERPNext creates accounts for Customers and Suppliers automatically.\n\n### Groups and Ledgers\n\nThere are two main kinds of Accounts in ERPNext - Group and Ledger. Groups can have sub-groups and ledgers within them, whereas ledgers are the leaf nodes of your chart and cannot be further classified.\n\nAccounting Transactions can only be made against Ledger Accounts (not Groups)\n',
|
||||
'doctype': 'DocType',
|
||||
'document_type': u'Master',
|
||||
'in_create': 1,
|
||||
@ -26,7 +27,7 @@
|
||||
'section_style': u'Tray',
|
||||
'server_code_error': u' ',
|
||||
'show_in_menu': 0,
|
||||
'version': 138
|
||||
'version': 1
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
@ -58,14 +59,34 @@
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'cancel': 1,
|
||||
'create': 1,
|
||||
'cancel': 0,
|
||||
'create': 0,
|
||||
'doctype': u'DocPerm',
|
||||
'permlevel': 0,
|
||||
'role': u'Accounts User',
|
||||
'role': u'Auditor',
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'cancel': 0,
|
||||
'create': 0,
|
||||
'doctype': u'DocPerm',
|
||||
'permlevel': 1,
|
||||
'role': u'Auditor',
|
||||
'write': 0
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'cancel': 0,
|
||||
'create': 0,
|
||||
'doctype': u'DocPerm',
|
||||
'permlevel': 2,
|
||||
'role': u'Auditor',
|
||||
'write': 0
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'cancel': 0,
|
||||
@ -86,6 +107,26 @@
|
||||
'write': 0
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'cancel': 0,
|
||||
'create': 0,
|
||||
'doctype': u'DocPerm',
|
||||
'permlevel': 0,
|
||||
'role': u'Accounts User',
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'cancel': 1,
|
||||
'create': 1,
|
||||
'doctype': u'DocPerm',
|
||||
'permlevel': 0,
|
||||
'role': u'Accounts Manager',
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'cancel': 0,
|
||||
@ -106,16 +147,6 @@
|
||||
'write': 0
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'cancel': 1,
|
||||
'create': 1,
|
||||
'doctype': u'DocPerm',
|
||||
'permlevel': 0,
|
||||
'role': u'Accounts Manager',
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'cancel': 0,
|
||||
@ -141,7 +172,7 @@
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'properties',
|
||||
'fieldtype': u'Section Break',
|
||||
'label': u'Properties',
|
||||
'label': u'Account Details',
|
||||
'oldfieldtype': u'Section Break',
|
||||
'permlevel': 0
|
||||
},
|
||||
@ -170,20 +201,6 @@
|
||||
'search_index': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'parent_account',
|
||||
'fieldtype': u'Link',
|
||||
'label': u'Parent Account',
|
||||
'oldfieldname': u'parent_account',
|
||||
'oldfieldtype': u'Link',
|
||||
'options': u'Account',
|
||||
'permlevel': 0,
|
||||
'search_index': 1,
|
||||
'trigger': u'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
@ -213,26 +230,6 @@
|
||||
'search_index': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'convert_to_group',
|
||||
'fieldtype': u'Button',
|
||||
'label': u'Convert to Group',
|
||||
'permlevel': 0,
|
||||
'trigger': u'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'convert_to_ledger',
|
||||
'fieldtype': u'Button',
|
||||
'label': u'Convert to Ledger',
|
||||
'permlevel': 0,
|
||||
'trigger': u'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
@ -262,6 +259,46 @@
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'company',
|
||||
'fieldtype': u'Link',
|
||||
'in_filter': 1,
|
||||
'label': u'Company',
|
||||
'oldfieldname': u'company',
|
||||
'oldfieldtype': u'Link',
|
||||
'options': u'Company',
|
||||
'permlevel': 1,
|
||||
'reqd': 1,
|
||||
'search_index': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'column_break1',
|
||||
'fieldtype': u'Column Break',
|
||||
'permlevel': 0,
|
||||
'width': u'50%'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'parent_account',
|
||||
'fieldtype': u'Link',
|
||||
'label': u'Parent Account',
|
||||
'oldfieldname': u'parent_account',
|
||||
'oldfieldtype': u'Link',
|
||||
'options': u'Account',
|
||||
'permlevel': 0,
|
||||
'search_index': 1,
|
||||
'trigger': u'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': u'White:FFF',
|
||||
'description': u'Setting Account Type helps in selecting this Account in transactions.',
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'account_type',
|
||||
'fieldtype': u'Select',
|
||||
@ -278,7 +315,7 @@
|
||||
# DocField
|
||||
{
|
||||
'colour': u'White:FFF',
|
||||
'description': u'If Account Type is "Tax" then the default rate is required.',
|
||||
'description': u'Rate at which this tax is applied',
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'tax_rate',
|
||||
'fieldtype': u'Currency',
|
||||
@ -292,19 +329,12 @@
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'column_break1',
|
||||
'fieldtype': u'Column Break',
|
||||
'permlevel': 0,
|
||||
'width': u'50%'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': u'White:FFF',
|
||||
'description': u'If the account is frozen, entries are allowed for the "Account Manager" only.',
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'freeze_account',
|
||||
'fieldtype': u'Select',
|
||||
'label': u'Freeze Account',
|
||||
'label': u'Frozen',
|
||||
'oldfieldname': u'freeze_account',
|
||||
'oldfieldtype': u'Select',
|
||||
'options': u'No\nYes',
|
||||
@ -313,21 +343,7 @@
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'company',
|
||||
'fieldtype': u'Link',
|
||||
'in_filter': 1,
|
||||
'label': u'Company',
|
||||
'oldfieldname': u'company',
|
||||
'oldfieldtype': u'Link',
|
||||
'options': u'Company',
|
||||
'permlevel': 1,
|
||||
'reqd': 1,
|
||||
'search_index': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': u'White:FFF',
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'credit_days',
|
||||
'fieldtype': u'Int',
|
||||
@ -354,13 +370,15 @@
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': u'White:FFF',
|
||||
'description': u'If this Account represents a Customer, Supplier or Employee, set it here.',
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'master_type',
|
||||
'fieldtype': u'Select',
|
||||
'label': u'Master Type',
|
||||
'oldfieldname': u'master_type',
|
||||
'oldfieldtype': u'Select',
|
||||
'options': u'\nNA\nSupplier\nCustomer\nEmployee',
|
||||
'options': u'\nSupplier\nCustomer\nEmployee',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
@ -374,116 +392,5 @@
|
||||
'oldfieldtype': u'Link',
|
||||
'permlevel': 0,
|
||||
'trigger': u'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'tds',
|
||||
'fieldtype': u'Section Break',
|
||||
'label': u'TDS',
|
||||
'oldfieldtype': u'Section Break',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'pan_number',
|
||||
'fieldtype': u'Data',
|
||||
'label': u'PAN Number',
|
||||
'oldfieldname': u'pan_number',
|
||||
'oldfieldtype': u'Data',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'default': u'No',
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'tds_applicable',
|
||||
'fieldtype': u'Select',
|
||||
'label': u'TDS Applicable',
|
||||
'oldfieldname': u'tds_applicable',
|
||||
'oldfieldtype': u'Select',
|
||||
'options': u'\nYes\nNo',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'tds_details',
|
||||
'fieldtype': u'Table',
|
||||
'label': u'TDS Details',
|
||||
'oldfieldname': u'tds_details',
|
||||
'oldfieldtype': u'Table',
|
||||
'options': u'TDS Detail',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'description': u"Don't delete this field at any cost",
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'old_parent',
|
||||
'fieldtype': u'Link',
|
||||
'hidden': 1,
|
||||
'label': u'Old Parent',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': u'old_parent',
|
||||
'oldfieldtype': u'Data',
|
||||
'options': u'Account',
|
||||
'permlevel': 0,
|
||||
'report_hide': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': u'White:FFF',
|
||||
'description': u"Don't delete this field at any cost",
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'lft',
|
||||
'fieldtype': u'Int',
|
||||
'hidden': 1,
|
||||
'in_filter': 1,
|
||||
'label': u'Lft',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': u'lft',
|
||||
'oldfieldtype': u'Int',
|
||||
'permlevel': 3,
|
||||
'print_hide': 1,
|
||||
'report_hide': 1,
|
||||
'search_index': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': u'White:FFF',
|
||||
'description': u"Don't delete this field at any cost",
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'rgt',
|
||||
'fieldtype': u'Int',
|
||||
'hidden': 1,
|
||||
'in_filter': 1,
|
||||
'label': u'Rgt',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': u'rgt',
|
||||
'oldfieldtype': u'Int',
|
||||
'permlevel': 3,
|
||||
'print_hide': 1,
|
||||
'report_hide': 1,
|
||||
'search_index': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'trash_reason',
|
||||
'fieldtype': u'Small Text',
|
||||
'label': u'Trash Reason',
|
||||
'oldfieldname': u'trash_reason',
|
||||
'oldfieldtype': u'Small Text',
|
||||
'permlevel': 1
|
||||
}
|
||||
]
|
@ -0,0 +1 @@
|
||||
from __future__ import unicode_literals
|
@ -0,0 +1 @@
|
||||
from __future__ import unicode_literals
|
@ -15,6 +15,7 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Please edit this list and import only required elements
|
||||
from __future__ import unicode_literals
|
||||
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
|
||||
|
@ -0,0 +1 @@
|
||||
from __future__ import unicode_literals
|
@ -0,0 +1 @@
|
||||
from __future__ import unicode_literals
|
@ -15,6 +15,7 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Please edit this list and import only required elements
|
||||
from __future__ import unicode_literals
|
||||
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
|
||||
|
@ -0,0 +1 @@
|
||||
from __future__ import unicode_literals
|
@ -0,0 +1 @@
|
||||
from __future__ import unicode_literals
|
@ -20,6 +20,11 @@ cur_frm.cscript.onload = function(doc,cdt,cdn){
|
||||
refresh_field('budget_distribution_details');
|
||||
}
|
||||
|
||||
$c('runserverobj',args={'method' : 'get_months', 'docs' : compress_doclist(make_doclist(doc.doctype, doc.name))},callback1);
|
||||
$c('runserverobj',args={'method' : 'get_months', 'docs' :
|
||||
compress_doclist(make_doclist(doc.doctype, doc.name))},callback1);
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.cscript.refresh = function(doc,cdt,cdn){
|
||||
cur_frm.toggle_display('distribution_id', doc.__islocal);
|
||||
}
|
@ -14,31 +14,21 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Please edit this list and import only required elements
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
|
||||
from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
|
||||
from webnotes.model import db_exists
|
||||
from webnotes.model.doc import Document, addchild, getchildren, make_autoname
|
||||
from webnotes.model.doclist import getlist, copy_doclist
|
||||
from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
|
||||
from webnotes import session, form, is_testing, msgprint, errprint
|
||||
|
||||
set = webnotes.conn.set
|
||||
sql = webnotes.conn.sql
|
||||
get_value = webnotes.conn.get_value
|
||||
in_transaction = webnotes.conn.in_transaction
|
||||
convert_to_lists = webnotes.conn.convert_to_lists
|
||||
|
||||
# -----------------------------------------------------------------------------------------
|
||||
|
||||
from webnotes.utils import flt
|
||||
from webnotes.model.doc import addchild
|
||||
from webnotes.model.doclist import getlist
|
||||
from webnotes import msgprint
|
||||
|
||||
class DocType:
|
||||
def __init__(self,doc,doclist=[]):
|
||||
self.doc,self.doclist = doc,doclist
|
||||
|
||||
def get_months(self):
|
||||
month_list = ['January','February','March','April','May','June','July','August','September','October','November','December']
|
||||
month_list = ['January','February','March','April','May','June','July','August','September',
|
||||
'October','November','December']
|
||||
idx =1
|
||||
for m in month_list:
|
||||
mnth = addchild(self.doc,'budget_distribution_details','Budget Distribution Detail',1,self.doclist)
|
||||
@ -50,9 +40,5 @@ class DocType:
|
||||
total = 0
|
||||
for d in getlist(self.doclist,'budget_distribution_details'):
|
||||
total = flt(total) + flt(d.percentage_allocation)
|
||||
if total > 100:
|
||||
msgprint("Percentage Allocation should not exceed 100%.")
|
||||
raise Exception
|
||||
elif total < 100:
|
||||
msgprint("Percentage Allocation should not recede 100%.")
|
||||
raise Exception
|
||||
if total != 100:
|
||||
msgprint("Percentage Allocation should be equal to 100%%. Currently it is %s%%" % total, raise_exception=1)
|
||||
|
@ -3,9 +3,9 @@
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2012-03-27 14:35:41',
|
||||
'creation': '2012-07-03 13:30:50',
|
||||
'docstatus': 0,
|
||||
'modified': '2012-03-27 14:35:41',
|
||||
'modified': '2012-07-11 14:37:30',
|
||||
'modified_by': u'Administrator',
|
||||
'owner': u'Administrator'
|
||||
},
|
||||
@ -15,6 +15,7 @@
|
||||
'allow_trash': 1,
|
||||
'autoname': u'field:distribution_id',
|
||||
'colour': u'White:FFF',
|
||||
'description': u'**Budget Distribution** helps you distribute your budget across months if you have seasonality in your business.\n\nTo distribute a budget using this distribution, set this **Budget Distribution** in the **Cost Center**',
|
||||
'doctype': 'DocType',
|
||||
'module': u'Accounts',
|
||||
'name': '__common__',
|
||||
@ -22,7 +23,7 @@
|
||||
'section_style': u'Simple',
|
||||
'server_code_error': u' ',
|
||||
'show_in_menu': 0,
|
||||
'version': 24
|
||||
'version': 1
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
@ -108,13 +109,16 @@
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': u'White:FFF',
|
||||
'description': u'Name of the Budget Distribution',
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'distribution_id',
|
||||
'fieldtype': u'Data',
|
||||
'label': u'Distribution ID',
|
||||
'label': u'Distribution Name',
|
||||
'oldfieldname': u'distribution_id',
|
||||
'oldfieldtype': u'Data',
|
||||
'permlevel': 0
|
||||
'permlevel': 0,
|
||||
'reqd': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
|
@ -0,0 +1 @@
|
||||
from __future__ import unicode_literals
|
@ -3,9 +3,9 @@
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2012-03-27 14:35:41',
|
||||
'creation': '2012-07-03 13:30:47',
|
||||
'docstatus': 0,
|
||||
'modified': '2012-03-27 14:35:41',
|
||||
'modified': '2012-07-11 14:32:16',
|
||||
'modified_by': u'Administrator',
|
||||
'owner': u'Administrator'
|
||||
},
|
||||
@ -21,7 +21,7 @@
|
||||
'section_style': u'Tray',
|
||||
'server_code_error': u' ',
|
||||
'show_in_menu': 0,
|
||||
'version': 6
|
||||
'version': 1
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
@ -60,16 +60,5 @@
|
||||
'oldfieldname': u'percentage_allocation',
|
||||
'oldfieldtype': u'Currency',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'aggregate_percentage',
|
||||
'fieldtype': u'Currency',
|
||||
'label': u'Aggregate Percentage',
|
||||
'oldfieldname': u'aggregate_percentage',
|
||||
'oldfieldtype': u'Currency',
|
||||
'permlevel': 2
|
||||
}
|
||||
]
|
@ -0,0 +1 @@
|
||||
from __future__ import unicode_literals
|
@ -15,6 +15,7 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Please edit this list and import only required elements
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
from webnotes.utils import add_days, cint, cstr, date_diff, default_fields, flt, getdate, now, nowdate
|
||||
from webnotes.model.doc import Document, addchild, getchildren, make_autoname
|
||||
|
@ -0,0 +1 @@
|
||||
from __future__ import unicode_literals
|
@ -0,0 +1 @@
|
||||
from __future__ import unicode_literals
|
@ -14,7 +14,29 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
|
||||
cur_frm.cscript.set_breadcrumbs = function(barea) {
|
||||
cur_frm.frm_head.appframe.add_breadcrumb(cur_frm.docname);
|
||||
cur_frm.frm_head.appframe.add_breadcrumb(' in <a href="#!Accounts Browser/Cost Center">\
|
||||
Chart of Cost Centers</a>');
|
||||
cur_frm.frm_head.appframe.add_breadcrumb(' in <a href="#!accounts-home">Accounts</a>');
|
||||
}
|
||||
|
||||
cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
||||
var intro_txt = '';
|
||||
cur_frm.toggle_display('cost_center_name', doc.__islocal);
|
||||
cur_frm.toggle_enable(['group_or_ledger', 'company_name'], doc.__islocal);
|
||||
|
||||
if(!doc.__islocal && doc.group_or_ledger=='Group') {
|
||||
intro_txt += '<p><b>Note:</b> This is Cost Center is a <i>Group</i>, \
|
||||
Accounting Entries are not allowed against groups.</p>';
|
||||
}
|
||||
|
||||
cur_frm.cscript.hide_unhide_group_ledger(doc);
|
||||
|
||||
cur_frm.toggle_display('sb1', doc.group_or_ledger=='Ledger')
|
||||
cur_frm.set_intro(intro_txt);
|
||||
}
|
||||
|
||||
//Account filtering for cost center
|
||||
cur_frm.fields_dict['budget_details'].grid.get_field('account').get_query = function(doc) {
|
||||
@ -38,39 +60,25 @@ cur_frm.cscript.company_name = function(doc,cdt,cdn){
|
||||
get_server_fields('get_abbr','','',doc,cdt,cdn,1);
|
||||
}
|
||||
|
||||
//onload if cost center is group
|
||||
cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
||||
|
||||
if(!doc.__islocal && doc.docstatus == 0){
|
||||
get_field(doc.doctype,'group_or_ledger',doc.name).permlevel = 1;
|
||||
refresh_field('group_or_ledger');
|
||||
get_field(doc.doctype,'company_name',doc.name).permlevel = 1;
|
||||
refresh_field('company_name');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
||||
cur_frm.cscript.hide_unhide_group_ledger(doc);
|
||||
}
|
||||
|
||||
|
||||
// Hide/unhide group or ledger
|
||||
// -----------------------------------------
|
||||
cur_frm.cscript.hide_unhide_group_ledger = function(doc) {
|
||||
hide_field(['convert_to_group', 'convert_to_ledger']);
|
||||
if (cstr(doc.group_or_ledger) == 'Group') unhide_field('convert_to_ledger');
|
||||
else if (cstr(doc.group_or_ledger) == 'Ledger') unhide_field('convert_to_group');
|
||||
if (cstr(doc.group_or_ledger) == 'Group') {
|
||||
cur_frm.add_custom_button('Convert to Ledger',
|
||||
function() { cur_frm.cscript.convert_to_ledger(); }, 'icon-retweet')
|
||||
} else if (cstr(doc.group_or_ledger) == 'Ledger') {
|
||||
cur_frm.add_custom_button('Convert to Group',
|
||||
function() { cur_frm.cscript.convert_to_group(); }, 'icon-retweet')
|
||||
}
|
||||
}
|
||||
|
||||
// Convert group to ledger
|
||||
// -----------------------------------------
|
||||
cur_frm.cscript.convert_to_ledger = function(doc, cdt, cdn) {
|
||||
$c_obj(make_doclist(cdt,cdn),'convert_group_to_ledger','',function(r,rt) {
|
||||
$c_obj(cur_frm.get_doclist(),'convert_group_to_ledger','',function(r,rt) {
|
||||
if(r.message == 1) {
|
||||
doc.group_or_ledger = 'Ledger';
|
||||
refresh_field('group_or_ledger');
|
||||
cur_frm.cscript.hide_unhide_group_ledger(doc);
|
||||
cur_frm.refresh();
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -78,11 +86,9 @@ cur_frm.cscript.convert_to_ledger = function(doc, cdt, cdn) {
|
||||
// Convert ledger to group
|
||||
// -----------------------------------------
|
||||
cur_frm.cscript.convert_to_group = function(doc, cdt, cdn) {
|
||||
$c_obj(make_doclist(cdt,cdn),'convert_ledger_to_group','',function(r,rt) {
|
||||
$c_obj(cur_frm.get_doclist(),'convert_ledger_to_group','',function(r,rt) {
|
||||
if(r.message == 1) {
|
||||
doc.group_or_ledger = 'Group';
|
||||
refresh_field('group_or_ledger');
|
||||
cur_frm.cscript.hide_unhide_group_ledger(doc);
|
||||
cur_frm.refresh();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -14,26 +14,14 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Please edit this list and import only required elements
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
from webnotes.model.doclist import getlist
|
||||
from webnotes import msgprint
|
||||
|
||||
from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
|
||||
from webnotes.model import db_exists
|
||||
from webnotes.model.doc import Document, addchild, getchildren, make_autoname
|
||||
from webnotes.model.doclist import getlist, copy_doclist
|
||||
from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
|
||||
from webnotes import session, form, is_testing, msgprint, errprint
|
||||
from webnotes.utils.nestedset import DocTypeNestedSet
|
||||
|
||||
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:
|
||||
class DocType(DocTypeNestedSet):
|
||||
def __init__(self,d,dl):
|
||||
self.doc, self.doclist = d,dl
|
||||
self.nsm_parent_field = 'parent_cost_center'
|
||||
@ -41,9 +29,9 @@ class DocType:
|
||||
def autoname(self):
|
||||
self.doc.name = self.doc.cost_center_name + ' - ' + self.doc.company_abbr
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
def get_abbr(self):
|
||||
abbr = sql("select abbr from tabCompany where company_name='%s'"%(self.doc.company_name))[0][0] or ''
|
||||
abbr = webnotes.conn.sql("select abbr from tabCompany where company_name=%s",
|
||||
self.doc.company_name)[0][0] or ''
|
||||
ret = {
|
||||
'company_abbr' : abbr
|
||||
}
|
||||
@ -56,7 +44,6 @@ class DocType:
|
||||
if self.doc.cost_center_name != 'Root' and not self.doc.parent_cost_center:
|
||||
msgprint("Please enter parent cost center", raise_exception=1)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
def convert_group_to_ledger(self):
|
||||
if self.check_if_child_exists():
|
||||
msgprint("Cost Center: %s has existing child. You can not convert this cost center to ledger" % (self.doc.name), raise_exception=1)
|
||||
@ -67,7 +54,6 @@ class DocType:
|
||||
self.doc.save()
|
||||
return 1
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
def convert_ledger_to_group(self):
|
||||
if self.check_gle_exists():
|
||||
msgprint("Cost Center with existing transaction can not be converted to group.", raise_exception=1)
|
||||
@ -76,54 +62,31 @@ class DocType:
|
||||
self.doc.save()
|
||||
return 1
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
def check_gle_exists(self):
|
||||
return sql("select name from `tabGL Entry` where cost_center = %s and ifnull(is_cancelled, 'No') = 'No'", (self.doc.name))
|
||||
return webnotes.conn.sql("select name from `tabGL Entry` where cost_center = %s and \
|
||||
ifnull(is_cancelled, 'No') = 'No'", (self.doc.name))
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
def check_if_child_exists(self):
|
||||
return sql("select name from `tabCost Center` where parent_cost_center = %s and docstatus != 2", self.doc.name)
|
||||
|
||||
return webnotes.conn.sql("select name from `tabCost Center` where \
|
||||
parent_cost_center = %s and docstatus != 2", self.doc.name)
|
||||
|
||||
def validate_budget_details(self):
|
||||
check_acc_list = []
|
||||
for d in getlist(self.doclist, 'budget_details'):
|
||||
if self.doc.group_or_ledger=="Group":
|
||||
msgprint("Budget cannot be set for Group Cost Centers", raise_exception=1)
|
||||
|
||||
if [d.account, d.fiscal_year] in check_acc_list:
|
||||
msgprint("Account " + cstr(d.account) + "has been entered more than once for fiscal year " + cstr(d.fiscal_year), raise_exception=1)
|
||||
msgprint("Account " + d.account + "has been entered more than once for fiscal year " + d.fiscal_year, raise_exception=1)
|
||||
else:
|
||||
check_acc_list.append([d.account, d.fiscal_year])
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
def validate(self):
|
||||
"""
|
||||
Cost Center name must be unique
|
||||
"""
|
||||
if (self.doc.__islocal or not self.doc.name) and sql("select name from `tabCost Center` where cost_center_name = %s and company_name=%s", (self.doc.cost_center_name, self.doc.company_name)):
|
||||
if (self.doc.__islocal or not self.doc.name) and webnotes.conn.sql("select name from `tabCost Center` where cost_center_name = %s and company_name=%s", (self.doc.cost_center_name, self.doc.company_name)):
|
||||
msgprint("Cost Center Name already exists, please rename", raise_exception=1)
|
||||
|
||||
self.validate_mandatory()
|
||||
self.validate_budget_details()
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
def update_nsm_model(self):
|
||||
"""
|
||||
update Nested Set Model
|
||||
"""
|
||||
import webnotes.utils.nestedset
|
||||
webnotes.utils.nestedset.update_nsm(self)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
def on_update(self):
|
||||
self.update_nsm_model()
|
||||
|
||||
# On Trash
|
||||
#-------------------------------------------------------------------------
|
||||
def on_trash(self):
|
||||
if self.check_if_child_exists():
|
||||
msgprint("Child exists for this cost center. You can not trash this account.", raise_exception=1)
|
||||
|
||||
# rebuild tree
|
||||
set(self.doc,'old_parent', '')
|
||||
self.update_nsm_model()
|
||||
|
@ -3,9 +3,9 @@
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2012-03-27 14:35:41',
|
||||
'creation': '2012-07-03 13:30:47',
|
||||
'docstatus': 0,
|
||||
'modified': '2012-03-27 14:35:41',
|
||||
'modified': '2012-07-11 14:41:39',
|
||||
'modified_by': u'Administrator',
|
||||
'owner': u'Administrator'
|
||||
},
|
||||
@ -18,6 +18,7 @@
|
||||
'autoname': u'field:cost_center_name',
|
||||
'colour': u'White:FFF',
|
||||
'default_print_format': u'Standard',
|
||||
'description': u'**Chart of Accounts** is mainly for reporting information for governmental purposes and less for how business actually performs. \n\nMost businesses have multiple activities like different product lines, market segments, areas of business that share some common overheads but should ideally have their own structure to report whether they are profitable or not. For this purpose, there is an alternate structure, called the **Cost Centers**.\n\nA tree of **Cost Centers** to cab be designed to reflect the different units of an organization. Each Income / Expense entry is also tagged against a **Cost Center** and hence you can get Profit and Loss against a **Cost Center** too.\n\n### Budgeting\n\n**Cost Centers** can be used for budgeting purposes too. A budget can be set against each **Account** and the system will either stop, warn or ignore the budget based on the settings in the **Company** master.\n\nBudgets can also be distributed seasonally using **Budget Distribution**.',
|
||||
'doctype': 'DocType',
|
||||
'document_type': u'Master',
|
||||
'in_create': 1,
|
||||
@ -27,7 +28,7 @@
|
||||
'section_style': u'Simple',
|
||||
'server_code_error': u' ',
|
||||
'show_in_menu': 0,
|
||||
'version': 109
|
||||
'version': 1
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
@ -55,6 +56,42 @@
|
||||
'name': u'Cost Center'
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'amend': 0,
|
||||
'cancel': 0,
|
||||
'create': 0,
|
||||
'doctype': u'DocPerm',
|
||||
'permlevel': 1,
|
||||
'role': u'Accounts Manager',
|
||||
'submit': 0,
|
||||
'write': 0
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'amend': 0,
|
||||
'cancel': 1,
|
||||
'create': 1,
|
||||
'doctype': u'DocPerm',
|
||||
'permlevel': 0,
|
||||
'role': u'Accounts Manager',
|
||||
'submit': 0,
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'amend': 0,
|
||||
'cancel': 0,
|
||||
'create': 0,
|
||||
'doctype': u'DocPerm',
|
||||
'permlevel': 1,
|
||||
'role': u'Accounts User',
|
||||
'submit': 0,
|
||||
'write': 0
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'amend': 0,
|
||||
@ -84,40 +121,13 @@
|
||||
'role': u'All'
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
# DocField
|
||||
{
|
||||
'amend': 0,
|
||||
'cancel': 0,
|
||||
'create': 0,
|
||||
'doctype': u'DocPerm',
|
||||
'permlevel': 1,
|
||||
'role': u'Accounts Manager',
|
||||
'submit': 0,
|
||||
'write': 0
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'amend': 0,
|
||||
'cancel': 1,
|
||||
'create': 1,
|
||||
'doctype': u'DocPerm',
|
||||
'permlevel': 0,
|
||||
'role': u'Accounts Manager',
|
||||
'submit': 0,
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'amend': 0,
|
||||
'cancel': 0,
|
||||
'create': 0,
|
||||
'doctype': u'DocPerm',
|
||||
'permlevel': 1,
|
||||
'role': u'Accounts User',
|
||||
'submit': 0,
|
||||
'write': 0
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'sb0',
|
||||
'fieldtype': u'Section Break',
|
||||
'label': u'Cost Center Details',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
@ -148,7 +158,7 @@
|
||||
|
||||
# DocField
|
||||
{
|
||||
'description': u'Select company name first.',
|
||||
'colour': u'White:FFF',
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'parent_cost_center',
|
||||
'fieldtype': u'Link',
|
||||
@ -178,15 +188,26 @@
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': u'White:FFF',
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'company_abbr',
|
||||
'fieldtype': u'Data',
|
||||
'hidden': 1,
|
||||
'label': u'Company Abbr',
|
||||
'oldfieldname': u'company_abbr',
|
||||
'oldfieldtype': u'Data',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'cb0',
|
||||
'fieldtype': u'Column Break',
|
||||
'permlevel': 0,
|
||||
'width': u'50%'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': u'White:FFF',
|
||||
@ -209,27 +230,18 @@
|
||||
# DocField
|
||||
{
|
||||
'colour': u'White:FFF',
|
||||
'description': u'Define Budget for this Cost Center. To set budget action, see <a href="#!List/Company">Company Master</a>',
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'convert_to_group',
|
||||
'fieldtype': u'Button',
|
||||
'label': u'Convert to Group',
|
||||
'permlevel': 0,
|
||||
'trigger': u'Client'
|
||||
'fieldname': u'sb1',
|
||||
'fieldtype': u'Section Break',
|
||||
'label': u'Budget',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': u'White:FFF',
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'convert_to_ledger',
|
||||
'fieldtype': u'Button',
|
||||
'label': u'Convert to Ledger',
|
||||
'permlevel': 0,
|
||||
'trigger': u'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'description': u'Select Budget Distribution, if you want to track based on seasonality.',
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'distribution_id',
|
||||
'fieldtype': u'Link',
|
||||
@ -242,6 +254,8 @@
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': u'White:FFF',
|
||||
'description': u'Add rows to set annual budgets on Accounts.',
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'budget_details',
|
||||
'fieldtype': u'Table',
|
||||
|
@ -0,0 +1 @@
|
||||
from __future__ import unicode_literals
|
@ -1,7 +1,3 @@
|
||||
cur_frm.cscript.refresh = function(doc, dt, dn) {
|
||||
if (doc.__islocal) {
|
||||
hide_field(['repost_account_balances', 'repost_voucher_outstanding']);
|
||||
set_multiple(dt, dn, {'is_fiscal_year_closed': 'No'});
|
||||
}
|
||||
else unhide_field(['repost_account_balances', 'repost_voucher_outstanding']);
|
||||
cur_frm.toggle_enable('year_start_date', doc.__islocal)
|
||||
}
|
||||
|
@ -15,6 +15,7 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Please edit this list and import only required elements
|
||||
from __future__ import unicode_literals
|
||||
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
|
||||
@ -209,9 +210,6 @@ class DocType:
|
||||
if sql("select name from `tabFiscal Year` where year_start_date < %s", self.doc.year_start_date) and not self.doc.past_year:
|
||||
msgprint("Please enter Past Year", raise_exception=1)
|
||||
|
||||
if not self.doc.is_fiscal_year_closed:
|
||||
self.doc.is_fiscal_year_closed = 'No'
|
||||
|
||||
|
||||
# on update
|
||||
def on_update(self):
|
||||
|
@ -3,9 +3,9 @@
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2012-03-27 14:35:41',
|
||||
'creation': '2012-07-03 13:30:47',
|
||||
'docstatus': 0,
|
||||
'modified': '2012-03-27 14:35:41',
|
||||
'modified': '2012-07-11 14:56:41',
|
||||
'modified_by': u'Administrator',
|
||||
'owner': u'Administrator'
|
||||
},
|
||||
@ -17,6 +17,7 @@
|
||||
'autoname': u'field:year',
|
||||
'colour': u'White:FFF',
|
||||
'default_print_format': u'Standard',
|
||||
'description': u'**Fiscal Year** represents a Financial Year. All accounting entries and other major transactions are tracked against **Fiscal Year**.',
|
||||
'doctype': 'DocType',
|
||||
'document_type': u'Master',
|
||||
'module': u'Accounts',
|
||||
@ -24,7 +25,7 @@
|
||||
'section_style': u'Tabbed',
|
||||
'server_code_error': u' ',
|
||||
'show_in_menu': 0,
|
||||
'version': 57
|
||||
'version': 1
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
@ -59,14 +60,14 @@
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'doctype': u'DocPerm'
|
||||
'amend': 0,
|
||||
'doctype': u'DocPerm',
|
||||
'submit': 0
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'amend': 0,
|
||||
'doctype': u'DocPerm',
|
||||
'submit': 0
|
||||
'doctype': u'DocPerm'
|
||||
},
|
||||
|
||||
# DocField
|
||||
@ -74,7 +75,7 @@
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'year_details',
|
||||
'fieldtype': u'Section Break',
|
||||
'label': u'Year Details',
|
||||
'label': u'Fiscal Year Details',
|
||||
'oldfieldtype': u'Section Break',
|
||||
'permlevel': 0
|
||||
},
|
||||
@ -92,6 +93,8 @@
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': u'White:FFF',
|
||||
'description': u'For e.g. 2012, 2012-13',
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'year',
|
||||
'fieldtype': u'Data',
|
||||
@ -102,18 +105,6 @@
|
||||
'reqd': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'abbreviation',
|
||||
'fieldtype': u'Data',
|
||||
'label': u'Abbreviation',
|
||||
'oldfieldname': u'abbreviation',
|
||||
'oldfieldtype': u'Data',
|
||||
'permlevel': 0,
|
||||
'reqd': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
@ -128,6 +119,9 @@
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': u'White:FFF',
|
||||
'default': u'No',
|
||||
'description': u'Entries are not allowed against this Fiscal Year if the year is closed.',
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'is_fiscal_year_closed',
|
||||
'fieldtype': u'Select',
|
||||
@ -137,65 +131,5 @@
|
||||
'options': u'\nNo\nYes',
|
||||
'permlevel': 0,
|
||||
'reqd': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': u'White:FFF',
|
||||
'description': u"Click on the button below to reset balances from your previous year's closing and repost your balances. You can use this if your previous year balance sheet has been changed and you wish to update your current accounts.",
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'repost_accounts',
|
||||
'fieldtype': u'Section Break',
|
||||
'label': u'Repost Accounts',
|
||||
'oldfieldtype': u'Section Break',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'past_year',
|
||||
'fieldtype': u'Select',
|
||||
'label': u'Past Year',
|
||||
'oldfieldname': u'past_year',
|
||||
'oldfieldtype': u'Select',
|
||||
'options': u'link:Fiscal Year',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'company',
|
||||
'fieldtype': u'Link',
|
||||
'in_filter': 0,
|
||||
'label': u'Company',
|
||||
'oldfieldname': u'company',
|
||||
'oldfieldtype': u'Link',
|
||||
'options': u'Company',
|
||||
'permlevel': 0,
|
||||
'search_index': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'repost_account_balances',
|
||||
'fieldtype': u'Button',
|
||||
'label': u'Repost Account Balances',
|
||||
'oldfieldtype': u'Button',
|
||||
'options': u'repost',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'repost_voucher_outstanding',
|
||||
'fieldtype': u'Button',
|
||||
'label': u'Repost Voucher Outstanding',
|
||||
'oldfieldtype': u'Button',
|
||||
'options': u'update_voucher_outstanding',
|
||||
'permlevel': 0
|
||||
}
|
||||
]
|
@ -0,0 +1 @@
|
||||
from __future__ import unicode_literals
|
@ -15,6 +15,7 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Please edit this list and import only required elements
|
||||
from __future__ import unicode_literals
|
||||
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
|
||||
|
@ -0,0 +1 @@
|
||||
from __future__ import unicode_literals
|
@ -0,0 +1 @@
|
||||
from __future__ import unicode_literals
|
@ -0,0 +1 @@
|
||||
from __future__ import unicode_literals
|
@ -15,6 +15,7 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Please edit this list and import only required elements
|
||||
from __future__ import unicode_literals
|
||||
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
|
||||
@ -124,6 +125,7 @@ class DocType:
|
||||
ac.fields[d] = arg[d]
|
||||
ac.old_parent = ''
|
||||
ac_obj = get_obj(doc=ac)
|
||||
ac_obj.doc.freeze_account='No'
|
||||
ac_obj.validate()
|
||||
ac_obj.doc.save(1)
|
||||
ac_obj.on_update()
|
||||
@ -663,4 +665,4 @@ def send_notification(new_rv):
|
||||
|
||||
msg = hd + tbl + totals
|
||||
recipients = new_rv.doc.notification_email_address.replace('\n', '').replace(' ', '').split(",")
|
||||
sendmail(recipients, subject=subject, msg = msg)
|
||||
sendmail(recipients, subject=subject, msg = msg)
|
||||
|
@ -0,0 +1 @@
|
||||
from __future__ import unicode_literals
|
@ -15,6 +15,7 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Please edit this list and import only required elements
|
||||
from __future__ import unicode_literals
|
||||
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
|
||||
|
@ -0,0 +1 @@
|
||||
from __future__ import unicode_literals
|
@ -15,6 +15,7 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Please edit this list and import only required elements
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
|
||||
from webnotes.utils import cint, cstr, flt, fmt_money, formatdate, getTraceback, get_defaults, getdate, has_common, month_name, now, nowdate, sendmail, set_default, str_esc_quote, user_format, validate_email_add
|
||||
|
@ -0,0 +1 @@
|
||||
from __future__ import unicode_literals
|
@ -0,0 +1 @@
|
||||
from __future__ import unicode_literals
|
@ -14,6 +14,7 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
from webnotes.model.doc import make_autoname, Document, addchild
|
||||
from webnotes import msgprint
|
||||
|
@ -0,0 +1 @@
|
||||
from __future__ import unicode_literals
|
@ -0,0 +1 @@
|
||||
from __future__ import unicode_literals
|
@ -15,6 +15,7 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Please edit this list and import only required elements
|
||||
from __future__ import unicode_literals
|
||||
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
|
||||
|
@ -0,0 +1 @@
|
||||
from __future__ import unicode_literals
|
@ -0,0 +1 @@
|
||||
from __future__ import unicode_literals
|
@ -14,6 +14,7 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
from webnotes.utils import add_days, cint, cstr, flt, getdate
|
||||
from webnotes.model.doclist import getlist
|
||||
|
@ -0,0 +1 @@
|
||||
from __future__ import unicode_literals
|
@ -0,0 +1 @@
|
||||
from __future__ import unicode_literals
|
@ -15,6 +15,7 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Please edit this list and import only required elements
|
||||
from __future__ import unicode_literals
|
||||
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
|
||||
|
@ -14,6 +14,7 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import unittest
|
||||
import webnotes
|
||||
|
||||
|
@ -0,0 +1 @@
|
||||
from __future__ import unicode_literals
|
@ -0,0 +1 @@
|
||||
from __future__ import unicode_literals
|
@ -15,6 +15,7 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Please edit this list and import only required elements
|
||||
from __future__ import unicode_literals
|
||||
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
|
||||
@ -62,12 +63,12 @@ class DocType:
|
||||
|
||||
|
||||
def validate_posting_date(self):
|
||||
yr = sql("select start_date, end_date from `tabPeriod` where period_name = '%s'" % (self.doc.fiscal_year))
|
||||
yr = sql("select start_date, end_date from `tabPeriod` where fiscal_year = '%s' and period_type = 'Year'" % (self.doc.fiscal_year))
|
||||
self.year_start_date = yr and yr[0][0] or ''
|
||||
self.year_end_date = yr and yr[0][1] or ''
|
||||
|
||||
# Posting Date should be within closing year
|
||||
if getdate(self.doc.posting_date) < self.year_start_date or getdate(self.doc.posting_date) > self.year_end_date:
|
||||
if getdate(self.doc.posting_date) < getdate(self.year_start_date) or getdate(self.doc.posting_date) > getdate(self.year_end_date):
|
||||
msgprint("Posting Date should be within Closing Fiscal Year")
|
||||
raise Exception
|
||||
|
||||
|
@ -0,0 +1 @@
|
||||
from __future__ import unicode_literals
|
@ -15,6 +15,7 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Please edit this list and import only required elements
|
||||
from __future__ import unicode_literals
|
||||
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
|
||||
|
@ -3,9 +3,9 @@
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2012-03-27 14:35:46',
|
||||
'creation': '2012-06-11 12:09:53',
|
||||
'docstatus': 0,
|
||||
'modified': '2012-03-27 14:35:46',
|
||||
'modified': '2012-07-16 16:27:51',
|
||||
'modified_by': u'Administrator',
|
||||
'owner': u'Administrator'
|
||||
},
|
||||
@ -22,7 +22,7 @@
|
||||
'section_style': u'Simple',
|
||||
'server_code_error': u' ',
|
||||
'show_in_menu': 0,
|
||||
'version': 33
|
||||
'version': 1
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
@ -52,37 +52,6 @@
|
||||
'name': u'POS Setting'
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'create': 1,
|
||||
'doctype': u'DocPerm',
|
||||
'role': u'System Manager',
|
||||
'submit': 0,
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'create': 1,
|
||||
'doctype': u'DocPerm',
|
||||
'role': u'System Manager',
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'create': 1,
|
||||
'doctype': u'DocPerm',
|
||||
'role': u'Accounts Manager',
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'doctype': u'DocPerm',
|
||||
'role': u'Accounts User'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
@ -136,7 +105,7 @@
|
||||
'default': u'1',
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'conversion_rate',
|
||||
'fieldtype': u'Currency',
|
||||
'fieldtype': u'Float',
|
||||
'label': u'Conversion Rate',
|
||||
'oldfieldname': u'conversion_rate',
|
||||
'oldfieldtype': u'Currency',
|
||||
@ -279,5 +248,36 @@
|
||||
'oldfieldname': u'select_print_heading',
|
||||
'oldfieldtype': u'Select',
|
||||
'options': u'link:Print Heading'
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'create': 1,
|
||||
'doctype': u'DocPerm',
|
||||
'role': u'System Manager',
|
||||
'submit': 0,
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'create': 1,
|
||||
'doctype': u'DocPerm',
|
||||
'role': u'System Manager',
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'create': 1,
|
||||
'doctype': u'DocPerm',
|
||||
'role': u'Accounts Manager',
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'doctype': u'DocPerm',
|
||||
'role': u'Accounts User'
|
||||
}
|
||||
]
|
@ -0,0 +1 @@
|
||||
from __future__ import unicode_literals
|
@ -15,6 +15,7 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Please edit this list and import only required elements
|
||||
from __future__ import unicode_literals
|
||||
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
|
||||
|
@ -3,9 +3,9 @@
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2012-04-13 11:56:17',
|
||||
'creation': '2012-06-11 12:09:53',
|
||||
'docstatus': 0,
|
||||
'modified': '2012-05-10 14:02:05',
|
||||
'modified': '2012-07-16 16:26:02',
|
||||
'modified_by': u'Administrator',
|
||||
'owner': u'Administrator'
|
||||
},
|
||||
@ -54,81 +54,6 @@
|
||||
'name': u'Purchase Invoice'
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'amend': 0,
|
||||
'cancel': 0,
|
||||
'create': 0,
|
||||
'doctype': u'DocPerm',
|
||||
'permlevel': 1,
|
||||
'role': u'Accounts Manager',
|
||||
'submit': 0,
|
||||
'write': 0
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'amend': 1,
|
||||
'cancel': 1,
|
||||
'create': 1,
|
||||
'doctype': u'DocPerm',
|
||||
'permlevel': 0,
|
||||
'role': u'Accounts Manager',
|
||||
'submit': 1,
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'amend': 0,
|
||||
'cancel': 0,
|
||||
'create': 0,
|
||||
'doctype': u'DocPerm',
|
||||
'permlevel': 1,
|
||||
'role': u'Accounts User',
|
||||
'submit': 0,
|
||||
'write': 0
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'doctype': u'DocPerm',
|
||||
'permlevel': 1,
|
||||
'role': u'Purchase User'
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'amend': 0,
|
||||
'cancel': 0,
|
||||
'create': 1,
|
||||
'doctype': u'DocPerm',
|
||||
'permlevel': 0,
|
||||
'role': u'Purchase User',
|
||||
'submit': 0,
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'amend': 1,
|
||||
'cancel': 1,
|
||||
'create': 1,
|
||||
'doctype': u'DocPerm',
|
||||
'permlevel': 0,
|
||||
'role': u'Accounts User',
|
||||
'submit': 1,
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'doctype': u'DocPerm',
|
||||
'match': u'supplier',
|
||||
'permlevel': 0,
|
||||
'role': u'Supplier'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'allow_on_submit': 0,
|
||||
@ -381,7 +306,7 @@
|
||||
'description': u"The rate at which Bill Currency is converted into company's base currency",
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'conversion_rate',
|
||||
'fieldtype': u'Currency',
|
||||
'fieldtype': u'Float',
|
||||
'label': u'Bill Conversion Rate',
|
||||
'oldfieldname': u'conversion_rate',
|
||||
'oldfieldtype': u'Currency',
|
||||
@ -1193,5 +1118,80 @@
|
||||
'no_copy': 1,
|
||||
'permlevel': 0,
|
||||
'print_hide': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'amend': 0,
|
||||
'cancel': 0,
|
||||
'create': 0,
|
||||
'doctype': u'DocPerm',
|
||||
'permlevel': 1,
|
||||
'role': u'Accounts Manager',
|
||||
'submit': 0,
|
||||
'write': 0
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'amend': 1,
|
||||
'cancel': 1,
|
||||
'create': 1,
|
||||
'doctype': u'DocPerm',
|
||||
'permlevel': 0,
|
||||
'role': u'Accounts Manager',
|
||||
'submit': 1,
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'amend': 0,
|
||||
'cancel': 0,
|
||||
'create': 0,
|
||||
'doctype': u'DocPerm',
|
||||
'permlevel': 1,
|
||||
'role': u'Accounts User',
|
||||
'submit': 0,
|
||||
'write': 0
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'doctype': u'DocPerm',
|
||||
'permlevel': 1,
|
||||
'role': u'Purchase User'
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'amend': 0,
|
||||
'cancel': 0,
|
||||
'create': 1,
|
||||
'doctype': u'DocPerm',
|
||||
'permlevel': 0,
|
||||
'role': u'Purchase User',
|
||||
'submit': 0,
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'amend': 1,
|
||||
'cancel': 1,
|
||||
'create': 1,
|
||||
'doctype': u'DocPerm',
|
||||
'permlevel': 0,
|
||||
'role': u'Accounts User',
|
||||
'submit': 1,
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'doctype': u'DocPerm',
|
||||
'match': u'supplier',
|
||||
'permlevel': 0,
|
||||
'role': u'Supplier'
|
||||
}
|
||||
]
|
@ -0,0 +1 @@
|
||||
from __future__ import unicode_literals
|
@ -0,0 +1 @@
|
||||
from __future__ import unicode_literals
|
@ -0,0 +1 @@
|
||||
from __future__ import unicode_literals
|
@ -3,9 +3,9 @@
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2012-03-27 14:35:46',
|
||||
'creation': '2012-07-03 13:30:49',
|
||||
'docstatus': 0,
|
||||
'modified': '2012-03-27 14:35:46',
|
||||
'modified': '2012-07-12 14:08:27',
|
||||
'modified_by': u'Administrator',
|
||||
'owner': u'wasim@webnotestech.com'
|
||||
},
|
||||
@ -24,7 +24,7 @@
|
||||
'section_style': u'Tray',
|
||||
'server_code_error': u' ',
|
||||
'show_in_menu': 0,
|
||||
'version': 13
|
||||
'version': 1
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
@ -42,34 +42,6 @@
|
||||
'name': u'Purchase Taxes and Charges'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'category',
|
||||
'fieldtype': u'Select',
|
||||
'label': u'Category',
|
||||
'oldfieldname': u'category',
|
||||
'oldfieldtype': u'Select',
|
||||
'options': u'\nFor Total\nFor Valuation\nFor Both',
|
||||
'permlevel': 0,
|
||||
'reqd': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'default': u'Add',
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'add_deduct_tax',
|
||||
'fieldtype': u'Select',
|
||||
'label': u'Add or Deduct',
|
||||
'oldfieldname': u'add_deduct_tax',
|
||||
'oldfieldtype': u'Select',
|
||||
'options': u'\nAdd\nDeduct',
|
||||
'permlevel': 0,
|
||||
'reqd': 1,
|
||||
'trigger': u'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
@ -84,46 +56,6 @@
|
||||
'trigger': u'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'row_id',
|
||||
'fieldtype': u'Data',
|
||||
'hidden': 0,
|
||||
'label': u'Enter Row',
|
||||
'oldfieldname': u'row_id',
|
||||
'oldfieldtype': u'Data',
|
||||
'permlevel': 0,
|
||||
'trigger': u'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': u'White:FFF',
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'item_wise_tax_detail',
|
||||
'fieldtype': u'Small Text',
|
||||
'hidden': 1,
|
||||
'label': u'Item Wise Tax Detail ',
|
||||
'oldfieldname': u'item_wise_tax_detail',
|
||||
'oldfieldtype': u'Small Text',
|
||||
'permlevel': 1,
|
||||
'print_hide': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'description',
|
||||
'fieldtype': u'Small Text',
|
||||
'label': u'Description',
|
||||
'oldfieldname': u'description',
|
||||
'oldfieldtype': u'Small Text',
|
||||
'permlevel': 0,
|
||||
'reqd': 1,
|
||||
'width': u'300px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
@ -151,6 +83,19 @@
|
||||
'trigger': u'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'description',
|
||||
'fieldtype': u'Small Text',
|
||||
'label': u'Description',
|
||||
'oldfieldname': u'description',
|
||||
'oldfieldtype': u'Small Text',
|
||||
'permlevel': 0,
|
||||
'reqd': 1,
|
||||
'width': u'300px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
@ -182,12 +127,70 @@
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'total',
|
||||
'fieldtype': u'Currency',
|
||||
'label': u'Aggregate Total',
|
||||
'label': u'Total',
|
||||
'oldfieldname': u'total',
|
||||
'oldfieldtype': u'Currency',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'row_id',
|
||||
'fieldtype': u'Data',
|
||||
'hidden': 0,
|
||||
'label': u'Enter Row',
|
||||
'oldfieldname': u'row_id',
|
||||
'oldfieldtype': u'Data',
|
||||
'permlevel': 0,
|
||||
'trigger': u'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': u'White:FFF',
|
||||
'description': u'For Both',
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'category',
|
||||
'fieldtype': u'Select',
|
||||
'label': u'Consider Tax or Charge for',
|
||||
'oldfieldname': u'category',
|
||||
'oldfieldtype': u'Select',
|
||||
'options': u'Valuation and Total\nValuation\nTotal',
|
||||
'permlevel': 0,
|
||||
'reqd': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': u'White:FFF',
|
||||
'default': u'Add',
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'add_deduct_tax',
|
||||
'fieldtype': u'Select',
|
||||
'label': u'Add or Deduct',
|
||||
'oldfieldname': u'add_deduct_tax',
|
||||
'oldfieldtype': u'Select',
|
||||
'options': u'Add\nDeduct',
|
||||
'permlevel': 0,
|
||||
'reqd': 1,
|
||||
'trigger': u'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': u'White:FFF',
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'item_wise_tax_detail',
|
||||
'fieldtype': u'Small Text',
|
||||
'hidden': 1,
|
||||
'label': u'Item Wise Tax Detail ',
|
||||
'oldfieldname': u'item_wise_tax_detail',
|
||||
'oldfieldtype': u'Small Text',
|
||||
'permlevel': 1,
|
||||
'print_hide': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
|
@ -0,0 +1 @@
|
||||
from __future__ import unicode_literals
|
@ -22,7 +22,7 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
||||
}
|
||||
|
||||
cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
||||
|
||||
cur_frm.set_footnote(wn.markdown(cur_frm.meta.description));
|
||||
}
|
||||
|
||||
cur_frm.pformat.purchase_tax_details= function(doc){
|
||||
@ -74,7 +74,7 @@ cur_frm.cscript.add_deduct_tax = function(doc, cdt, cdn) {
|
||||
alert("Please select Category first");
|
||||
d.add_deduct_tax = '';
|
||||
}
|
||||
else if(d.category != 'For Total' && d.add_deduct_tax == 'Deduct'){
|
||||
else if(d.category != 'Total' && d.add_deduct_tax == 'Deduct'){
|
||||
alert("You cannot Deduct when category is for valuation or for both(i.e total and valuation)");
|
||||
d.add_deduct_tax = '';
|
||||
}
|
||||
@ -91,8 +91,8 @@ cur_frm.cscript.charge_type = function(doc, cdt, cdn) {
|
||||
alert("You cannot select Charge Type as 'On Previous Row Amount' or 'On Previous Row Total' for first row");
|
||||
d.charge_type = '';
|
||||
}
|
||||
else if((d.category == 'For Valuation' || d.category == 'For Both') && (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 valuation. You can select only 'For Total' option for previous row amount or previous row total")
|
||||
else if((d.category == 'Valuation' || d.category == 'Valuation and Total') && (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 valuation. You can select only 'Total' option for previous row amount or previous row total")
|
||||
d.charge_type = '';
|
||||
}
|
||||
validated = false;
|
||||
|
@ -15,6 +15,7 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Please edit this list and import only required elements
|
||||
from __future__ import unicode_literals
|
||||
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
|
||||
|
@ -17,6 +17,7 @@
|
||||
'autoname': u'field:title',
|
||||
'colour': u'White:FFF',
|
||||
'default_print_format': u'Standard',
|
||||
'description': u'Standard tax template that can be applied to all Purchase Transactions. This template can contain list of tax heads and also other expense heads like "Shipping", "Insurance", "Handling" etc.\n\n#### Note\n\nThe tax rate you define here will be the standard tax rate for all **Items**. If there are **Items** that have different rates, they must be added in the **Item Tax** table in the **Item** master.\n\n#### Description of Columns\n\n1. Calculation Type: \n - This can be on **Net Total** (that is the sum of basic amount).\n - **On Previous Row Total / Amount** (for cumulative taxes or charges). If you select this option, the tax will be applied as a percentage of the previous row (in the tax table) amount or total.\n - **Actual** (as mentioned).\n2. Account Head: The Account ledger under which this tax will be booked\n3. Cost Center: If the tax / charge is an income (like shipping) or expense it needs to be booked against a Cost Center.\n4. Description: Description of the tax (that will be printed in invoices / quotes).\n5. Rate: Tax rate.\n6. Amount: Tax amount.\n7. Total: Cumulative total to this point.\n8. Enter Row: If based on "Previous Row Total" you can select the row number which will be taken as a base for this calculation (default is the previous row).\n9. Consider Tax or Charge for: In this section you can specify if the tax / charge is only for valuation (not a part of total) or only for total (does not add value to the item) or for both.\n10. Add or Deduct: Whether you want to add or deduct the tax.',
|
||||
'doctype': 'DocType',
|
||||
'document_type': u'Master',
|
||||
'module': u'Accounts',
|
||||
@ -134,5 +135,16 @@
|
||||
'oldfieldname': u'purchase_tax_details',
|
||||
'oldfieldtype': u'Table',
|
||||
'options': u'Purchase Taxes and Charges'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'company',
|
||||
'fieldtype': u'Link',
|
||||
'in_filter': 1,
|
||||
'label': u'Company',
|
||||
'options': u'Company',
|
||||
'reqd': 1
|
||||
}
|
||||
]
|
@ -0,0 +1 @@
|
||||
from __future__ import unicode_literals
|
@ -15,6 +15,7 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Please edit this list and import only required elements
|
||||
from __future__ import unicode_literals
|
||||
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
|
||||
@ -40,18 +41,12 @@ class DocType(TransactionBase):
|
||||
self.fname = 'entries'
|
||||
|
||||
|
||||
# Autoname
|
||||
# ---------
|
||||
def autoname(self):
|
||||
self.doc.name = make_autoname(self.doc.naming_series+ '.#####')
|
||||
|
||||
|
||||
|
||||
# ********************************* Trigger Functions ******************************
|
||||
|
||||
#Set retail related fields from pos settings
|
||||
#-------------------------------------------------------------------------
|
||||
def set_pos_fields(self):
|
||||
"""Set retail related fields from pos settings"""
|
||||
pos = webnotes.conn.sql("select * from `tabPOS Setting` where ifnull(user,'') = '%s' and company = '%s'" % (session['user'], self.doc.company), as_dict=1)
|
||||
if not pos:
|
||||
pos = webnotes.conn.sql("select * from `tabPOS Setting` where ifnull(user,'') = '' and company = '%s'" % (self.doc.company), as_dict=1)
|
||||
@ -79,9 +74,8 @@ class DocType(TransactionBase):
|
||||
if self.doc.charge: self.get_other_charges()
|
||||
|
||||
|
||||
# Set default values related to pos for previously created sales invoice.
|
||||
# --------------------------------------------------------------------------
|
||||
def set_pos_item_values(self):
|
||||
"""Set default values related to pos for previously created sales invoice."""
|
||||
if cint(self.doc.is_pos) ==1:
|
||||
dtl = webnotes.conn.sql("select income_account, warehouse, cost_center from `tabPOS Setting` where ifnull(user,'') = '%s' and company = '%s'" % (session['user'], self.doc.company), as_dict=1)
|
||||
if not dtl:
|
||||
@ -94,10 +88,8 @@ class DocType(TransactionBase):
|
||||
d.warehouse = item and item[0]['default_warehouse'] or dtl and dtl[0]['warehouse'] or d.warehouse
|
||||
|
||||
|
||||
|
||||
# Get Account Head to which amount needs to be Debited based on Customer
|
||||
# ----------------------------------------------------------------------
|
||||
def get_customer_account(self):
|
||||
"""Get Account Head to which amount needs to be Debited based on Customer"""
|
||||
if not self.doc.company:
|
||||
msgprint("Please select company first and re-select the customer after doing so", raise_exception=1)
|
||||
|
||||
@ -115,10 +107,8 @@ class DocType(TransactionBase):
|
||||
return acc_head and {'debit_to' : acc_head} or {}
|
||||
|
||||
|
||||
|
||||
# Set Due Date = Posting Date + Credit Days
|
||||
# -----------------------------------------
|
||||
def get_cust_and_due_date(self):
|
||||
"""Set Due Date = Posting Date + Credit Days"""
|
||||
credit_days = 0
|
||||
if self.doc.debit_to:
|
||||
credit_days = webnotes.conn.sql("select credit_days from `tabAccount` where name='%s' and docstatus != 2" % self.doc.debit_to)
|
||||
@ -134,9 +124,8 @@ class DocType(TransactionBase):
|
||||
self.doc.customer = webnotes.conn.get_value('Account',self.doc.debit_to,'master_name')
|
||||
|
||||
|
||||
# Pull Details of Delivery Note or Sales Order Selected
|
||||
# ------------------------------------------------------
|
||||
def pull_details(self):
|
||||
"""Pull Details of Delivery Note or Sales Order Selected"""
|
||||
# Delivery Note
|
||||
if self.doc.delivery_note_main:
|
||||
self.validate_prev_docname('delivery note')
|
||||
@ -153,14 +142,14 @@ class DocType(TransactionBase):
|
||||
ret = self.get_debit_to()
|
||||
self.doc.debit_to = ret.get('debit_to')
|
||||
|
||||
# onload pull income account
|
||||
# --------------------------
|
||||
|
||||
def load_default_accounts(self):
|
||||
"""
|
||||
Loads default accounts from items, customer when called from mapper
|
||||
"""
|
||||
self.get_income_account('entries')
|
||||
|
||||
|
||||
def get_income_account(self,doctype):
|
||||
for d in getlist(self.doclist, doctype):
|
||||
if d.item_code:
|
||||
@ -168,8 +157,7 @@ class DocType(TransactionBase):
|
||||
d.income_account = item and item[0]['default_income_account'] or ''
|
||||
d.cost_center = item and item[0]['default_sales_cost_center'] or ''
|
||||
|
||||
# Item Details
|
||||
# -------------
|
||||
|
||||
def get_item_details(self, args=None):
|
||||
import json
|
||||
args = args and json.loads(args) or {}
|
||||
@ -215,61 +203,49 @@ class DocType(TransactionBase):
|
||||
return get_obj('Sales Common').get_barcode_details(barcode)
|
||||
|
||||
|
||||
# Fetch ref rate from item master as per selected price list
|
||||
def get_adj_percent(self, arg=''):
|
||||
"""Fetch ref rate from item master as per selected price list"""
|
||||
get_obj('Sales Common').get_adj_percent(self)
|
||||
|
||||
|
||||
# Get tax rate if account type is tax
|
||||
# ------------------------------------
|
||||
def get_rate(self,arg):
|
||||
"""Get tax rate if account type is tax"""
|
||||
get_obj('Sales Common').get_rate(arg)
|
||||
|
||||
|
||||
# Get Commission rate of Sales Partner
|
||||
# -------------------------------------
|
||||
def get_comm_rate(self, sales_partner):
|
||||
"""Get Commission rate of Sales Partner"""
|
||||
return get_obj('Sales Common').get_comm_rate(sales_partner, self)
|
||||
|
||||
|
||||
# GET TERMS & CONDITIONS
|
||||
# -------------------------------------
|
||||
|
||||
def get_tc_details(self):
|
||||
return get_obj('Sales Common').get_tc_details(self)
|
||||
|
||||
# Load Default Charges
|
||||
# ----------------------------------------------------------
|
||||
|
||||
def load_default_taxes(self):
|
||||
self.doclist = get_obj('Sales Common').load_default_taxes(self)
|
||||
|
||||
# Get Sales Taxes and Charges Master Details
|
||||
# --------------------------
|
||||
|
||||
def get_other_charges(self):
|
||||
self.doclist = get_obj('Sales Common').get_other_charges(self)
|
||||
|
||||
# Get Advances
|
||||
# -------------
|
||||
|
||||
def get_advances(self):
|
||||
self.doclist = get_obj('GL Control').get_advances(self, self.doc.debit_to, 'Sales Invoice Advance', 'advance_adjustment_details', 'credit')
|
||||
|
||||
#pull project customer
|
||||
#-------------------------
|
||||
|
||||
def pull_project_customer(self):
|
||||
res = webnotes.conn.sql("select customer from `tabProject` where name = '%s'"%self.doc.project_name)
|
||||
if res:
|
||||
get_obj('DocType Mapper', 'Project-Sales Invoice').dt_map('Project', 'Sales Invoice', self.doc.project_name, self.doc, self.doclist, "[['Project', 'Sales Invoice']]")
|
||||
|
||||
# ********************************** Server Utility Functions ******************************
|
||||
|
||||
# Get Company Abbr.
|
||||
# ------------------
|
||||
|
||||
def get_company_abbr(self):
|
||||
return webnotes.conn.sql("select abbr from tabCompany where name=%s", self.doc.company)[0][0]
|
||||
|
||||
|
||||
# Check whether sales order / delivery note items already pulled
|
||||
#----------------------------------------------------------------
|
||||
|
||||
def validate_prev_docname(self,doctype):
|
||||
"""Check whether sales order / delivery note items already pulled"""
|
||||
for d in getlist(self.doclist, 'entries'):
|
||||
if doctype == 'delivery note' and self.doc.delivery_note_main == d.delivery_note:
|
||||
msgprint(cstr(self.doc.delivery_note_main) + " delivery note details have already been pulled.")
|
||||
@ -279,7 +255,6 @@ class DocType(TransactionBase):
|
||||
raise Exception , "Validation Error. Sales order details have already been pulled."
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
def update_against_document_in_jv(self):
|
||||
"""
|
||||
Links invoice and advance voucher:
|
||||
@ -308,11 +283,8 @@ class DocType(TransactionBase):
|
||||
get_obj('GL Control').reconcile_against_document(lst)
|
||||
|
||||
|
||||
# ------------------------------------------------------------------------
|
||||
def validate_customer(self):
|
||||
"""
|
||||
Validate customer name with SO and DN
|
||||
"""
|
||||
""" Validate customer name with SO and DN"""
|
||||
for d in getlist(self.doclist,'entries'):
|
||||
dt = d.delivery_note and 'Delivery Note' or d.sales_order and 'Sales Order' or ''
|
||||
if dt:
|
||||
@ -322,9 +294,8 @@ class DocType(TransactionBase):
|
||||
msgprint("Customer %s does not match with customer of %s: %s." %(self.doc.customer, dt, dt_no), raise_exception=1)
|
||||
|
||||
|
||||
# Validates Debit To Account and Customer Matches
|
||||
# ------------------------------------------------
|
||||
def validate_debit_to_acc(self):
|
||||
def validate_customer_account(self):
|
||||
"""Validates Debit To Account and Customer Matches"""
|
||||
if self.doc.customer and self.doc.debit_to and not cint(self.doc.is_pos):
|
||||
acc_head = webnotes.conn.sql("select master_name from `tabAccount` where name = %s and docstatus != 2", self.doc.debit_to)
|
||||
|
||||
@ -334,11 +305,6 @@ class DocType(TransactionBase):
|
||||
and Master Name in account master." %(self.doc.debit_to, self.doc.customer,self.doc.company), raise_exception=1)
|
||||
|
||||
|
||||
# Validate Debit To Account
|
||||
# 1. Account Exists
|
||||
# 2. Is a Debit Account
|
||||
# 3. Is a PL Account
|
||||
# ---------------------------
|
||||
def validate_debit_acc(self):
|
||||
acc = webnotes.conn.sql("select debit_or_credit, is_pl_account from tabAccount where name = '%s' and docstatus != 2" % self.doc.debit_to)
|
||||
if not acc:
|
||||
@ -352,9 +318,8 @@ class DocType(TransactionBase):
|
||||
raise Exception
|
||||
|
||||
|
||||
# Validate Fixed Asset Account and whether Income Account Entered Exists
|
||||
# -----------------------------------------------------------------------
|
||||
def validate_fixed_asset_account(self):
|
||||
"""Validate Fixed Asset Account and whether Income Account Entered Exists"""
|
||||
for d in getlist(self.doclist,'entries'):
|
||||
item = webnotes.conn.sql("select name,is_asset_item,is_sales_item from `tabItem` where name = '%s' and (ifnull(end_of_life,'')='' or end_of_life = '0000-00-00' or end_of_life > now())"% d.item_code)
|
||||
acc = webnotes.conn.sql("select account_type from `tabAccount` where name = '%s' and docstatus != 2" % d.income_account)
|
||||
@ -366,22 +331,16 @@ class DocType(TransactionBase):
|
||||
raise Exception
|
||||
|
||||
|
||||
|
||||
# Set totals in words
|
||||
#--------------------
|
||||
def set_in_words(self):
|
||||
dcc = TransactionBase().get_company_currency(self.doc.company)
|
||||
self.doc.in_words = get_obj('Sales Common').get_total_in_words(dcc, self.doc.rounded_total)
|
||||
self.doc.in_words_export = get_obj('Sales Common').get_total_in_words(self.doc.currency, self.doc.rounded_total_export)
|
||||
|
||||
# Clear Advances
|
||||
# --------------
|
||||
|
||||
def clear_advances(self):
|
||||
get_obj('GL Control').clear_advances(self, 'Sales Invoice Advance','advance_adjustment_details')
|
||||
|
||||
|
||||
# set aging date
|
||||
#-------------------
|
||||
def set_aging_date(self):
|
||||
if self.doc.is_opening != 'Yes':
|
||||
self.doc.aging_date = self.doc.posting_date
|
||||
@ -390,20 +349,21 @@ class DocType(TransactionBase):
|
||||
raise Exception
|
||||
|
||||
|
||||
# Set against account for debit to account
|
||||
#------------------------------------------
|
||||
def set_against_income_account(self):
|
||||
"""Set against account for debit to account"""
|
||||
against_acc = []
|
||||
for d in getlist(self.doclist, 'entries'):
|
||||
if d.income_account not in against_acc:
|
||||
against_acc.append(d.income_account)
|
||||
self.doc.against_income_account = ','.join(against_acc)
|
||||
|
||||
|
||||
def add_remarks(self):
|
||||
if not self.doc.remarks: self.doc.remarks = 'No Remarks'
|
||||
|
||||
#check in manage account if sales order / delivery note required or not.
|
||||
|
||||
def so_dn_required(self):
|
||||
"""check in manage account if sales order / delivery note required or not."""
|
||||
dic = {'Sales Order':'so_required','Delivery Note':'dn_required'}
|
||||
for i in dic:
|
||||
if webnotes.conn.get_value('Global Defaults', 'Global Defaults', dic[i]) == 'Yes':
|
||||
@ -412,9 +372,9 @@ class DocType(TransactionBase):
|
||||
and not d.fields[i.lower().replace(' ','_')]:
|
||||
msgprint("%s is mandatory for stock item which is not mentioed against item: %s"%(i,d.item_code), raise_exception=1)
|
||||
|
||||
#check for does customer belong to same project as entered..
|
||||
#-------------------------------------------------------------------------------------------------
|
||||
|
||||
def validate_proj_cust(self):
|
||||
"""check for does customer belong to same project as entered.."""
|
||||
if self.doc.project_name and self.doc.customer:
|
||||
res = webnotes.conn.sql("select name from `tabProject` where name = '%s' and (customer = '%s' or ifnull(customer,'')='')"%(self.doc.project_name, self.doc.customer))
|
||||
if not res:
|
||||
@ -430,20 +390,13 @@ class DocType(TransactionBase):
|
||||
raise Exception
|
||||
|
||||
|
||||
# ********* UPDATE CURRENT STOCK *****************************
|
||||
def update_current_stock(self):
|
||||
for d in getlist(self.doclist, 'entries'):
|
||||
bin = webnotes.conn.sql("select actual_qty from `tabBin` where item_code = %s and warehouse = %s", (d.item_code, d.warehouse), as_dict = 1)
|
||||
d.actual_qty = bin and flt(bin[0]['actual_qty']) or 0
|
||||
|
||||
def validate_item_code(self):
|
||||
for d in getlist(self.doclist, 'entries'):
|
||||
if not d.item_code:
|
||||
msgprint("Please enter Item Code at line no : %s to update stock for POS or remove check from Update Stock in Basic Info Tab." % (d.idx))
|
||||
raise Exception
|
||||
|
||||
# Validate Write Off Account
|
||||
# -------------------------------
|
||||
|
||||
def validate_write_off_account(self):
|
||||
if flt(self.doc.write_off_amount) and not self.doc.write_off_account:
|
||||
msgprint("Please enter Write Off Account", raise_exception=1)
|
||||
@ -456,12 +409,22 @@ class DocType(TransactionBase):
|
||||
and parent = %s""", (self.doc.amended_from, self.doc.c_form_no))
|
||||
|
||||
webnotes.conn.set(self.doc, 'c_form_no', '')
|
||||
|
||||
|
||||
def update_current_stock(self):
|
||||
for d in getlist(self.doclist, 'entries'):
|
||||
if d.item_code and d.warehouse:
|
||||
bin = webnotes.conn.sql("select actual_qty from `tabBin` where item_code = %s and warehouse = %s", (d.item_code, d.warehouse), as_dict = 1)
|
||||
d.actual_qty = bin and flt(bin[0]['actual_qty']) or 0
|
||||
|
||||
for d in getlist(self.doclist, 'packing_details'):
|
||||
bin = sql("select actual_qty, projected_qty from `tabBin` where item_code = %s and warehouse = %s", (d.item_code, d.warehouse), as_dict = 1)
|
||||
d.actual_qty = bin and flt(bin[0]['actual_qty']) or 0
|
||||
d.projected_qty = bin and flt(bin[0]['projected_qty']) or 0
|
||||
|
||||
# VALIDATE
|
||||
# ====================================================================================
|
||||
|
||||
def validate(self):
|
||||
self.so_dn_required()
|
||||
#self.dn_required()
|
||||
self.validate_proj_cust()
|
||||
sales_com_obj = get_obj('Sales Common')
|
||||
sales_com_obj.check_stop_sales_order(self)
|
||||
@ -471,7 +434,7 @@ class DocType(TransactionBase):
|
||||
sales_com_obj.get_allocated_sum(self) # this is to verify that the allocated % of sales persons is 100%
|
||||
sales_com_obj.validate_fiscal_year(self.doc.fiscal_year,self.doc.posting_date,'Posting Date')
|
||||
self.validate_customer()
|
||||
self.validate_debit_to_acc()
|
||||
self.validate_customer_account()
|
||||
self.validate_debit_acc()
|
||||
self.validate_fixed_asset_account()
|
||||
self.add_remarks()
|
||||
@ -479,7 +442,9 @@ class DocType(TransactionBase):
|
||||
self.validate_pos()
|
||||
self.validate_write_off_account()
|
||||
if cint(self.doc.update_stock):
|
||||
get_obj('Stock Ledger').validate_serial_no(self, 'entries')
|
||||
sl = get_obj('Stock Ledger')
|
||||
sl.validate_serial_no(self, 'entries')
|
||||
sl.validate_serial_no(self, 'packing_details')
|
||||
self.validate_item_code()
|
||||
self.update_current_stock()
|
||||
self.set_in_words()
|
||||
@ -487,14 +452,62 @@ class DocType(TransactionBase):
|
||||
self.doc.is_opening = 'No'
|
||||
self.set_aging_date()
|
||||
self.clear_advances()
|
||||
# Set against account
|
||||
self.set_against_income_account()
|
||||
self.validate_c_form()
|
||||
|
||||
|
||||
def get_warehouse(self):
|
||||
w = webnotes.conn.sql("select warehouse from `tabPOS Setting` where ifnull(user,'') = '%s' and company = '%s'" % (session['user'], self.doc.company))
|
||||
w = w and w[0][0] or ''
|
||||
if not w:
|
||||
ps = webnotes.conn.sql("select name, warehouse from `tabPOS Setting` where ifnull(user,'') = '' and company = '%s'" % self.doc.company)
|
||||
if not ps:
|
||||
msgprint("To make POS entry, please create POS Setting from Accounts --> POS Setting page and refresh the system.")
|
||||
raise Exception
|
||||
elif not ps[0][1]:
|
||||
msgprint("Please enter warehouse in POS Setting")
|
||||
else:
|
||||
w = ps[0][1]
|
||||
return w
|
||||
|
||||
|
||||
def make_packing_list(self):
|
||||
get_obj('Sales Common').make_packing_list(self,'entries')
|
||||
sl = get_obj('Stock Ledger')
|
||||
sl.scrub_serial_nos(self)
|
||||
sl.scrub_serial_nos(self, 'packing_details')
|
||||
|
||||
|
||||
def on_update(self):
|
||||
# Set default warehouse from pos setting
|
||||
if cint(self.doc.is_pos) == 1:
|
||||
if cint(self.doc.update_stock) == 1:
|
||||
w = self.get_warehouse()
|
||||
if w:
|
||||
for d in getlist(self.doclist, 'entries'):
|
||||
if not d.warehouse:
|
||||
d.warehouse = cstr(w)
|
||||
|
||||
self.make_packing_list()
|
||||
else:
|
||||
self.doclist = self.doc.clear_table(self.doclist, 'packing_details')
|
||||
|
||||
if flt(self.doc.paid_amount) == 0:
|
||||
if self.doc.cash_bank_account:
|
||||
webnotes.conn.set(self.doc, 'paid_amount',
|
||||
(flt(self.doc.grand_total) - flt(self.doc.write_off_amount)))
|
||||
else:
|
||||
# show message that the amount is not paid
|
||||
webnotes.conn.set(self.doc,'paid_amount',0)
|
||||
webnotes.msgprint("Note: Payment Entry will not be created since 'Cash/Bank Account' was not specified.")
|
||||
|
||||
else:
|
||||
self.doclist = self.doc.clear_table(self.doclist, 'packing_details')
|
||||
webnotes.conn.set(self.doc,'paid_amount',0)
|
||||
|
||||
webnotes.conn.set(self.doc,'outstanding_amount',flt(self.doc.grand_total) - flt(self.doc.total_advance) - flt(self.doc.paid_amount) - flt(self.doc.write_off_amount))
|
||||
|
||||
|
||||
# *************************************************** ON SUBMIT **********************************************
|
||||
# Check Ref Document's docstatus
|
||||
# -------------------------------
|
||||
def check_prev_docstatus(self):
|
||||
for d in getlist(self.doclist,'entries'):
|
||||
if d.sales_order:
|
||||
@ -510,56 +523,45 @@ class DocType(TransactionBase):
|
||||
raise Exception , "Validation Error."
|
||||
|
||||
|
||||
#Set Actual Qty based on item code and warehouse
|
||||
#------------------------------------------------------
|
||||
def set_actual_qty(self):
|
||||
for d in getlist(self.doclist, 'entries'):
|
||||
if d.item_code and d.warehouse:
|
||||
actual_qty = webnotes.conn.sql("select actual_qty from `tabBin` where item_code = '%s' and warehouse = '%s'" % (d.item_code, d.warehouse))
|
||||
d.actual_qty = actual_qty and flt(actual_qty[0][0]) or 0
|
||||
|
||||
|
||||
|
||||
# ********************** Make Stock Entry ************************************
|
||||
def make_sl_entry(self, d, wh, qty, in_value, update_stock):
|
||||
st_uom = webnotes.conn.sql("select stock_uom from `tabItem` where name = '%s'"%d.item_code)
|
||||
st_uom = webnotes.conn.sql("select stock_uom from `tabItem` where name = '%s'"%d['item_code'])
|
||||
self.values.append({
|
||||
'item_code' : d.item_code,
|
||||
'item_code' : d['item_code'],
|
||||
'warehouse' : wh,
|
||||
'transaction_date' : getdate(self.doc.modified).strftime('%Y-%m-%d'),
|
||||
'posting_date' : self.doc.posting_date,
|
||||
'posting_time' : self.doc.posting_time,
|
||||
'voucher_type' : 'Sales Invoice',
|
||||
'voucher_no' : cstr(self.doc.name),
|
||||
'voucher_detail_no' : cstr(d.name),
|
||||
'voucher_detail_no' : cstr(d['name']),
|
||||
'actual_qty' : qty,
|
||||
'stock_uom' : st_uom and st_uom[0][0] or '',
|
||||
'incoming_rate' : in_value,
|
||||
'company' : self.doc.company,
|
||||
'fiscal_year' : self.doc.fiscal_year,
|
||||
'is_cancelled' : (update_stock==1) and 'No' or 'Yes',
|
||||
'batch_no' : cstr(d.batch_no),
|
||||
'serial_no' : d.serial_no
|
||||
})
|
||||
'batch_no' : cstr(d['batch_no']),
|
||||
'serial_no' : d['serial_no']
|
||||
})
|
||||
|
||||
|
||||
# UPDATE STOCK LEDGER
|
||||
# ---------------------------------------------------------------------------
|
||||
def update_stock_ledger(self, update_stock, clear = 0):
|
||||
def update_stock_ledger(self, update_stock):
|
||||
self.values = []
|
||||
for d in getlist(self.doclist, 'entries'):
|
||||
stock_item = webnotes.conn.sql("SELECT is_stock_item, is_sample_item FROM tabItem where name = '%s'"%(d.item_code), as_dict = 1) # stock ledger will be updated only if it is a stock item
|
||||
items = get_obj('Sales Common').get_item_list(self)
|
||||
for d in items:
|
||||
stock_item = webnotes.conn.sql("SELECT is_stock_item, is_sample_item \
|
||||
FROM tabItem where name = '%s'"%(d['item_code']), as_dict = 1)
|
||||
if stock_item[0]['is_stock_item'] == "Yes":
|
||||
if not d['warehouse']:
|
||||
msgprint("Message: Please enter Warehouse for item %s as it is stock item." \
|
||||
% d['item_code'], raise_exception=1)
|
||||
|
||||
# Reduce actual qty from warehouse
|
||||
self.make_sl_entry( d, d.warehouse, - flt(d.qty) , 0, update_stock)
|
||||
get_obj('Stock Ledger', 'Stock Ledger').update_stock(self.values, self.doc.amended_from and 'Yes' or 'No')
|
||||
|
||||
|
||||
#-------------------POS Stock Updatation Part----------------------------------------------
|
||||
def pos_update_stock(self):
|
||||
self.update_stock_ledger(update_stock = 1)
|
||||
self.make_sl_entry( d, d['warehouse'], - flt(d['qty']) , 0, update_stock)
|
||||
|
||||
get_obj('Stock Ledger', 'Stock Ledger').update_stock(self.values)
|
||||
|
||||
# ********** Get Actual Qty of item in warehouse selected *************
|
||||
|
||||
def get_actual_qty(self,args):
|
||||
args = eval(args)
|
||||
actual_qty = webnotes.conn.sql("select actual_qty from `tabBin` where item_code = '%s' and warehouse = '%s'" % (args['item_code'], args['warehouse']), as_dict=1)
|
||||
@ -568,23 +570,39 @@ class DocType(TransactionBase):
|
||||
}
|
||||
return ret
|
||||
|
||||
# Make GL Entries
|
||||
# -------------------------
|
||||
|
||||
def make_gl_entries(self, is_cancel=0):
|
||||
mapper = self.doc.is_pos and self.doc.write_off_account and 'POS with write off' or self.doc.is_pos and not self.doc.write_off_account and 'POS' or ''
|
||||
update_outstanding = self.doc.is_pos and self.doc.write_off_account and 'No' or 'Yes'
|
||||
get_obj(dt='GL Control').make_gl_entries(self.doc, self.doclist,cancel = is_cancel, use_mapper = mapper, update_outstanding = update_outstanding, merge_entries = cint(self.doc.is_pos) != 1 and 1 or 0)
|
||||
|
||||
|
||||
# On Submit
|
||||
# ---------
|
||||
def update_c_form(self):
|
||||
"""Update amended id in C-form"""
|
||||
if self.doc.c_form_no and self.doc.amended_from:
|
||||
webnotes.conn.sql("""update `tabC-Form Invoice Detail` set invoice_no = %s,
|
||||
invoice_date = %s, territory = %s, net_total = %s,
|
||||
grand_total = %s where invoice_no = %s and parent = %s""", (self.doc.name, self.doc.amended_from, self.doc.c_form_no))
|
||||
|
||||
|
||||
def check_next_docstatus(self):
|
||||
submit_jv = webnotes.conn.sql("select t1.name from `tabJournal Voucher` t1,`tabJournal Voucher Detail` t2 where t1.name = t2.parent and t2.against_invoice = '%s' and t1.docstatus = 1" % (self.doc.name))
|
||||
if submit_jv:
|
||||
msgprint("Journal Voucher : " + cstr(submit_jv[0][0]) + " has been created against " + cstr(self.doc.doctype) + ". So " + cstr(self.doc.doctype) + " cannot be Cancelled.")
|
||||
raise Exception, "Validation Error."
|
||||
|
||||
|
||||
def on_submit(self):
|
||||
if cint(self.doc.is_pos) == 1:
|
||||
if cint(self.doc.update_stock) == 1:
|
||||
sl_obj = get_obj("Stock Ledger")
|
||||
sl_obj.validate_serial_no_warehouse(self, 'entries')
|
||||
sl_obj.validate_serial_no_warehouse(self, 'packing_details')
|
||||
|
||||
sl_obj.update_serial_record(self, 'entries', is_submit = 1, is_incoming = 0)
|
||||
self.pos_update_stock()
|
||||
sl_obj.update_serial_record(self, 'packing_details', is_submit = 1, is_incoming = 0)
|
||||
|
||||
self.update_stock_ledger(update_stock=1)
|
||||
else:
|
||||
self.check_prev_docstatus()
|
||||
get_obj("Sales Common").update_prevdoc_detail(1,self)
|
||||
@ -602,31 +620,13 @@ class DocType(TransactionBase):
|
||||
self.update_c_form()
|
||||
|
||||
|
||||
def update_c_form(self):
|
||||
"""Update amended id in C-form"""
|
||||
if self.doc.c_form_no and self.doc.amended_from:
|
||||
webnotes.conn.sql("""update `tabC-Form Invoice Detail` set invoice_no = %s,
|
||||
invoice_date = %s, territory = %s, net_total = %s,
|
||||
grand_total = %s where invoice_no = %s and parent = %s""", (self.doc.name, self.doc.amended_from, self.doc.c_form_no))
|
||||
|
||||
|
||||
|
||||
# *************************************************** ON CANCEL **********************************************
|
||||
# Check Next Document's docstatus
|
||||
# --------------------------------
|
||||
def check_next_docstatus(self):
|
||||
submit_jv = webnotes.conn.sql("select t1.name from `tabJournal Voucher` t1,`tabJournal Voucher Detail` t2 where t1.name = t2.parent and t2.against_invoice = '%s' and t1.docstatus = 1" % (self.doc.name))
|
||||
if submit_jv:
|
||||
msgprint("Journal Voucher : " + cstr(submit_jv[0][0]) + " has been created against " + cstr(self.doc.doctype) + ". So " + cstr(self.doc.doctype) + " cannot be Cancelled.")
|
||||
raise Exception, "Validation Error."
|
||||
|
||||
|
||||
# On Cancel
|
||||
# ----------
|
||||
def on_cancel(self):
|
||||
if cint(self.doc.is_pos) == 1:
|
||||
if cint(self.doc.update_stock) == 1:
|
||||
get_obj('Stock Ledger').update_serial_record(self, 'entries', is_submit = 0, is_incoming = 0)
|
||||
sl = get_obj('Stock Ledger')
|
||||
sl.update_serial_record(self, 'entries', is_submit = 0, is_incoming = 0)
|
||||
sl.update_serial_record(self, 'packing_details', is_submit = 0, is_incoming = 0)
|
||||
|
||||
self.update_stock_ledger(update_stock = -1)
|
||||
else:
|
||||
sales_com_obj = get_obj(dt = 'Sales Common')
|
||||
@ -743,3 +743,4 @@ class DocType(TransactionBase):
|
||||
next_date = next_date.strftime("%Y-%m-%d")
|
||||
|
||||
webnotes.conn.set(self.doc, 'next_date', next_date)
|
||||
|
||||
|
@ -354,6 +354,16 @@
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'sales_bom_help',
|
||||
'fieldtype': u'HTML',
|
||||
'label': u'Sales BOM Help',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
@ -502,7 +512,7 @@
|
||||
'description': u"Rate at which Price list currency is converted to customer's base currency",
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'plc_conversion_rate',
|
||||
'fieldtype': u'Currency',
|
||||
'fieldtype': u'Float',
|
||||
'label': u'Price List Currency Conversion Rate',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1,
|
||||
@ -539,7 +549,7 @@
|
||||
'description': u"Rate at which Customer Currency is converted to customer's base currency",
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'conversion_rate',
|
||||
'fieldtype': u'Currency',
|
||||
'fieldtype': u'Float',
|
||||
'label': u'Conversion Rate',
|
||||
'oldfieldname': u'conversion_rate',
|
||||
'oldfieldtype': u'Currency',
|
||||
@ -1347,6 +1357,27 @@
|
||||
'print_hide': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'packing_list',
|
||||
'fieldtype': u'Section Break',
|
||||
'label': u'Packing List',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'packing_details',
|
||||
'fieldtype': u'Table',
|
||||
'label': u'Packing Details',
|
||||
'options': u'Delivery Note Packing Item',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
@ -1632,5 +1663,61 @@
|
||||
'no_copy': 1,
|
||||
'permlevel': 0,
|
||||
'print_hide': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'amend': 0,
|
||||
'cancel': 0,
|
||||
'create': 0,
|
||||
'doctype': u'DocPerm',
|
||||
'permlevel': 1,
|
||||
'role': u'Accounts Manager',
|
||||
'submit': 0,
|
||||
'write': 0
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'amend': 1,
|
||||
'cancel': 1,
|
||||
'create': 1,
|
||||
'doctype': u'DocPerm',
|
||||
'permlevel': 0,
|
||||
'role': u'Accounts Manager',
|
||||
'submit': 1,
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'amend': 1,
|
||||
'cancel': 1,
|
||||
'create': 1,
|
||||
'doctype': u'DocPerm',
|
||||
'permlevel': 0,
|
||||
'role': u'Accounts User',
|
||||
'submit': 1,
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'amend': 0,
|
||||
'cancel': 0,
|
||||
'create': 0,
|
||||
'doctype': u'DocPerm',
|
||||
'permlevel': 1,
|
||||
'role': u'Accounts User',
|
||||
'submit': 0,
|
||||
'write': 0
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'doctype': u'DocPerm',
|
||||
'match': u'customer',
|
||||
'permlevel': 0,
|
||||
'role': u'Customer'
|
||||
}
|
||||
]
|
@ -0,0 +1 @@
|
||||
from __future__ import unicode_literals
|
@ -0,0 +1 @@
|
||||
from __future__ import unicode_literals
|
@ -0,0 +1 @@
|
||||
from __future__ import unicode_literals
|
@ -3,9 +3,9 @@
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2012-05-15 12:14:34',
|
||||
'creation': '2012-07-04 16:40:13',
|
||||
'docstatus': 0,
|
||||
'modified': '2012-07-04 13:27:05',
|
||||
'modified': '2012-07-12 13:50:43',
|
||||
'modified_by': u'Administrator',
|
||||
'owner': u'Administrator'
|
||||
},
|
||||
@ -113,7 +113,7 @@
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'tax_amount',
|
||||
'fieldtype': u'Currency',
|
||||
'label': u'Amount*',
|
||||
'label': u'Amount',
|
||||
'oldfieldname': u'tax_amount',
|
||||
'oldfieldtype': u'Currency',
|
||||
'permlevel': 0,
|
||||
@ -126,7 +126,7 @@
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'total',
|
||||
'fieldtype': u'Currency',
|
||||
'label': u'Total*',
|
||||
'label': u'Total',
|
||||
'oldfieldname': u'total',
|
||||
'oldfieldtype': u'Currency',
|
||||
'permlevel': 1
|
||||
|
@ -0,0 +1 @@
|
||||
from __future__ import unicode_literals
|
@ -19,9 +19,9 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
||||
//
|
||||
}
|
||||
|
||||
/*cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
||||
|
||||
}*/
|
||||
cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
||||
cur_frm.set_footnote(wn.markdown(cur_frm.meta.description));
|
||||
}
|
||||
|
||||
// For customizing print
|
||||
cur_frm.pformat.net_total = function(doc) {
|
||||
|
@ -8,43 +8,26 @@
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Please edit this list and import only required elements
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
|
||||
from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
|
||||
from webnotes.model import db_exists
|
||||
from webnotes.model.doc import Document, addchild, getchildren, make_autoname
|
||||
from webnotes.model.doclist import getlist, copy_doclist
|
||||
from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
|
||||
from webnotes import session, form, is_testing, msgprint, errprint
|
||||
|
||||
set = webnotes.conn.set
|
||||
sql = webnotes.conn.sql
|
||||
get_value = webnotes.conn.get_value
|
||||
in_transaction = webnotes.conn.in_transaction
|
||||
convert_to_lists = webnotes.conn.convert_to_lists
|
||||
|
||||
# -----------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
class DocType:
|
||||
def __init__(self, doc, doclist=[]):
|
||||
self.doc = doc
|
||||
self.doclist = doclist
|
||||
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 get_rate(self, arg):
|
||||
from webnotes.model.code import get_obj
|
||||
return get_obj('Sales Common').get_rate(arg, self)
|
||||
|
||||
def update_other_default_charges(self):
|
||||
sql("update `tabSales Taxes and Charges Master` set is_default = 0 where ifnull(is_default,0) = 1 and name != '%s' and company = '%s'" % (self.doc.name, self.doc.company))
|
||||
def update_other_default_charges(self):
|
||||
webnotes.conn.sql("update `tabSales Taxes and Charges Master` 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()
|
||||
def on_update(self):
|
||||
self.update_other_default_charges()
|
||||
|
@ -3,9 +3,9 @@
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2012-03-27 14:36:22',
|
||||
'creation': '2012-07-03 13:30:46',
|
||||
'docstatus': 0,
|
||||
'modified': '2012-03-27 14:36:22',
|
||||
'modified': '2012-07-12 13:43:32',
|
||||
'modified_by': u'Administrator',
|
||||
'owner': u'Administrator'
|
||||
},
|
||||
@ -17,6 +17,7 @@
|
||||
'autoname': u'field:title',
|
||||
'colour': u'White:FFF',
|
||||
'default_print_format': u'Standard',
|
||||
'description': u'Standard tax template that can be applied to all Sales Transactions. This template can contain list of tax heads and also other expense / income heads like "Shipping", "Insurance", "Handling" etc.\n\n#### Note\n\nThe tax rate you define here will be the standard tax rate for all **Items**. If there are **Items** that have different rates, they must be added in the **Item Tax** table in the **Item** master.\n\n#### Description of Columns\n\n1. Calculation Type: \n - This can be on **Net Total** (that is the sum of basic amount).\n - **On Previous Row Total / Amount** (for cumulative taxes or charges). If you select this option, the tax will be applied as a percentage of the previous row (in the tax table) amount or total.\n - **Actual** (as mentioned).\n2. Account Head: The Account ledger under which this tax will be booked\n3. Cost Center: If the tax / charge is an income (like shipping) or expense it needs to be booked against a Cost Center.\n4. Description: Description of the tax (that will be printed in invoices / quotes).\n5. Rate: Tax rate.\n6. Amount: Tax amount.\n7. Total: Cumulative total to this point.\n8. Enter Row: If based on "Previous Row Total" you can select the row number which will be taken as a base for this calculation (default is the previous row).\n9. Is this Tax included in Basic Rate?: If you check this, it means that this tax will not be shown below the item table, but will be included in the Basic Rate in your main item table. This is useful where you want give a flat price (inclusive of all taxes) price to customers.',
|
||||
'doctype': 'DocType',
|
||||
'document_type': u'Master',
|
||||
'module': u'Accounts',
|
||||
@ -24,7 +25,7 @@
|
||||
'section_style': u'Tabbed',
|
||||
'server_code_error': u' ',
|
||||
'show_in_menu': 0,
|
||||
'version': 57
|
||||
'version': 1
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
@ -33,7 +34,8 @@
|
||||
'name': '__common__',
|
||||
'parent': u'Sales Taxes and Charges Master',
|
||||
'parentfield': u'fields',
|
||||
'parenttype': u'DocType'
|
||||
'parenttype': u'DocType',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# These values are common for all DocPerm
|
||||
@ -52,6 +54,42 @@
|
||||
'name': u'Sales Taxes and Charges Master'
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'amend': 0,
|
||||
'cancel': 0,
|
||||
'create': 0,
|
||||
'doctype': u'DocPerm',
|
||||
'permlevel': 1,
|
||||
'role': u'Sales Master Manager',
|
||||
'submit': 0,
|
||||
'write': 0
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'amend': 0,
|
||||
'cancel': 0,
|
||||
'create': 0,
|
||||
'doctype': u'DocPerm',
|
||||
'permlevel': 1,
|
||||
'role': u'Sales User',
|
||||
'submit': 0,
|
||||
'write': 0
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'amend': 0,
|
||||
'cancel': 0,
|
||||
'create': 0,
|
||||
'doctype': u'DocPerm',
|
||||
'permlevel': 0,
|
||||
'role': u'Sales User',
|
||||
'submit': 0,
|
||||
'write': 0
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'amend': 0,
|
||||
@ -86,63 +124,6 @@
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'amend': 0,
|
||||
'cancel': 0,
|
||||
'create': 0,
|
||||
'doctype': u'DocPerm',
|
||||
'permlevel': 1,
|
||||
'role': u'Sales Master Manager',
|
||||
'submit': 0,
|
||||
'write': 0
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'amend': 0,
|
||||
'cancel': 0,
|
||||
'create': 0,
|
||||
'doctype': u'DocPerm',
|
||||
'permlevel': 1,
|
||||
'role': u'Sales User',
|
||||
'submit': 0,
|
||||
'write': 0
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'amend': 0,
|
||||
'cancel': 0,
|
||||
'create': 0,
|
||||
'doctype': u'DocPerm',
|
||||
'permlevel': 0,
|
||||
'role': u'Sales User',
|
||||
'submit': 0,
|
||||
'write': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'trash_reason',
|
||||
'fieldtype': u'Small Text',
|
||||
'label': u'Trash Reason',
|
||||
'oldfieldname': u'trash_reason',
|
||||
'oldfieldtype': u'Small Text',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'other_charges_details',
|
||||
'fieldtype': u'Section Break',
|
||||
'label': u'Other Charges Details',
|
||||
'oldfieldtype': u'Section Break',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
@ -152,7 +133,6 @@
|
||||
'label': u'Title',
|
||||
'oldfieldname': u'title',
|
||||
'oldfieldtype': u'Data',
|
||||
'permlevel': 0,
|
||||
'reqd': 1,
|
||||
'search_index': 0
|
||||
},
|
||||
@ -162,8 +142,20 @@
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'is_default',
|
||||
'fieldtype': u'Check',
|
||||
'label': u'Default',
|
||||
'permlevel': 0
|
||||
'label': u'Default'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': u'White:FFF',
|
||||
'description': u'* Will be calculated in the transaction.',
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'other_charges',
|
||||
'fieldtype': u'Table',
|
||||
'label': u'Sales Taxes and Charges Master',
|
||||
'oldfieldname': u'other_charges',
|
||||
'oldfieldtype': u'Table',
|
||||
'options': u'Sales Taxes and Charges'
|
||||
},
|
||||
|
||||
# DocField
|
||||
@ -176,20 +168,7 @@
|
||||
'oldfieldname': u'company',
|
||||
'oldfieldtype': u'Link',
|
||||
'options': u'Company',
|
||||
'permlevel': 0,
|
||||
'reqd': 1,
|
||||
'search_index': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'other_charges',
|
||||
'fieldtype': u'Table',
|
||||
'label': u'Sales Taxes and Charges Master',
|
||||
'oldfieldname': u'other_charges',
|
||||
'oldfieldtype': u'Table',
|
||||
'options': u'Sales Taxes and Charges',
|
||||
'permlevel': 0
|
||||
}
|
||||
]
|
||||
]
|
@ -0,0 +1 @@
|
||||
from __future__ import unicode_literals
|
@ -15,6 +15,7 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Please edit this list and import only required elements
|
||||
from __future__ import unicode_literals
|
||||
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
|
||||
|
@ -0,0 +1 @@
|
||||
from __future__ import unicode_literals
|
@ -0,0 +1 @@
|
||||
from __future__ import unicode_literals
|
@ -15,6 +15,7 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Please edit this list and import only required elements
|
||||
from __future__ import unicode_literals
|
||||
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
|
||||
|
@ -0,0 +1 @@
|
||||
from __future__ import unicode_literals
|
@ -3,30 +3,30 @@
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2012-03-27 14:35:48',
|
||||
'docstatus': 0,
|
||||
'modified': '2012-03-27 14:35:48',
|
||||
'modified_by': u'Administrator',
|
||||
'owner': u'wasim@webnotestech.com'
|
||||
u'creation': '2012-07-03 13:29:51',
|
||||
u'docstatus': 0,
|
||||
u'modified': '2012-09-17 11:08:28',
|
||||
u'modified_by': u'Administrator',
|
||||
u'owner': u'wasim@webnotestech.com'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'colour': u'White:FFF',
|
||||
'doctype': 'DocType',
|
||||
u'doctype': u'DocType',
|
||||
'istable': 1,
|
||||
'module': u'Accounts',
|
||||
'name': '__common__',
|
||||
u'name': u'__common__',
|
||||
'section_style': u'Simple',
|
||||
'server_code_error': u' ',
|
||||
'show_in_menu': 0,
|
||||
'version': 2
|
||||
'version': 1
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'name': '__common__',
|
||||
u'doctype': u'DocField',
|
||||
u'name': u'__common__',
|
||||
'parent': u'TDS Detail',
|
||||
'parentfield': u'fields',
|
||||
'parenttype': u'DocType',
|
||||
@ -36,54 +36,24 @@
|
||||
|
||||
# These values are common for all DocPerm
|
||||
{
|
||||
'doctype': u'DocPerm',
|
||||
'name': '__common__',
|
||||
u'doctype': u'DocPerm',
|
||||
u'name': u'__common__',
|
||||
'parent': u'TDS Detail',
|
||||
'parentfield': u'permissions',
|
||||
'parenttype': u'DocType',
|
||||
'read': 1
|
||||
'read': 1,
|
||||
'role': u'System Manager'
|
||||
},
|
||||
|
||||
# DocType, TDS Detail
|
||||
{
|
||||
'doctype': 'DocType',
|
||||
'name': u'TDS Detail'
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'create': 0,
|
||||
'doctype': u'DocPerm',
|
||||
'permlevel': 0,
|
||||
'role': u'All',
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'doctype': u'DocPerm',
|
||||
'permlevel': 1,
|
||||
'role': u'All'
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'doctype': u'DocPerm',
|
||||
'permlevel': 0,
|
||||
'role': u'System Manager',
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'doctype': u'DocPerm',
|
||||
'permlevel': 1,
|
||||
'role': u'System Manager'
|
||||
u'doctype': u'DocType',
|
||||
u'name': u'TDS Detail'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
u'doctype': u'DocField',
|
||||
'fieldname': u'tds_category',
|
||||
'fieldtype': u'Select',
|
||||
'label': u'TDS Category',
|
||||
@ -94,7 +64,7 @@
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
u'doctype': u'DocField',
|
||||
'fieldname': u'special_tds_rate_applicable',
|
||||
'fieldtype': u'Select',
|
||||
'label': u'Special TDS Rate Applicable',
|
||||
@ -105,7 +75,7 @@
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
u'doctype': u'DocField',
|
||||
'fieldname': u'special_tds_rate',
|
||||
'fieldtype': u'Currency',
|
||||
'label': u'Special TDS Rate(Section-197)\t',
|
||||
@ -115,11 +85,24 @@
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
u'doctype': u'DocField',
|
||||
'fieldname': u'special_tds_limit',
|
||||
'fieldtype': u'Currency',
|
||||
'label': u'Special TDS Limit',
|
||||
'oldfieldname': u'special_tds_limit',
|
||||
'oldfieldtype': u'Currency'
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
u'doctype': u'DocPerm',
|
||||
'permlevel': 0,
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
u'doctype': u'DocPerm',
|
||||
'permlevel': 1
|
||||
}
|
||||
]
|
@ -0,0 +1 @@
|
||||
from __future__ import unicode_literals
|
@ -15,6 +15,7 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Please edit this list and import only required elements
|
||||
from __future__ import unicode_literals
|
||||
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
|
||||
|
@ -0,0 +1 @@
|
||||
from __future__ import unicode_literals
|
@ -0,0 +1 @@
|
||||
from __future__ import unicode_literals
|
@ -0,0 +1 @@
|
||||
from __future__ import unicode_literals
|
@ -0,0 +1 @@
|
||||
from __future__ import unicode_literals
|
@ -0,0 +1 @@
|
||||
from __future__ import unicode_literals
|
@ -15,6 +15,7 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Please edit this list and import only required elements
|
||||
from __future__ import unicode_literals
|
||||
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
|
||||
|
@ -0,0 +1 @@
|
||||
from __future__ import unicode_literals
|
@ -0,0 +1 @@
|
||||
from __future__ import unicode_literals
|
@ -56,7 +56,11 @@ pscript['onload_Accounts Browser'] = function(wrapper){
|
||||
pscript['onshow_Accounts Browser'] = function(wrapper){
|
||||
// set route
|
||||
var ctype = wn.get_route()[1] || 'Account';
|
||||
wrapper.appframe.title('Chart of '+ctype+'s');
|
||||
|
||||
wrapper.appframe.clear_breadcrumbs();
|
||||
wrapper.appframe.add_breadcrumb('Chart of '+ctype+'s');
|
||||
document.title = 'Chart of '+ctype+'s';
|
||||
wrapper.appframe.add_breadcrumb(' in <a href="#!accounts-home">Accounts</a>');
|
||||
|
||||
if(erpnext.account_chart && erpnext.account_chart.ctype != ctype) {
|
||||
wrapper.$company_select.change();
|
||||
@ -153,13 +157,12 @@ erpnext.AccountsChart = Class.extend({
|
||||
fields: [
|
||||
{fieldtype:'Data', fieldname:'account_name', label:'New Account Name', reqd:true},
|
||||
{fieldtype:'Select', fieldname:'group_or_ledger', label:'Group or Ledger',
|
||||
options:'Group\nLedger'},
|
||||
options:'Group\nLedger', description:'Further accounts can be made under Groups,\
|
||||
but entries can be made against Ledger'},
|
||||
{fieldtype:'Select', fieldname:'account_type', label:'Account Type',
|
||||
options: ['', 'Fixed Asset Account', 'Bank or Cash', 'Expense Account', 'Tax',
|
||||
'Income Account', 'Chargeable'].join('\n') },
|
||||
{fieldtype:'Float', fieldname:'tax_rate', label:'Tax Rate'},
|
||||
{fieldtype:'Select', fieldname:'master_type', label:'Master Type',
|
||||
options: ['NA', 'Supplier', 'Customer', 'Employee'].join('\n') },
|
||||
{fieldtype:'Button', fieldname:'create_new', label:'Create New' }
|
||||
]
|
||||
})
|
||||
@ -170,11 +173,9 @@ erpnext.AccountsChart = Class.extend({
|
||||
$(fd.group_or_ledger.input).change(function() {
|
||||
if($(this).val()=='Group') {
|
||||
$(fd.account_type.wrapper).toggle(false);
|
||||
$(fd.master_type.wrapper).toggle(false);
|
||||
$(fd.tax_rate.wrapper).toggle(false);
|
||||
} else {
|
||||
$(fd.account_type.wrapper).toggle(true);
|
||||
$(fd.master_type.wrapper).toggle(true);
|
||||
if(fd.account_type.get_value()=='Tax') {
|
||||
$(fd.tax_rate.wrapper).toggle(true);
|
||||
}
|
||||
@ -199,6 +200,7 @@ erpnext.AccountsChart = Class.extend({
|
||||
|
||||
var node = me.selected_node();
|
||||
v.parent_account = node.data('label');
|
||||
v.master_type = '';
|
||||
v.company = me.company;
|
||||
|
||||
$c_obj('GL Control', 'add_ac', v,
|
||||
@ -224,10 +226,11 @@ erpnext.AccountsChart = Class.extend({
|
||||
fields: [
|
||||
{fieldtype:'Data', fieldname:'cost_center_name', label:'New Cost Center Name', reqd:true},
|
||||
{fieldtype:'Select', fieldname:'group_or_ledger', label:'Group or Ledger',
|
||||
options:'Group\nLedger'},
|
||||
options:'Group\nLedger', description:'Further accounts can be made under Groups,\
|
||||
but entries can be made against Ledger'},
|
||||
{fieldtype:'Button', fieldname:'create_new', label:'Create New' }
|
||||
]
|
||||
})
|
||||
});
|
||||
|
||||
// create
|
||||
$(d.fields_dict.create_new.input).click(function() {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user