Merge branch 'develop'

This commit is contained in:
Nabin Hait 2016-03-15 16:43:05 +05:30
commit 2c70238fbb
199 changed files with 13641 additions and 13732 deletions

View File

@ -1,2 +1,2 @@
from __future__ import unicode_literals from __future__ import unicode_literals
__version__ = '6.25.5' __version__ = '6.26.0'

View File

@ -25,11 +25,3 @@ cur_frm.cscript.invoice_no = function(doc, cdt, cdn) {
var d = locals[cdt][cdn]; var d = locals[cdt][cdn];
return get_server_fields('get_invoice_details', d.invoice_no, 'invoices', doc, cdt, cdn, 1); return get_server_fields('get_invoice_details', d.invoice_no, 'invoices', doc, cdt, cdn, 1);
} }
cur_frm.cscript.company = function(doc, cdt, cdn) {
erpnext.get_fiscal_year(doc.company, doc.received_date);
}
cur_frm.cscript.received_date = function(doc, cdt, cdn){
erpnext.get_fiscal_year(doc.company, doc.received_date);
}

View File

@ -16,6 +16,7 @@
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"length": 0, "length": 0,
@ -40,6 +41,7 @@
"fieldtype": "Select", "fieldtype": "Select",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"label": "Series", "label": "Series",
@ -64,6 +66,7 @@
"fieldtype": "Data", "fieldtype": "Data",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 1, "in_list_view": 1,
"label": "C-Form No", "label": "C-Form No",
@ -87,6 +90,7 @@
"fieldtype": "Date", "fieldtype": "Date",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 1, "in_list_view": 1,
"label": "Received Date", "label": "Received Date",
@ -110,6 +114,7 @@
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 1, "in_list_view": 1,
"label": "Customer", "label": "Customer",
@ -134,6 +139,7 @@
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"length": 0, "length": 0,
@ -158,6 +164,7 @@
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"label": "Company", "label": "Company",
@ -174,30 +181,6 @@
"set_only_once": 0, "set_only_once": 0,
"unique": 0 "unique": 0
}, },
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "fiscal_year",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Fiscal Year",
"length": 0,
"no_copy": 0,
"options": "Fiscal Year",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{ {
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
@ -206,6 +189,7 @@
"fieldtype": "Select", "fieldtype": "Select",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"label": "Quarter", "label": "Quarter",
@ -230,6 +214,7 @@
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"label": "Total Amount", "label": "Total Amount",
@ -254,6 +239,7 @@
"fieldtype": "Data", "fieldtype": "Data",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"label": "State", "label": "State",
@ -277,6 +263,7 @@
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"length": 0, "length": 0,
@ -299,6 +286,7 @@
"fieldtype": "Table", "fieldtype": "Table",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"label": "Invoices", "label": "Invoices",
@ -323,6 +311,7 @@
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"label": "Total Invoiced Amount", "label": "Total Invoiced Amount",
@ -347,6 +336,7 @@
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 1, "ignore_user_permissions": 1,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"label": "Amended From", "label": "Amended From",
@ -374,7 +364,7 @@
"issingle": 0, "issingle": 0,
"istable": 0, "istable": 0,
"max_attachments": 3, "max_attachments": 3,
"modified": "2016-02-03 01:09:33.043437", "modified": "2016-03-03 04:31:05.340444",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "C-Form", "name": "C-Form",

View File

@ -18,6 +18,7 @@
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"label": "", "label": "",
@ -25,6 +26,7 @@
"no_copy": 0, "no_copy": 0,
"permlevel": 0, "permlevel": 0,
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
@ -40,6 +42,7 @@
"fieldtype": "Data", "fieldtype": "Data",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 1, "in_list_view": 1,
"label": "Cost Center Name", "label": "Cost Center Name",
@ -49,6 +52,7 @@
"oldfieldtype": "Data", "oldfieldtype": "Data",
"permlevel": 0, "permlevel": 0,
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 1, "reqd": 1,
@ -64,6 +68,7 @@
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 1, "ignore_user_permissions": 1,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 1, "in_list_view": 1,
"label": "Parent Cost Center", "label": "Parent Cost Center",
@ -74,6 +79,7 @@
"options": "Cost Center", "options": "Cost Center",
"permlevel": 0, "permlevel": 0,
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 1, "reqd": 1,
@ -89,6 +95,7 @@
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 1, "in_list_view": 1,
"label": "Company", "label": "Company",
@ -99,6 +106,7 @@
"options": "Company", "options": "Company",
"permlevel": 0, "permlevel": 0,
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 1, "reqd": 1,
@ -114,12 +122,14 @@
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"length": 0, "length": 0,
"no_copy": 0, "no_copy": 0,
"permlevel": 0, "permlevel": 0,
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
@ -137,6 +147,7 @@
"fieldtype": "Check", "fieldtype": "Check",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"label": "Is Group", "label": "Is Group",
@ -145,6 +156,7 @@
"permlevel": 0, "permlevel": 0,
"precision": "", "precision": "",
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
@ -161,6 +173,7 @@
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"label": "Budget", "label": "Budget",
@ -168,6 +181,7 @@
"no_copy": 0, "no_copy": 0,
"permlevel": 0, "permlevel": 0,
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
@ -184,6 +198,7 @@
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"label": "Distribution Id", "label": "Distribution Id",
@ -194,6 +209,7 @@
"options": "Monthly Distribution", "options": "Monthly Distribution",
"permlevel": 0, "permlevel": 0,
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
@ -210,6 +226,7 @@
"fieldtype": "Table", "fieldtype": "Table",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"label": "Budgets", "label": "Budgets",
@ -220,6 +237,7 @@
"options": "Budget Detail", "options": "Budget Detail",
"permlevel": 0, "permlevel": 0,
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
@ -235,6 +253,7 @@
"fieldtype": "Int", "fieldtype": "Int",
"hidden": 1, "hidden": 1,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 1, "in_filter": 1,
"in_list_view": 0, "in_list_view": 0,
"label": "lft", "label": "lft",
@ -244,6 +263,7 @@
"oldfieldtype": "Int", "oldfieldtype": "Int",
"permlevel": 0, "permlevel": 0,
"print_hide": 1, "print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"report_hide": 1, "report_hide": 1,
"reqd": 0, "reqd": 0,
@ -259,6 +279,7 @@
"fieldtype": "Int", "fieldtype": "Int",
"hidden": 1, "hidden": 1,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 1, "in_filter": 1,
"in_list_view": 0, "in_list_view": 0,
"label": "rgt", "label": "rgt",
@ -268,6 +289,7 @@
"oldfieldtype": "Int", "oldfieldtype": "Int",
"permlevel": 0, "permlevel": 0,
"print_hide": 1, "print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"report_hide": 1, "report_hide": 1,
"reqd": 0, "reqd": 0,
@ -283,6 +305,7 @@
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 1, "hidden": 1,
"ignore_user_permissions": 1, "ignore_user_permissions": 1,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"label": "old_parent", "label": "old_parent",
@ -293,6 +316,7 @@
"options": "Cost Center", "options": "Cost Center",
"permlevel": 0, "permlevel": 0,
"print_hide": 1, "print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"report_hide": 1, "report_hide": 1,
"reqd": 0, "reqd": 0,
@ -311,7 +335,8 @@
"issingle": 0, "issingle": 0,
"istable": 0, "istable": 0,
"max_attachments": 0, "max_attachments": 0,
"modified": "2015-11-16 06:29:43.870712", "menu_index": 0,
"modified": "2016-03-14 15:59:51.508268",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Cost Center", "name": "Cost Center",
@ -337,6 +362,26 @@
"submit": 0, "submit": 0,
"write": 1 "write": 1
}, },
{
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 0,
"delete": 0,
"email": 0,
"export": 1,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 0,
"read": 1,
"report": 1,
"role": "Auditor",
"set_user_permissions": 0,
"share": 0,
"submit": 0,
"write": 0
},
{ {
"amend": 0, "amend": 0,
"apply_user_permissions": 0, "apply_user_permissions": 0,
@ -396,29 +441,10 @@
"share": 0, "share": 0,
"submit": 0, "submit": 0,
"write": 0 "write": 0
},
{
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 0,
"delete": 0,
"email": 0,
"export": 0,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 0,
"read": 1,
"report": 0,
"role": "Stock User",
"set_user_permissions": 0,
"share": 0,
"submit": 0,
"write": 0
} }
], ],
"read_only": 0, "read_only": 0,
"read_only_onload": 0, "read_only_onload": 0,
"search_fields": "parent_cost_center, is_group" "search_fields": "parent_cost_center, is_group",
"version": 0
} }

View File

@ -0,0 +1,8 @@
// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
// For license information, please see license.txt
frappe.ui.form.on('GL Entry', {
refresh: function(frm) {
}
});

View File

@ -9,6 +9,7 @@ from frappe.model.document import Document
from erpnext.accounts.party import validate_party_gle_currency, validate_party_frozen_disabled from erpnext.accounts.party import validate_party_gle_currency, validate_party_frozen_disabled
from erpnext.accounts.utils import get_account_currency from erpnext.accounts.utils import get_account_currency
from erpnext.setup.doctype.company.company import get_company_currency from erpnext.setup.doctype.company.company import get_company_currency
from erpnext.accounts.utils import get_fiscal_year
from erpnext.exceptions import InvalidAccountCurrency from erpnext.exceptions import InvalidAccountCurrency
exclude_from_linked_with = True exclude_from_linked_with = True
@ -18,11 +19,11 @@ class GLEntry(Document):
self.flags.ignore_submit_comment = True self.flags.ignore_submit_comment = True
self.check_mandatory() self.check_mandatory()
self.pl_must_have_cost_center() self.pl_must_have_cost_center()
self.validate_posting_date()
self.check_pl_account() self.check_pl_account()
self.validate_cost_center() self.validate_cost_center()
self.validate_party() self.validate_party()
self.validate_currency() self.validate_currency()
self.validate_and_set_fiscal_year()
def on_update_with_args(self, adv_adj, update_outstanding = 'Yes'): def on_update_with_args(self, adv_adj, update_outstanding = 'Yes'):
self.validate_account_details(adv_adj) self.validate_account_details(adv_adj)
@ -37,7 +38,7 @@ class GLEntry(Document):
self.against_voucher) self.against_voucher)
def check_mandatory(self): def check_mandatory(self):
mandatory = ['account','remarks','voucher_type','voucher_no','fiscal_year','company'] mandatory = ['account','remarks','voucher_type','voucher_no','company']
for k in mandatory: for k in mandatory:
if not self.get(k): if not self.get(k):
frappe.throw(_("{0} is required").format(self.meta.get_label(k))) frappe.throw(_("{0} is required").format(self.meta.get_label(k)))
@ -57,10 +58,6 @@ class GLEntry(Document):
elif self.cost_center: elif self.cost_center:
self.cost_center = None self.cost_center = None
def validate_posting_date(self):
from erpnext.accounts.utils import validate_fiscal_year
validate_fiscal_year(self.posting_date, self.fiscal_year, _("Posting Date"), self)
def check_pl_account(self): def check_pl_account(self):
if self.is_opening=='Yes' and \ if self.is_opening=='Yes' and \
frappe.db.get_value("Account", self.account, "report_type")=="Profit and Loss": frappe.db.get_value("Account", self.account, "report_type")=="Profit and Loss":
@ -112,6 +109,12 @@ class GLEntry(Document):
if self.party_type and self.party: if self.party_type and self.party:
validate_party_gle_currency(self.party_type, self.party, self.company, self.account_currency) validate_party_gle_currency(self.party_type, self.party, self.company, self.account_currency)
def validate_and_set_fiscal_year(self):
if not self.fiscal_year:
self.fiscal_year = get_fiscal_year(self.posting_date, company=self.company)[0]
def validate_balance_type(account, adv_adj=False): def validate_balance_type(account, adv_adj=False):
if not adv_adj and account: if not adv_adj and account:
balance_must_be = frappe.db.get_value("Account", account, "balance_must_be") balance_must_be = frappe.db.get_value("Account", account, "balance_must_be")

View File

@ -217,16 +217,6 @@ erpnext.accounts.JournalEntry = frappe.ui.form.Controller.extend({
cur_frm.script_manager.make(erpnext.accounts.JournalEntry); cur_frm.script_manager.make(erpnext.accounts.JournalEntry);
cur_frm.cscript.company = function(doc, cdt, cdn) {
cur_frm.refresh_fields();
erpnext.get_fiscal_year(doc.company, doc.posting_date);
}
cur_frm.cscript.posting_date = function(doc, cdt, cdn){
cur_frm.posting_date = cur_frm.doc.posting_date;
erpnext.get_fiscal_year(doc.company, doc.posting_date);
}
cur_frm.cscript.update_totals = function(doc) { cur_frm.cscript.update_totals = function(doc) {
var td=0.0; var tc =0.0; var td=0.0; var tc =0.0;
var accounts = doc.accounts || []; var accounts = doc.accounts || [];

View File

@ -1011,33 +1011,6 @@
"set_only_once": 0, "set_only_once": 0,
"unique": 0 "unique": 0
}, },
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "fiscal_year",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 1,
"in_list_view": 0,
"label": "Fiscal Year",
"length": 0,
"no_copy": 0,
"oldfieldname": "fiscal_year",
"oldfieldtype": "Select",
"options": "Fiscal Year",
"permlevel": 0,
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 1,
"set_only_once": 0,
"unique": 0
},
{ {
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
@ -1158,7 +1131,7 @@
"istable": 0, "istable": 0,
"max_attachments": 0, "max_attachments": 0,
"menu_index": 0, "menu_index": 0,
"modified": "2016-03-11 01:38:50.944473", "modified": "2016-03-11 01:38:50.944475",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Journal Entry", "name": "Journal Entry",

View File

@ -22,7 +22,6 @@ class JournalEntry(AccountsController):
self.is_opening='No' self.is_opening='No'
self.clearance_date = None self.clearance_date = None
super(JournalEntry, self).validate_date_with_fiscal_year()
self.validate_party() self.validate_party()
self.validate_cheque_info() self.validate_cheque_info()
self.validate_entries_for_advance() self.validate_entries_for_advance()

View File

@ -249,7 +249,6 @@ def make_journal_entry(account1, account2, amount, cost_center=None, exchange_ra
jv = frappe.new_doc("Journal Entry") jv = frappe.new_doc("Journal Entry")
jv.posting_date = "2013-02-14" jv.posting_date = "2013-02-14"
jv.company = "_Test Company" jv.company = "_Test Company"
jv.fiscal_year = "_Test Fiscal Year 2013"
jv.user_remark = "test" jv.user_remark = "test"
jv.multi_currency = 1 jv.multi_currency = 1
jv.set("accounts", [ jv.set("accounts", [

View File

@ -22,7 +22,6 @@
"parentfield": "accounts" "parentfield": "accounts"
} }
], ],
"fiscal_year": "_Test Fiscal Year 2013",
"naming_series": "_T-Journal Entry-", "naming_series": "_T-Journal Entry-",
"posting_date": "2013-02-14", "posting_date": "2013-02-14",
"user_remark": "test", "user_remark": "test",
@ -53,7 +52,6 @@
"parentfield": "accounts" "parentfield": "accounts"
} }
], ],
"fiscal_year": "_Test Fiscal Year 2013",
"naming_series": "_T-Journal Entry-", "naming_series": "_T-Journal Entry-",
"posting_date": "2013-02-14", "posting_date": "2013-02-14",
"user_remark": "test", "user_remark": "test",
@ -85,7 +83,6 @@
"parentfield": "accounts" "parentfield": "accounts"
} }
], ],
"fiscal_year": "_Test Fiscal Year 2013",
"naming_series": "_T-Journal Entry-", "naming_series": "_T-Journal Entry-",
"posting_date": "2013-02-14", "posting_date": "2013-02-14",
"user_remark": "test", "user_remark": "test",

View File

@ -18,6 +18,7 @@
"fieldtype": "Data", "fieldtype": "Data",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 1, "in_list_view": 1,
"label": "Distribution Name", "label": "Distribution Name",
@ -27,6 +28,7 @@
"oldfieldtype": "Data", "oldfieldtype": "Data",
"permlevel": 0, "permlevel": 0,
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 1, "reqd": 1,
@ -42,6 +44,7 @@
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 1, "in_filter": 1,
"in_list_view": 1, "in_list_view": 1,
"label": "Fiscal Year", "label": "Fiscal Year",
@ -52,6 +55,7 @@
"options": "Fiscal Year", "options": "Fiscal Year",
"permlevel": 0, "permlevel": 0,
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
@ -67,6 +71,7 @@
"fieldtype": "Table", "fieldtype": "Table",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"label": "Monthly Distribution Percentages", "label": "Monthly Distribution Percentages",
@ -77,6 +82,7 @@
"options": "Monthly Distribution Percentage", "options": "Monthly Distribution Percentage",
"permlevel": 0, "permlevel": 0,
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
@ -95,7 +101,7 @@
"issingle": 0, "issingle": 0,
"istable": 0, "istable": 0,
"max_attachments": 0, "max_attachments": 0,
"modified": "2015-11-16 06:29:50.431735", "modified": "2016-03-03 02:46:44.493857",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Monthly Distribution", "name": "Monthly Distribution",

View File

@ -211,7 +211,10 @@ def get_amount(ref_doc, dt):
grand_total = flt(ref_doc.grand_total) - flt(ref_doc.advance_paid) grand_total = flt(ref_doc.grand_total) - flt(ref_doc.advance_paid)
if dt == "Sales Invoice": if dt == "Sales Invoice":
if ref_doc.party_account_currency == ref_doc.currency:
grand_total = flt(ref_doc.outstanding_amount) grand_total = flt(ref_doc.outstanding_amount)
else:
grand_total = flt(ref_doc.outstanding_amount) / ref_doc.conversion_rate
if grand_total > 0 : if grand_total > 0 :
return grand_total return grand_total

View File

@ -2235,33 +2235,6 @@
"set_only_once": 0, "set_only_once": 0,
"unique": 0 "unique": 0
}, },
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "fiscal_year",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 1,
"in_list_view": 0,
"label": "Fiscal Year",
"length": 0,
"no_copy": 0,
"oldfieldname": "fiscal_year",
"oldfieldtype": "Select",
"options": "Fiscal Year",
"permlevel": 0,
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{ {
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
@ -2342,7 +2315,7 @@
"unique": 0 "unique": 0
}, },
{ {
"allow_on_submit": 0, "allow_on_submit": 1,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"depends_on": "is_recurring", "depends_on": "is_recurring",
@ -2668,7 +2641,7 @@
"istable": 0, "istable": 0,
"max_attachments": 0, "max_attachments": 0,
"menu_index": 0, "menu_index": 0,
"modified": "2016-03-03 03:26:44.180505", "modified": "2016-03-14 19:01:39.694265",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Purchase Invoice", "name": "Purchase Invoice",
@ -2797,7 +2770,7 @@
], ],
"read_only": 0, "read_only": 0,
"read_only_onload": 1, "read_only_onload": 1,
"search_fields": "posting_date, supplier, fiscal_year, bill_no, base_grand_total, outstanding_amount", "search_fields": "posting_date, supplier, bill_no, base_grand_total, outstanding_amount",
"sort_field": "modified", "sort_field": "modified",
"sort_order": "DESC", "sort_order": "DESC",
"timeline_field": "supplier", "timeline_field": "supplier",

View File

@ -10,7 +10,7 @@ import frappe.defaults
from erpnext.controllers.buying_controller import BuyingController from erpnext.controllers.buying_controller import BuyingController
from erpnext.accounts.party import get_party_account, get_due_date from erpnext.accounts.party import get_party_account, get_due_date
from erpnext.accounts.utils import get_account_currency from erpnext.accounts.utils import get_account_currency, get_fiscal_year
from erpnext.stock.doctype.purchase_receipt.purchase_receipt import update_billed_amount_based_on_po from erpnext.stock.doctype.purchase_receipt.purchase_receipt import update_billed_amount_based_on_po
form_grid_templates = { form_grid_templates = {
@ -432,11 +432,25 @@ class PurchaseInvoice(BuyingController):
if self.bill_date: if self.bill_date:
if getdate(self.bill_date) > getdate(self.posting_date): if getdate(self.bill_date) > getdate(self.posting_date):
frappe.throw("Supplier Invoice Date cannot be greater than Posting Date") frappe.throw("Supplier Invoice Date cannot be greater than Posting Date")
if self.bill_no: if self.bill_no:
if cint(frappe.db.get_single_value("Accounts Settings", "check_supplier_invoice_uniqueness")): if cint(frappe.db.get_single_value("Accounts Settings", "check_supplier_invoice_uniqueness")):
pi = frappe.db.exists("Purchase Invoice", {"bill_no": self.bill_no, fiscal_year = get_fiscal_year(self.posting_date, company=self.company, as_dict=True)
"fiscal_year": self.fiscal_year, "name": ("!=", self.name), "docstatus": ("<", 2)})
pi = frappe.db.sql('''select name from `tabPurchase Invoice`
where
bill_no = %(bill_no)s
and name != %(name)s
and docstatus < 2
and posting_date between %(year_start_date)s and %(year_end_date)s''', {
"bill_no": self.bill_no,
"name": self.name,
"year_start_date": fiscal_year.year_start_date,
"year_end_date": fiscal_year.year_end_date
})
if pi: if pi:
pi = pi[0][0]
frappe.throw("Supplier Invoice No exists in Purchase Invoice {0}".format(pi)) frappe.throw("Supplier Invoice No exists in Purchase Invoice {0}".format(pi))
def update_billing_status_in_pr(self, update_modified=True): def update_billing_status_in_pr(self, update_modified=True):

View File

@ -40,7 +40,6 @@
"uom": "_Test UOM" "uom": "_Test UOM"
} }
], ],
"fiscal_year": "_Test Fiscal Year 2013",
"grand_total": 0, "grand_total": 0,
"naming_series": "_T-BILL", "naming_series": "_T-BILL",
"taxes": [ "taxes": [
@ -166,7 +165,6 @@
"uom": "_Test UOM" "uom": "_Test UOM"
} }
], ],
"fiscal_year": "_Test Fiscal Year 2013",
"grand_total": 0, "grand_total": 0,
"naming_series": "_T-Purchase Invoice-", "naming_series": "_T-Purchase Invoice-",
"taxes": [ "taxes": [

View File

@ -2776,33 +2776,6 @@
"set_only_once": 0, "set_only_once": 0,
"unique": 0 "unique": 0
}, },
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "fiscal_year",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 1,
"in_list_view": 0,
"label": "Fiscal Year",
"length": 0,
"no_copy": 0,
"oldfieldname": "fiscal_year",
"oldfieldtype": "Select",
"options": "Fiscal Year",
"permlevel": 0,
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{ {
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
@ -3092,7 +3065,7 @@
"unique": 0 "unique": 0
}, },
{ {
"allow_on_submit": 0, "allow_on_submit": 1,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"depends_on": "is_recurring", "depends_on": "is_recurring",
@ -3445,7 +3418,7 @@
"istable": 0, "istable": 0,
"max_attachments": 0, "max_attachments": 0,
"menu_index": 0, "menu_index": 0,
"modified": "2016-03-10 10:57:29.923022", "modified": "2016-03-14 19:02:25.882750",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Sales Invoice", "name": "Sales Invoice",
@ -3554,7 +3527,7 @@
], ],
"read_only": 0, "read_only": 0,
"read_only_onload": 1, "read_only_onload": 1,
"search_fields": "posting_date, due_date, customer, fiscal_year, base_grand_total, outstanding_amount", "search_fields": "posting_date, due_date, customer, base_grand_total, outstanding_amount",
"sort_field": "modified", "sort_field": "modified",
"sort_order": "DESC", "sort_order": "DESC",
"timeline_field": "customer", "timeline_field": "customer",

View File

@ -23,7 +23,6 @@
"rate": 500.0 "rate": 500.0
} }
], ],
"fiscal_year": "_Test Fiscal Year 2013",
"base_grand_total": 561.8, "base_grand_total": 561.8,
"grand_total": 561.8, "grand_total": 561.8,
"is_pos": 0, "is_pos": 0,
@ -158,7 +157,6 @@
"stock_uom": "_Test UOM" "stock_uom": "_Test UOM"
} }
], ],
"fiscal_year": "_Test Fiscal Year 2013",
"grand_total": 0, "grand_total": 0,
"is_pos": 0, "is_pos": 0,
"naming_series": "_T-Sales Invoice-", "naming_series": "_T-Sales Invoice-",
@ -280,7 +278,6 @@
"stock_uom": "_Test UOM" "stock_uom": "_Test UOM"
} }
], ],
"fiscal_year": "_Test Fiscal Year 2013",
"grand_total": 0, "grand_total": 0,
"is_pos": 0, "is_pos": 0,
"naming_series": "_T-Sales Invoice-", "naming_series": "_T-Sales Invoice-",

View File

@ -142,7 +142,7 @@ def make_round_off_gle(gl_map, debit_credit_diff):
round_off_gle = frappe._dict() round_off_gle = frappe._dict()
for k in ["voucher_type", "voucher_no", "company", for k in ["voucher_type", "voucher_no", "company",
"posting_date", "remarks", "fiscal_year", "is_opening"]: "posting_date", "remarks", "is_opening"]:
round_off_gle[k] = gl_map[0][k] round_off_gle[k] = gl_map[0][k]
round_off_gle.update({ round_off_gle.update({

View File

@ -2,7 +2,7 @@
{%= frappe.boot.letter_heads[frappe.defaults.get_default("letter_head")] %} {%= frappe.boot.letter_heads[frappe.defaults.get_default("letter_head")] %}
</div> </div>
<h2 class="text-center">{%= __(report.report_name) %}</h2> <h2 class="text-center">{%= __(report.report_name) %}</h2>
<h4 class="text-center">{%= filters.account && (filters.account + ", ") || "" %} {%= filters.company %}</h4> <h4 class="text-center">{%= filters.customer || filters.supplier %} </h4>
<h5 class="text-center"> <h5 class="text-center">
{%= filters.ageing_based_on %} {%= filters.ageing_based_on %}
{%= __("Until") %} {%= __("Until") %}
@ -35,7 +35,7 @@
<td>{%= dateutil.str_to_user(data[i][__("Posting Date")]) %}</td> <td>{%= dateutil.str_to_user(data[i][__("Posting Date")]) %}</td>
<td>{%= data[i][__("Voucher Type")] %} <td>{%= data[i][__("Voucher Type")] %}
<br>{%= data[i][__("Voucher No")] %}</td> <br>{%= data[i][__("Voucher No")] %}</td>
<td>{%= data[i][__("Customer")] || data[i][__("Supplier")] %} <td>{%= data[i][__("Customer Name")] || data[i][__("Customer")] || data[i][__("Supplier Name")] || data[i][__("Supplier")] %}
{% if(__(report.report_name) == "Accounts Receivable") { %} {% if(__(report.report_name) == "Accounts Receivable") { %}
<br>{%= __("Territory") %}: {%= data[i][__("Territory")] %} <br>{%= __("Territory") %}: {%= data[i][__("Territory")] %}
{% } else { %} {% } else { %}

View File

@ -16,10 +16,10 @@ class FiscalYearError(frappe.ValidationError): pass
class BudgetError(frappe.ValidationError): pass class BudgetError(frappe.ValidationError): pass
@frappe.whitelist() @frappe.whitelist()
def get_fiscal_year(date=None, fiscal_year=None, label="Date", verbose=1, company=None): def get_fiscal_year(date=None, fiscal_year=None, label="Date", verbose=1, company=None, as_dict=False):
return get_fiscal_years(date, fiscal_year, label, verbose, company)[0] return get_fiscal_years(date, fiscal_year, label, verbose, company, as_dict=as_dict)[0]
def get_fiscal_years(transaction_date=None, fiscal_year=None, label="Date", verbose=1, company=None): def get_fiscal_years(transaction_date=None, fiscal_year=None, label="Date", verbose=1, company=None, as_dict=False):
# if year start date is 2012-04-01, year end date should be 2013-03-31 (hence subdate) # if year start date is 2012-04-01, year end date should be 2013-03-31 (hence subdate)
cond = " disabled = 0" cond = " disabled = 0"
if fiscal_year: if fiscal_year:
@ -36,10 +36,10 @@ def get_fiscal_years(transaction_date=None, fiscal_year=None, label="Date", verb
"fiscal_year": fiscal_year, "fiscal_year": fiscal_year,
"transaction_date": transaction_date, "transaction_date": transaction_date,
"company": company "company": company
}) }, as_dict=as_dict)
if not fy: if not fy:
error_msg = _("""{0} {1} not in any active Fiscal Year. For more details check {2}.""").format(label, formatdate(transaction_date), "https://erpnext.com/kb/accounts/fiscal-year-error") error_msg = _("""{0} {1} not in any active Fiscal Year. For more details check {2}.""").format(label, formatdate(transaction_date), "https://frappe.github.io/erpnext/user/manual/en/accounts/articles/fiscal-year-error")
if verbose==1: frappe.msgprint(error_msg) if verbose==1: frappe.msgprint(error_msg)
raise FiscalYearError, error_msg raise FiscalYearError, error_msg
return fy return fy
@ -488,4 +488,3 @@ def get_account(account_type=None, root_type=None, is_group=None, account_curren
"account_currency": account_currency or frappe.defaults.get_defaults().currency, "account_currency": account_currency or frappe.defaults.get_defaults().currency,
"company": company or frappe.defaults.get_defaults().company "company": company or frappe.defaults.get_defaults().company
}, "name") }, "name")

View File

@ -1997,33 +1997,6 @@
"set_only_once": 0, "set_only_once": 0,
"unique": 0 "unique": 0
}, },
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "fiscal_year",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 1,
"in_list_view": 0,
"label": "Fiscal Year",
"length": 0,
"no_copy": 0,
"oldfieldname": "fiscal_year",
"oldfieldtype": "Select",
"options": "Fiscal Year",
"permlevel": 0,
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 1,
"set_only_once": 0,
"unique": 0
},
{ {
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
@ -2396,7 +2369,7 @@
"unique": 0 "unique": 0
}, },
{ {
"allow_on_submit": 0, "allow_on_submit": 1,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"depends_on": "is_recurring", "depends_on": "is_recurring",
@ -2721,7 +2694,7 @@
"issingle": 0, "issingle": 0,
"istable": 0, "istable": 0,
"max_attachments": 0, "max_attachments": 0,
"modified": "2016-03-03 03:25:59.791729", "modified": "2016-03-14 19:00:26.271371",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Buying", "module": "Buying",
"name": "Purchase Order", "name": "Purchase Order",

View File

@ -6,7 +6,6 @@
"conversion_rate": 1.0, "conversion_rate": 1.0,
"currency": "INR", "currency": "INR",
"doctype": "Purchase Order", "doctype": "Purchase Order",
"fiscal_year": "_Test Fiscal Year 2013",
"base_grand_total": 5000.0, "base_grand_total": 5000.0,
"grand_total": 5000.0, "grand_total": 5000.0,
"is_subcontracted": "Yes", "is_subcontracted": "Yes",
@ -40,7 +39,6 @@
"conversion_rate": 1.0, "conversion_rate": 1.0,
"currency": "INR", "currency": "INR",
"doctype": "Purchase Order", "doctype": "Purchase Order",
"fiscal_year": "_Test Fiscal Year 2013",
"base_grand_total": 5000.0, "base_grand_total": 5000.0,
"grand_total": 5000.0, "grand_total": 5000.0,
"is_subcontracted": "No", "is_subcontracted": "No",

View File

@ -1720,32 +1720,6 @@
"set_only_once": 0, "set_only_once": 0,
"unique": 0 "unique": 0
}, },
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"default": "No",
"fieldname": "is_subcontracted",
"fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Is Subcontracted",
"length": 0,
"no_copy": 0,
"options": "\nYes\nNo",
"permlevel": 0,
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{ {
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
@ -1773,26 +1747,25 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"fieldname": "fiscal_year", "default": "No",
"fieldtype": "Link", "fieldname": "is_subcontracted",
"fieldtype": "Select",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0, "ignore_xss_filter": 0,
"in_filter": 1, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"label": "Fiscal Year", "label": "Is Subcontracted",
"length": 0, "length": 0,
"no_copy": 0, "no_copy": 0,
"oldfieldname": "fiscal_year", "options": "\nYes\nNo",
"oldfieldtype": "Select",
"options": "Fiscal Year",
"permlevel": 0, "permlevel": 0,
"print_hide": 1, "print_hide": 1,
"print_hide_if_no_value": 0, "print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 1, "reqd": 0,
"search_index": 1, "search_index": 0,
"set_only_once": 0, "set_only_once": 0,
"unique": 0 "unique": 0
} }
@ -1808,7 +1781,7 @@
"istable": 0, "istable": 0,
"max_attachments": 0, "max_attachments": 0,
"menu_index": 0, "menu_index": 0,
"modified": "2016-03-02 05:09:20.534046", "modified": "2016-03-04 00:56:36.066372",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Buying", "module": "Buying",
"name": "Supplier Quotation", "name": "Supplier Quotation",

View File

@ -5,7 +5,6 @@
"conversion_rate": 1.0, "conversion_rate": 1.0,
"currency": "INR", "currency": "INR",
"doctype": "Supplier Quotation", "doctype": "Supplier Quotation",
"fiscal_year": "_Test Fiscal Year 2013",
"base_grand_total": 5000.0, "base_grand_total": 5000.0,
"grand_total": 5000.0, "grand_total": 5000.0,
"is_subcontracted": "No", "is_subcontracted": "No",

View File

@ -0,0 +1,5 @@
- Fiscal Year has been removed from Transactions
- Holiday List based on From Date and To Date
- Valuation Rate and Gross Profit in Sales Order Item row
- Shopify sync status will be logged in Shopify Log
- Item Code or Warehouse filter mandatory in Stock Balance Report, if number of Stock Ledger Entries is greater than 500000

View File

@ -220,10 +220,10 @@ class AccountsController(TransactionBase):
gl_dict = frappe._dict({ gl_dict = frappe._dict({
'company': self.company, 'company': self.company,
'posting_date': self.posting_date, 'posting_date': self.posting_date,
'fiscal_year': get_fiscal_year(self.posting_date, company=self.company)[0],
'voucher_type': self.doctype, 'voucher_type': self.doctype,
'voucher_no': self.name, 'voucher_no': self.name,
'remarks': self.get("remarks"), 'remarks': self.get("remarks"),
'fiscal_year': self.fiscal_year,
'debit': 0, 'debit': 0,
'credit': 0, 'credit': 0,
'debit_in_account_currency': 0, 'debit_in_account_currency': 0,

View File

@ -40,6 +40,7 @@ def employee_query(doctype, txt, searchfield, start, page_len, filters):
order by order by
if(locate(%(_txt)s, name), locate(%(_txt)s, name), 99999), if(locate(%(_txt)s, name), locate(%(_txt)s, name), 99999),
if(locate(%(_txt)s, employee_name), locate(%(_txt)s, employee_name), 99999), if(locate(%(_txt)s, employee_name), locate(%(_txt)s, employee_name), 99999),
idx desc,
name, employee_name name, employee_name
limit %(start)s, %(page_len)s""".format(**{ limit %(start)s, %(page_len)s""".format(**{
'key': searchfield, 'key': searchfield,
@ -64,6 +65,7 @@ def lead_query(doctype, txt, searchfield, start, page_len, filters):
if(locate(%(_txt)s, name), locate(%(_txt)s, name), 99999), if(locate(%(_txt)s, name), locate(%(_txt)s, name), 99999),
if(locate(%(_txt)s, lead_name), locate(%(_txt)s, lead_name), 99999), if(locate(%(_txt)s, lead_name), locate(%(_txt)s, lead_name), 99999),
if(locate(%(_txt)s, company_name), locate(%(_txt)s, company_name), 99999), if(locate(%(_txt)s, company_name), locate(%(_txt)s, company_name), 99999),
idx desc,
name, lead_name name, lead_name
limit %(start)s, %(page_len)s""".format(**{ limit %(start)s, %(page_len)s""".format(**{
'key': searchfield, 'key': searchfield,
@ -94,6 +96,7 @@ def customer_query(doctype, txt, searchfield, start, page_len, filters):
order by order by
if(locate(%(_txt)s, name), locate(%(_txt)s, name), 99999), if(locate(%(_txt)s, name), locate(%(_txt)s, name), 99999),
if(locate(%(_txt)s, customer_name), locate(%(_txt)s, customer_name), 99999), if(locate(%(_txt)s, customer_name), locate(%(_txt)s, customer_name), 99999),
idx desc,
name, customer_name name, customer_name
limit %(start)s, %(page_len)s""".format(**{ limit %(start)s, %(page_len)s""".format(**{
"fields": fields, "fields": fields,
@ -123,6 +126,7 @@ def supplier_query(doctype, txt, searchfield, start, page_len, filters):
order by order by
if(locate(%(_txt)s, name), locate(%(_txt)s, name), 99999), if(locate(%(_txt)s, name), locate(%(_txt)s, name), 99999),
if(locate(%(_txt)s, supplier_name), locate(%(_txt)s, supplier_name), 99999), if(locate(%(_txt)s, supplier_name), locate(%(_txt)s, supplier_name), 99999),
idx desc,
name, supplier_name name, supplier_name
limit %(start)s, %(page_len)s """.format(**{ limit %(start)s, %(page_len)s """.format(**{
'field': fields, 'field': fields,
@ -142,6 +146,7 @@ def tax_account_query(doctype, txt, searchfield, start, page_len, filters):
and is_group = 0 and is_group = 0
and company = %s and company = %s
and `%s` LIKE %s and `%s` LIKE %s
order by idx desc, name
limit %s, %s""" % limit %s, %s""" %
(", ".join(['%s']*len(filters.get("account_type"))), "%s", searchfield, "%s", "%s", "%s"), (", ".join(['%s']*len(filters.get("account_type"))), "%s", searchfield, "%s", "%s", "%s"),
tuple(filters.get("account_type") + [filters.get("company"), "%%%s%%" % txt, tuple(filters.get("account_type") + [filters.get("company"), "%%%s%%" % txt,
@ -176,6 +181,7 @@ def item_query(doctype, txt, searchfield, start, page_len, filters):
order by order by
if(locate(%(_txt)s, name), locate(%(_txt)s, name), 99999), if(locate(%(_txt)s, name), locate(%(_txt)s, name), 99999),
if(locate(%(_txt)s, item_name), locate(%(_txt)s, item_name), 99999), if(locate(%(_txt)s, item_name), locate(%(_txt)s, item_name), 99999),
idx desc,
name, item_name name, item_name
limit %(start)s, %(page_len)s """.format(key=searchfield, limit %(start)s, %(page_len)s """.format(key=searchfield,
fcond=get_filters_cond(doctype, filters, conditions), fcond=get_filters_cond(doctype, filters, conditions),
@ -197,9 +203,16 @@ def bom(doctype, txt, searchfield, start, page_len, filters):
and tabBOM.is_active=1 and tabBOM.is_active=1
and tabBOM.%(key)s like "%(txt)s" and tabBOM.%(key)s like "%(txt)s"
%(fcond)s %(mcond)s %(fcond)s %(mcond)s
limit %(start)s, %(page_len)s """ % {'key': searchfield, 'txt': "%%%s%%" % frappe.db.escape(txt), order_by
if(locate(%(_txt)s, name), locate(%(_txt)s, name), 99999),
idx desc, name
limit %(start)s, %(page_len)s """ % {
'key': searchfield,
'txt': "%%%s%%" % frappe.db.escape(txt),
'_txt': txt.replace("%", ""),
'fcond': get_filters_cond(doctype, filters, conditions), 'fcond': get_filters_cond(doctype, filters, conditions),
'mcond':get_match_cond(doctype), 'start': start, 'page_len': page_len}) 'mcond':get_match_cond(doctype), 'start': start, 'page_len': page_len
})
def get_project_name(doctype, txt, searchfield, start, page_len, filters): def get_project_name(doctype, txt, searchfield, start, page_len, filters):
cond = '' cond = ''
@ -208,10 +221,19 @@ def get_project_name(doctype, txt, searchfield, start, page_len, filters):
return frappe.db.sql("""select `tabProject`.name from `tabProject` return frappe.db.sql("""select `tabProject`.name from `tabProject`
where `tabProject`.status not in ("Completed", "Cancelled") where `tabProject`.status not in ("Completed", "Cancelled")
and {cond} `tabProject`.name like %s {match_cond} and {cond} `tabProject`.name like %(txt)s {match_cond}
order by `tabProject`.name asc order by
limit {start}, {page_len}""".format(cond=cond, match_cond=get_match_cond(doctype), if(locate(%(_txt)s, name), locate(%(_txt)s, name), 99999),
start=start, page_len=page_len), "%{0}%".format(txt)) idx desc,
`tabProject`.name asc
limit {start}, {page_len}""".format(
cond=cond,
match_cond=get_match_cond(doctype),
start=start,
page_len=page_len), {
"txt": "%{0}%".format(txt),
"_txt": txt.relace('%', '')
})
def get_delivery_notes_to_be_billed(doctype, txt, searchfield, start, page_len, filters): def get_delivery_notes_to_be_billed(doctype, txt, searchfield, start, page_len, filters):
return frappe.db.sql("""select `tabDelivery Note`.name, `tabDelivery Note`.customer_name return frappe.db.sql("""select `tabDelivery Note`.name, `tabDelivery Note`.customer_name
@ -310,7 +332,8 @@ def get_income_account(doctype, txt, searchfield, start, page_len, filters):
or tabAccount.account_type in ("Income Account", "Temporary")) or tabAccount.account_type in ("Income Account", "Temporary"))
and tabAccount.is_group=0 and tabAccount.is_group=0
and tabAccount.`{key}` LIKE %(txt)s and tabAccount.`{key}` LIKE %(txt)s
{condition} {match_condition}""" {condition} {match_condition}
order by idx desc, name"""
.format(condition=condition, match_condition=get_match_cond(doctype), key=searchfield), { .format(condition=condition, match_condition=get_match_cond(doctype), key=searchfield), {
'txt': "%%%s%%" % frappe.db.escape(txt), 'txt': "%%%s%%" % frappe.db.escape(txt),
'company': filters.get("company", "") 'company': filters.get("company", "")

View File

@ -72,7 +72,6 @@ def manage_recurring_documents(doctype, next_date=None, commit=True):
frappe.throw(exception_message) frappe.throw(exception_message)
def make_new_document(reference_doc, date_field, posting_date): def make_new_document(reference_doc, date_field, posting_date):
from erpnext.accounts.utils import get_fiscal_year
new_document = frappe.copy_doc(reference_doc, ignore_no_copy=True) new_document = frappe.copy_doc(reference_doc, ignore_no_copy=True)
mcount = month_map[reference_doc.recurring_type] mcount = month_map[reference_doc.recurring_type]
@ -90,7 +89,6 @@ def make_new_document(reference_doc, date_field, posting_date):
date_field: posting_date, date_field: posting_date,
"from_date": from_date, "from_date": from_date,
"to_date": to_date, "to_date": to_date,
"fiscal_year": get_fiscal_year(posting_date)[0],
"next_date": get_next_date(from_date, mcount,cint(reference_doc.repeat_on_day_of_month)) "next_date": get_next_date(from_date, mcount,cint(reference_doc.repeat_on_day_of_month))
}) })

View File

@ -6,7 +6,7 @@ import frappe
from frappe.utils import cint, flt, cstr, comma_or from frappe.utils import cint, flt, cstr, comma_or
from erpnext.setup.utils import get_company_currency from erpnext.setup.utils import get_company_currency
from frappe import _, throw from frappe import _, throw
from erpnext.stock.get_item_details import get_available_qty from erpnext.stock.get_item_details import get_bin_details
from erpnext.controllers.stock_controller import StockController from erpnext.controllers.stock_controller import StockController
@ -24,7 +24,7 @@ class SellingController(StockController):
def onload(self): def onload(self):
if self.doctype in ("Sales Order", "Delivery Note", "Sales Invoice"): if self.doctype in ("Sales Order", "Delivery Note", "Sales Invoice"):
for item in self.get("items"): for item in self.get("items"):
item.update(get_available_qty(item.item_code, item.update(get_bin_details(item.item_code,
item.warehouse)) item.warehouse))
def validate(self): def validate(self):

View File

@ -6,6 +6,7 @@ import frappe
from frappe.utils import cint, flt, cstr from frappe.utils import cint, flt, cstr
from frappe import msgprint, _ from frappe import msgprint, _
import frappe.defaults import frappe.defaults
from erpnext.accounts.utils import get_fiscal_year
from erpnext.accounts.general_ledger import make_gl_entries, delete_gl_entries, process_gl_map from erpnext.accounts.general_ledger import make_gl_entries, delete_gl_entries, process_gl_map
from erpnext.stock.utils import get_incoming_rate from erpnext.stock.utils import get_incoming_rate
@ -181,6 +182,7 @@ class StockController(AccountsController):
"warehouse": d.get("warehouse", None), "warehouse": d.get("warehouse", None),
"posting_date": self.posting_date, "posting_date": self.posting_date,
"posting_time": self.posting_time, "posting_time": self.posting_time,
'fiscal_year': get_fiscal_year(self.posting_date, company=self.company)[0],
"voucher_type": self.doctype, "voucher_type": self.doctype,
"voucher_no": self.name, "voucher_no": self.name,
"voucher_detail_no": d.name, "voucher_detail_no": d.name,
@ -188,7 +190,6 @@ class StockController(AccountsController):
"stock_uom": frappe.db.get_value("Item", args.get("item_code") or d.get("item_code"), "stock_uom"), "stock_uom": frappe.db.get_value("Item", args.get("item_code") or d.get("item_code"), "stock_uom"),
"incoming_rate": 0, "incoming_rate": 0,
"company": self.company, "company": self.company,
"fiscal_year": self.fiscal_year,
"batch_no": cstr(d.get("batch_no")).strip(), "batch_no": cstr(d.get("batch_no")).strip(),
"serial_no": d.get("serial_no"), "serial_no": d.get("serial_no"),
"project": d.get("project_name"), "project": d.get("project_name"),

View File

@ -6,7 +6,6 @@ import frappe
import frappe.permissions import frappe.permissions
from erpnext.controllers.recurring_document import date_field_map from erpnext.controllers.recurring_document import date_field_map
from frappe.utils import get_first_day, get_last_day, add_to_date, nowdate, getdate, add_days from frappe.utils import get_first_day, get_last_day, add_to_date, nowdate, getdate, add_days
from erpnext.accounts.utils import get_fiscal_year
def test_recurring_document(obj, test_records): def test_recurring_document(obj, test_records):
frappe.db.set_value("Print Settings", "Print Settings", "send_print_as_pdf", 1) frappe.db.set_value("Print Settings", "Print Settings", "send_print_as_pdf", 1)
@ -20,7 +19,6 @@ def test_recurring_document(obj, test_records):
"notification_email_address": "test@example.com, test1@example.com, test2@example.com", "notification_email_address": "test@example.com, test1@example.com, test2@example.com",
"repeat_on_day_of_month": getdate(today).day, "repeat_on_day_of_month": getdate(today).day,
"due_date": None, "due_date": None,
"fiscal_year": get_fiscal_year(today)[0],
"from_date": get_first_day(today), "from_date": get_first_day(today),
"to_date": get_last_day(today) "to_date": get_last_day(today)
}) })

View File

@ -17,6 +17,7 @@
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"label": "", "label": "",
@ -25,6 +26,7 @@
"options": "icon-user", "options": "icon-user",
"permlevel": 0, "permlevel": 0,
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
@ -40,6 +42,7 @@
"fieldtype": "Select", "fieldtype": "Select",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"label": "Series", "label": "Series",
@ -50,6 +53,7 @@
"options": "LEAD-", "options": "LEAD-",
"permlevel": 0, "permlevel": 0,
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
@ -65,6 +69,7 @@
"fieldtype": "Data", "fieldtype": "Data",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 1, "in_filter": 1,
"in_list_view": 0, "in_list_view": 0,
"label": "Person Name", "label": "Person Name",
@ -74,6 +79,7 @@
"oldfieldtype": "Data", "oldfieldtype": "Data",
"permlevel": 0, "permlevel": 0,
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 1, "reqd": 1,
@ -89,6 +95,7 @@
"fieldtype": "Data", "fieldtype": "Data",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 1, "in_filter": 1,
"in_list_view": 1, "in_list_view": 1,
"label": "Organization Name", "label": "Organization Name",
@ -98,6 +105,7 @@
"oldfieldtype": "Data", "oldfieldtype": "Data",
"permlevel": 0, "permlevel": 0,
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
@ -113,6 +121,7 @@
"fieldtype": "Data", "fieldtype": "Data",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"label": "Email Id", "label": "Email Id",
@ -123,6 +132,7 @@
"options": "Email", "options": "Email",
"permlevel": 0, "permlevel": 0,
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
@ -138,12 +148,14 @@
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"length": 0, "length": 0,
"no_copy": 0, "no_copy": 0,
"permlevel": 0, "permlevel": 0,
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
@ -161,6 +173,7 @@
"fieldtype": "Select", "fieldtype": "Select",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 1, "in_filter": 1,
"in_list_view": 1, "in_list_view": 1,
"label": "Status", "label": "Status",
@ -171,6 +184,7 @@
"options": "Lead\nOpen\nReplied\nOpportunity\nInterested\nConverted\nDo Not Contact", "options": "Lead\nOpen\nReplied\nOpportunity\nInterested\nConverted\nDo Not Contact",
"permlevel": 0, "permlevel": 0,
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 1, "reqd": 1,
@ -186,6 +200,7 @@
"fieldtype": "Select", "fieldtype": "Select",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 1, "in_filter": 1,
"in_list_view": 0, "in_list_view": 0,
"label": "Source", "label": "Source",
@ -196,6 +211,7 @@
"options": "\nAdvertisement\nBlog Post\nCampaign\nCall\nCustomer\nExhibition\nSupplier\nWebsite\nEmail", "options": "\nAdvertisement\nBlog Post\nCampaign\nCall\nCustomer\nExhibition\nSupplier\nWebsite\nEmail",
"permlevel": 0, "permlevel": 0,
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
@ -212,6 +228,7 @@
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"label": "From Customer", "label": "From Customer",
@ -222,6 +239,7 @@
"options": "Customer", "options": "Customer",
"permlevel": 0, "permlevel": 0,
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
@ -239,6 +257,7 @@
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"label": "Campaign Name", "label": "Campaign Name",
@ -249,6 +268,7 @@
"options": "Campaign", "options": "Campaign",
"permlevel": 0, "permlevel": 0,
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
@ -264,6 +284,7 @@
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"length": 0, "length": 0,
@ -271,6 +292,7 @@
"permlevel": 0, "permlevel": 0,
"precision": "", "precision": "",
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
@ -287,6 +309,7 @@
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 1, "in_filter": 1,
"in_list_view": 0, "in_list_view": 0,
"label": "Lead Owner", "label": "Lead Owner",
@ -297,6 +320,7 @@
"options": "User", "options": "User",
"permlevel": 0, "permlevel": 0,
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
@ -312,6 +336,7 @@
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"length": 0, "length": 0,
@ -319,6 +344,7 @@
"permlevel": 0, "permlevel": 0,
"precision": "", "precision": "",
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
@ -334,6 +360,7 @@
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 1, "in_filter": 1,
"in_list_view": 0, "in_list_view": 0,
"label": "Next Contact By", "label": "Next Contact By",
@ -344,6 +371,7 @@
"options": "User", "options": "User",
"permlevel": 0, "permlevel": 0,
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
@ -361,6 +389,7 @@
"fieldtype": "Datetime", "fieldtype": "Datetime",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 1, "in_filter": 1,
"in_list_view": 0, "in_list_view": 0,
"label": "Next Contact Date", "label": "Next Contact Date",
@ -370,6 +399,7 @@
"oldfieldtype": "Date", "oldfieldtype": "Date",
"permlevel": 0, "permlevel": 0,
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
@ -386,6 +416,7 @@
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"label": "Address & Contact", "label": "Address & Contact",
@ -395,6 +426,7 @@
"options": "icon-map-marker", "options": "icon-map-marker",
"permlevel": 0, "permlevel": 0,
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
@ -411,6 +443,7 @@
"fieldtype": "HTML", "fieldtype": "HTML",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"label": "Address Desc", "label": "Address Desc",
@ -418,6 +451,7 @@
"no_copy": 0, "no_copy": 0,
"permlevel": 0, "permlevel": 0,
"print_hide": 1, "print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
@ -433,6 +467,7 @@
"fieldtype": "HTML", "fieldtype": "HTML",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"label": "Address HTML", "label": "Address HTML",
@ -440,6 +475,7 @@
"no_copy": 0, "no_copy": 0,
"permlevel": 0, "permlevel": 0,
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1, "read_only": 1,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
@ -455,12 +491,14 @@
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"length": 0, "length": 0,
"no_copy": 0, "no_copy": 0,
"permlevel": 0, "permlevel": 0,
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
@ -476,6 +514,7 @@
"fieldtype": "Data", "fieldtype": "Data",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"label": "Phone", "label": "Phone",
@ -485,6 +524,7 @@
"oldfieldtype": "Data", "oldfieldtype": "Data",
"permlevel": 0, "permlevel": 0,
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
@ -500,6 +540,7 @@
"fieldtype": "Data", "fieldtype": "Data",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"label": "Mobile No.", "label": "Mobile No.",
@ -509,6 +550,7 @@
"oldfieldtype": "Data", "oldfieldtype": "Data",
"permlevel": 0, "permlevel": 0,
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
@ -524,6 +566,7 @@
"fieldtype": "Data", "fieldtype": "Data",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"label": "Fax", "label": "Fax",
@ -533,6 +576,7 @@
"oldfieldtype": "Data", "oldfieldtype": "Data",
"permlevel": 0, "permlevel": 0,
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
@ -548,6 +592,7 @@
"fieldtype": "Data", "fieldtype": "Data",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"label": "Website", "label": "Website",
@ -557,6 +602,7 @@
"oldfieldtype": "Data", "oldfieldtype": "Data",
"permlevel": 0, "permlevel": 0,
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
@ -573,6 +619,7 @@
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"label": "Territory", "label": "Territory",
@ -583,6 +630,7 @@
"options": "Territory", "options": "Territory",
"permlevel": 0, "permlevel": 0,
"print_hide": 1, "print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
@ -598,6 +646,7 @@
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"label": "More Information", "label": "More Information",
@ -607,6 +656,7 @@
"options": "icon-file-text", "options": "icon-file-text",
"permlevel": 0, "permlevel": 0,
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
@ -622,6 +672,7 @@
"fieldtype": "Select", "fieldtype": "Select",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 1, "in_filter": 1,
"in_list_view": 0, "in_list_view": 0,
"label": "Lead Type", "label": "Lead Type",
@ -632,6 +683,7 @@
"options": "\nClient\nChannel Partner\nConsultant", "options": "\nClient\nChannel Partner\nConsultant",
"permlevel": 0, "permlevel": 0,
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
@ -647,6 +699,7 @@
"fieldtype": "Select", "fieldtype": "Select",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 1, "in_filter": 1,
"in_list_view": 0, "in_list_view": 0,
"label": "Market Segment", "label": "Market Segment",
@ -657,6 +710,7 @@
"options": "\nLower Income\nMiddle Income\nUpper Income", "options": "\nLower Income\nMiddle Income\nUpper Income",
"permlevel": 0, "permlevel": 0,
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
@ -672,6 +726,7 @@
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"label": "Industry", "label": "Industry",
@ -682,6 +737,7 @@
"options": "Industry Type", "options": "Industry Type",
"permlevel": 0, "permlevel": 0,
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
@ -697,6 +753,7 @@
"fieldtype": "Select", "fieldtype": "Select",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"label": "Request Type", "label": "Request Type",
@ -707,31 +764,7 @@
"options": "\nProduct Enquiry\nRequest for Information\nSuggestions\nOther", "options": "\nProduct Enquiry\nRequest for Information\nSuggestions\nOther",
"permlevel": 0, "permlevel": 0,
"print_hide": 0, "print_hide": 0,
"read_only": 0, "print_hide_if_no_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "fiscal_year",
"fieldtype": "Link",
"hidden": 1,
"ignore_user_permissions": 0,
"in_filter": 1,
"in_list_view": 0,
"label": "Fiscal Year",
"length": 0,
"no_copy": 0,
"oldfieldname": "fiscal_year",
"oldfieldtype": "Select",
"options": "Fiscal Year",
"permlevel": 0,
"print_hide": 0,
"read_only": 0, "read_only": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
@ -747,6 +780,7 @@
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"length": 0, "length": 0,
@ -754,6 +788,7 @@
"oldfieldtype": "Column Break", "oldfieldtype": "Column Break",
"permlevel": 0, "permlevel": 0,
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
@ -770,6 +805,7 @@
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"label": "Company", "label": "Company",
@ -780,6 +816,7 @@
"options": "Company", "options": "Company",
"permlevel": 0, "permlevel": 0,
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
@ -795,6 +832,7 @@
"fieldtype": "Check", "fieldtype": "Check",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"label": "Unsubscribed", "label": "Unsubscribed",
@ -802,6 +840,7 @@
"no_copy": 0, "no_copy": 0,
"permlevel": 0, "permlevel": 0,
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
@ -817,6 +856,7 @@
"fieldtype": "Check", "fieldtype": "Check",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"label": "Blog Subscriber", "label": "Blog Subscriber",
@ -824,6 +864,7 @@
"no_copy": 0, "no_copy": 0,
"permlevel": 0, "permlevel": 0,
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
@ -842,7 +883,7 @@
"issingle": 0, "issingle": 0,
"istable": 0, "istable": 0,
"max_attachments": 0, "max_attachments": 0,
"modified": "2015-11-16 06:29:49.250337", "modified": "2016-03-03 04:03:54.822184",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "CRM", "module": "CRM",
"name": "Lead", "name": "Lead",

View File

@ -31,8 +31,6 @@ erpnext.crm.Opportunity = frappe.ui.form.Controller.extend({
set_multiple(cdt, cdn, { status:'Draft' }); set_multiple(cdt, cdn, { status:'Draft' });
if(!this.frm.doc.company && frappe.defaults.get_user_default("Company")) if(!this.frm.doc.company && frappe.defaults.get_user_default("Company"))
set_multiple(cdt, cdn, { company:frappe.defaults.get_user_default("Company") }); set_multiple(cdt, cdn, { company:frappe.defaults.get_user_default("Company") });
if(!this.frm.doc.fiscal_year && sys_defaults.fiscal_year)
set_multiple(cdt, cdn, { fiscal_year:sys_defaults.fiscal_year });
this.setup_queries(); this.setup_queries();
}, },
@ -166,13 +164,3 @@ cur_frm.cscript['Declare Opportunity Lost'] = function() {
}); });
dialog.show(); dialog.show();
} }
cur_frm.cscript.company = function(doc, cdt, cdn) {
erpnext.get_fiscal_year(doc.company, doc.transaction_date);
}
cur_frm.cscript.transaction_date = function(doc, cdt, cdn){
erpnext.get_fiscal_year(doc.company, doc.transaction_date);
}

View File

@ -802,33 +802,6 @@
"unique": 0, "unique": 0,
"width": "50px" "width": "50px"
}, },
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "fiscal_year",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 1,
"in_list_view": 0,
"label": "Fiscal Year",
"length": 0,
"no_copy": 0,
"oldfieldname": "fiscal_year",
"oldfieldtype": "Select",
"options": "Fiscal Year",
"permlevel": 0,
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 1,
"set_only_once": 0,
"unique": 0
},
{ {
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
@ -1001,7 +974,7 @@
"issingle": 0, "issingle": 0,
"istable": 0, "istable": 0,
"max_attachments": 0, "max_attachments": 0,
"modified": "2016-03-02 05:12:15.429804", "modified": "2016-03-03 06:13:49.728079",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "CRM", "module": "CRM",
"name": "Opportunity", "name": "Opportunity",

View File

@ -40,8 +40,6 @@ class Opportunity(TransactionBase):
if not self.title: if not self.title:
self.title = self.customer_name self.title = self.customer_name
from erpnext.accounts.utils import validate_fiscal_year
validate_fiscal_year(self.transaction_date, self.fiscal_year, _("Opportunity Date"), self)
def make_new_lead_if_required(self): def make_new_lead_if_required(self):
"""Set lead against new opportunity""" """Set lead against new opportunity"""

View File

@ -6,7 +6,6 @@
"enquiry_type": "Sales", "enquiry_type": "Sales",
"lead": "_T-Lead-00001", "lead": "_T-Lead-00001",
"transaction_date": "2013-12-12", "transaction_date": "2013-12-12",
"fiscal_year": "_Test Fiscal Year 2013",
"items": [{ "items": [{
"item_name": "Test Item", "item_name": "Test Item",
"description": "Some description" "description": "Some description"

Binary file not shown.

After

Width:  |  Height:  |  Size: 535 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 466 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 701 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 464 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 213 KiB

View File

Before

Width:  |  Height:  |  Size: 173 KiB

After

Width:  |  Height:  |  Size: 173 KiB

View File

Before

Width:  |  Height:  |  Size: 160 KiB

After

Width:  |  Height:  |  Size: 160 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

View File

@ -1,10 +0,0 @@
<!-- title: Table of Contents -->
<h1>Table of Contents</h1>
<br>
{% include "templates/includes/full_index.html" %}
<!-- autodoc -->
<!-- jinja -->
<!-- no-breadcrumbs -->

View File

@ -1,6 +1,6 @@
#Purchasing in Different Unit (UoM) #Purchasing in Different Unit (UoM)
Each item has stock unit of measument (UoM) associated to it. For example UoM of pen is nos. and sand stocked kgs. But item could be purchased in different UoM, like 1 set/box of pen, or one truck of sand. In ERPNex, you can create purchase transaction for an item having different UoM than item's stock UoM. Each item has stock unit of measument (UoM) associated to it. For example UoM of pen could be numbers (Nos) and sand could be stocked kgs. However, when we place an order with Supplier, UoM for an item could change. Like we can order 1 set/box of Pen, or one truck of sand to our Supplier. When creating purchase transacton, you can change Purchase UoM for an item.
### Scenario: ### Scenario:

View File

@ -12,7 +12,7 @@ If not configured otherwise, ERPNext uses the Supplier's Name as the unique name
You can define or select the Naming Series pattern from: You can define or select the Naming Series pattern from:
> Setup > Settings > Naming Series `Setup > Data > Naming Series`
[Click here to know more about defining a Naming Series.]({{docs_base_url}}/user/manual/en/setting-up/settings/naming-series.html) [Click here to know more about defining a Naming Series.]({{docs_base_url}}/user/manual/en/setting-up/settings/naming-series.html)

View File

@ -1,37 +1,35 @@
Suppliers are companies or individuals who provide you with products or Suppliers are companies or individuals who provide you with products or services.
services. They are treated in exactly the same manner as Customers in ERPNext.
You can create a new Supplier via: You can create a new Supplier from:
> Buying > Documents > Supplier > New Supplier `Buying > Documents > Supplier > New Supplier`
<img class="screenshot" alt="Supplier Master" src="{{docs_base_url}}/assets/img/buying/supplier-master.png"> <img class="screenshot" alt="Supplier Master" src="{{docs_base_url}}/assets/img/buying/supplier-master.png">
### Contacts and Addresses ### Contacts and Addresses
Contacts and Addresses in ERPNext are stored separately so that you can attach Contacts and Addresses in ERPNext are stored separately so that you can create multiple Contacts and Addresses for a Suppliers. Once Supplier is saved, you will find option to create Contact and Address for that Supplier.
multiple Contacts or Addresses to Customers and Suppliers. To add a Contact or
Address go to Buying and click on “New Contact” or “New Address”.
> Tip: When you select a Supplier in any transaction, one Contact and Address <img class="screenshot" alt="Supplier Master" src="{{docs_base_url}}/assets/img/buying/supplier-new-address-contact.png">
gets pre-selected. This is the “Default Contact or Address”. So make sure you
set your defaults correctly! > Tip: When you select a Supplier in any transaction, Contact for which "Is Primary" field id checked, it will auto-fetch with the Supplier details.
### Integration with Accounts ### Integration with Accounts
In ERPNext, there is a separate Account record for each Supplier, of Each For all the Supplier, "Creditor" account is set as default payable Account. When Purchase Invoice is created, payable towards the supplier is booked against "Creditors" account.
company.
When you create a new Supplier, ERPNext will automatically create an Account If you want to customize payable account for the Supplier, you should first add a payable Account in the Chart of Account, and then select that Payable Account in the Supplier master.
Ledger for the Supplier under “Accounts Payable” in the Company set in the
Supplier record.
> Advanced Tip: If you want to change the Account Group under which the <img class="screenshot" alt="Supplier Master" src="{{docs_base_url}}/assets/img/buying/supplier-payable-account.png">
Supplier Account is created, you can set it in the Company master.
If you want to create an Account in another Company, just change the Company If you don't want to customize payable account, and proceed with default payable account "Creditor", then do not update any value in the Default Supplier Account's table.
value and “Save” the Supplier again.
> Tip: You can also import from the Data Import Tool > Advanced Tip: Default Payable Account is set in the Company master. If you want to set another account as Account as default for payable instead of Creditors Account, go to Company master, and set that account as "Default Payable Account".
You can add multiple companies in your ERPNext instance, and one Supplier can be used across multiple companies. In this case, you should define Companywise Payable Account for the Supplier in the "Default Payable Accounts" table.
<iframe width="660" height="371" src="https://www.youtube.com/embed/anoGi_RpQ20" frameborder="0" allowfullscreen></iframe>
(Check from 2:20)
{next} {next}

View File

@ -19,7 +19,7 @@ in the Sales Order Doctype, then you should check Is Child Table. Else no.
not be able to re-produce. not be able to re-produce.
1. Custom?: This field will be checked by default when adding Custom Doctype. 1. Custom?: This field will be checked by default when adding Custom Doctype.
![Doctype Basic]({{docs_base_url}}/assets/img/setup/customize/doctype-basics.png) <img alt="Doctype Basic" class="screenshot" src="{{docs_base_url}}/assets/img/setup/customize/doctype-basics.png">
#### Fields #### Fields
@ -34,7 +34,7 @@ Fields are much more than database columns, they can be:
1. Actions (button) 1. Actions (button)
1. Attachments or Images 1. Attachments or Images
![Doctype fields]({{docs_base_url}}/assets/img/setup/customize/Doctype-all-fields.png) <img alt="Doc fields" class="screenshot" src="{{docs_base_url}}/assets/img/setup/customize/doctype-all-fields.png">
When you add fields, you need to enter the **Type**. **Label** is optional for Section Break and Column Break. **Name** (`fieldname`) is the name of the database table column. When you add fields, you need to enter the **Type**. **Label** is optional for Section Break and Column Break. **Name** (`fieldname`) is the name of the database table column.
@ -44,19 +44,19 @@ You can also set other properties of the field like whether it is mandatory, rea
In this section, you can define criteria based on which document for this doctype will be named. There are multiple criterion based on which document can be named, like naming based on the value in the specific field, or based on Naming Series, or based on value provided by the user in the prompt, which will be shown when saving document. In the following example, we are doing naming based on the value in the field **book_name**. In this section, you can define criteria based on which document for this doctype will be named. There are multiple criterion based on which document can be named, like naming based on the value in the specific field, or based on Naming Series, or based on value provided by the user in the prompt, which will be shown when saving document. In the following example, we are doing naming based on the value in the field **book_name**.
![Doctype Naming]({{docs_base_url}}/assets/img/setup/customize/doctype-field-naming.png) <img alt="Doctype Naming" class="screenshot" src="{{docs_base_url}}/assets/img/setup/customize/doctype-field-naming.png">
#### Permission #### Permission
In this table, you should select roles and define permission roles for them for this Doctype. In this table, you should select roles and define permission roles for them for this Doctype.
![Doctype Permissions]({{docs_base_url}}/assets/img/setup/customize/Doctype-permissions.png) <img alt="Doctype Permissions" class="screenshot" src="{{docs_base_url}}/assets/img/setup/customize/doctype-permissions.png">
#### Save Doctype #### Save Doctype
On saving doctype, you will get pop-up to provide name for this Doctype. On saving doctype, you will get pop-up to provide name for this Doctype.
![Doctype Save]({{docs_base_url}}/assets/img/setup/customize/Doctype-save.png) <img alt="Doctype Save" class="screenshot" src="{{docs_base_url}}/assets/img/setup/customize/Doctype-save.png">
#### Doctype in System #### Doctype in System
@ -65,10 +65,12 @@ Human Resource module, to access this doctype, go to:
`Human Resource > Document > Book` `Human Resource > Document > Book`
![Doctype List]({{docs_base_url}}/assets/img/setup/customize/Doctype-list-view.png) <img alt="Doctype List" class="screenshot" src="{{docs_base_url}}/assets/img/setup/customize/doctype-list-view.png">
#### Book master #### Book master
Using the fields entered, following is the master one book. Using the fields entered, following is the master one book.
![Doctype List]({{docs_base_url}}/assets/img/setup/customize/Doctype-book-added.png) <img alt="Doctype Form" class="screenshot" src="{{docs_base_url}}/assets/img/setup/customize/Doctype-book-added.png">
{next}

View File

@ -1,77 +1,70 @@
Custom Field feature allows you to insert fields in the existing masters and transactions as per your requirement. While inseting custom field, you can define its properties like. Every form in the ERPNext has standard set of fields. If you need to capture some information, but there is no standard field available for it, you can insert Custom Field in a form as per your requirement.
* Field Name/Label
* Field Type
* Mandatory/Non-Mandatory
* Insert After Field
To add a Custom Field, go to:
> Setup > Customize > Custom Field > New Custom Field
You can also insert new Custom Field from [Customize Form](https://erpnext.com/customize-erpnext/customize-form) tool.
In Customize Form, for each field, you will find plus (+) option. When click on it, new row will be inserted above that field. You can enter properties for your Custom Field in the newly added blank row.
![Customize Form Custom Field]({{docs_base_url}}/assets/old_images/erpnext/customize-form-custom-field.png)
Following are the steps to insert Custom Field in the existing form. Following are the steps to insert Custom Field in the existing form.
####New Custom Field form / Row in Customize Form ####Customize Form
As mentioned above, you can insert Custom Field from Custom Field form, and also from Customize Form. To add a Custom Field, go to:
####Select Document/Form `Setup > Customize > Customize Form`
You should select transaction or master in which you want to insert custom field. Let's assume you need to insert a custom link field in the Quotation form. In this case, Document will be "Quotation". ####Select Document Type
![Custom Field Document]({{docs_base_url}}/assets/old_images/erpnext/custom-field-document.png) In the Customize Form, select Document Type in which you want to insert Custom Field. Let's assume we are inserting Custom Field in the Employee master.
<img alt="Select Document Type" class="screenshot" src="{{docs_base_url}}/assets/img/customize/custom-field-1.gif">
#### Insert Row for the Custom Field
In Customize Form, open the field above which you want to insert a Custom Field. Click on Insert Above.
<img alt="Select Document Type" class="screenshot" src="{{docs_base_url}}/assets/img/customize/custom-field-2.gif">
####Set Field Label ####Set Field Label
Custom Field's name will be set based on its Label. If you want to create Custom Field with specific name, but with different label, then you should first set Label as you want Field Name to be set. After Custom Field is saved, you can edit the Field Label again. Custom Field's name will be set based on its Label. If you want to create Custom Field with specific name, but with different label, then you should first set Label as you want Field Name to be set. After Custom Field is saved, you can edit the Field Label again.
![Custom Field Label]({{docs_base_url}}/assets/old_images/erpnext/custom-field-label.png) <img alt="Select Document Type" class="screenshot" src="{{docs_base_url}}/assets/img/customize/custom-field-3.png">
####Select Insert After
This field will have all the existing field of the form/doctype selected. Your Custom Field will be placed after field you select in the Insert After field.
![Custom Field Insert]({{docs_base_url}}/assets/old_images/erpnext/custom-field-insert.png)
####Select Field Type ####Select Field Type
Click [here](https://erpnext.com/kb/customize/field-types) to learn more about types of field you can set for your Custom Field. There are various types of Field like Data, Date, Link, Select, Text and so on. Select Field Type for the Custom Field.
![Custom Field Type]({{docs_base_url}}/assets/old_images/erpnext/custom-field-type.png) <img alt="Select Document Type" class="screenshot" src="{{docs_base_url}}/assets/img/customize/custom-field-4.png">
Click [here]({{docs_base_url}}/user/manual/en/customize-erpnext/articles/field-types.html) to learn more about types of field you can set for your Custom Field.
####Set Option ####Set Option
If you are creating a Link field, then Doctype name with which this field will be linked to will be entered in the Option field. Click [here](https://erpnext.com/kb/customize/creating-custom-link-field) to learn more about creating custom link field. Based on the Field Type, value will be entered in the Options field.
![Custom Field Link]({{docs_base_url}}/assets/old_images/erpnext/custom-field-link.png) If you are creating a Link field, then in the Options, enter Doctype name with which this field will be linked. Click [here]({{docs_base_url}}/user/manual/en/customize-erpnext/articles/creating-custom-link-field.html) to learn more about creating custom link field.
If field type is set as Select (drop down field), then all he possible result for this field should be listed in the Options field. Each possible result should be separate by row. If field type is set as Select (drop down field), then all he possible result for this field should be listed in the Options field. Each possible result should be separate by row.
![Custom Field Option]({{docs_base_url}}/assets/old_images/erpnext/custom-field-option.png) <img alt="Select Document Type" class="screenshot" src="{{docs_base_url}}/assets/img/customize/custom-field-5.png">
For other field types, like Data, Date, Currency etc., Opton field will be left blank. For other field types like Data, Date, Currency, Option field will be left blank.
####Set More Properties ####Set More Properties
You can set properties as: You can set properties as:
1. Mandatory: Should this field be mandatory or non-mandatory. 1. Mandatory: If checked, entering data in the custom field will be mandatory.
1. Print Hide: Should this field be visible in the print format or no. 1. Print Hide: If checked, this field will be hidden from the Standard Print Format. To make field visible in the Standard Print Format, uncheck this field.
1. Field Description: It will be short field description which will appear just below that field. 1. Field Description: It will be short field description which will appear just below that field.
1. Default Value: Value entered in this field will be auto-updated in this field. 1. Default Value: Value entered in this field will be auto-set in the Custom Field.
1. Read Only: Checking this option will make custom field non-editable. 1. Read Only: Checking this option will make custom field non-editable.
1. Allow on Submit: Checking this option will allow editing value in the field when in submitted transaction. 1. Allow on Submit: Checking this option will allow editing value in the field when in submitted transaction.
![Custom Field Properties]({{docs_base_url}}/assets/old_images/erpnext/custom-field-properties.png) ####Update Customize Form
After inserting required details for the Custom Field, Update Customize Form. On update, Custom Field will be inserting in the form, Employee master in this case. Before checking Employee form, reload your ERPNext account. After reload, check Employee form to see Custom Field in a form.
<img alt="Select Document Type" class="screenshot" src="{{docs_base_url}}/assets/img/customize/custom-field-6.png">
####Deleting Custom Field ####Deleting Custom Field
Given a permission, user will be able to delete Custom Fields. Incase, it was deleted by default, if you add another Custom Field with same name. Then you shall see new field auto-mapped with old-deleted Custom Field. Given a permission, user will be able to delete Custom Fields. Incase Custom Field is deleted by mistake, if you add another Custom Field with same name. Then you shall see new field auto-mapped with old-deleted Custom Field.
{next} {next}

View File

@ -18,8 +18,5 @@ Then in the Sales Invoice Custom Script, add this line:
cur_frm.add_fetch('customer','vat_id','vat_id') cur_frm.add_fetch('customer','vat_id','vat_id')
* * *
See: [How to create a custom script]({{docs_base_url}}/user/manual/en/customize-erpnext/custom-scripts.html)
{next} {next}

View File

@ -2,9 +2,9 @@ If you wish to change any ERPNext form formats, you can do so by using Custom
Scripts. For example, if you wish to add a submit button after saving, to a Scripts. For example, if you wish to add a submit button after saving, to a
Lead form, you can do so by creating your own script. Lead form, you can do so by creating your own script.
> Setup > Customization > Custom Script `Setup > Customization > Custom Script`
![Custom Script]({{docs_base_url}}/assets/old_images/erpnext/custom-script.png) <img alt="Custom Script" class="screenshot" src="{{docs_base_url}}/assets/img/customize/custom-script-1.png">
### Topics ### Topics

View File

@ -1,52 +1,61 @@
<!--markdown--> <!--markdown-->
Before we venture to learn form customization tool, click [here](https://kb.frappe.io/kb/customization/form-architecture) to understand the architecture of forms in ERPNext. It shall help you in using Customize Form tool more efficiently. Before we venture to learn form customization tool, click [here](https://frappe.github.io/frappe/user/tutorial/doctypes.html) to understand the architecture of forms in ERPNext. It shall help you in using Customize Form tool more efficiently.
Customize Form is the tool which allows user to customize the property of standard fields as per the requirement. Let's assume we need to set Project Name field as mandatory in the Sales Order form. Following are the steps which shall be followed to achieve this. Customize Form is the tool which allows user to customize property of the standard fields, and insert [custom fields]({{docs_base_url}}/user/manual/en/customize-erpnext/custom-field.html) as per the requirement. Let's assume we need to set Project Name field as a mandatory field in the Sales Order form. Following are the steps which shall be followed to achieve this.
####Step 1: Go to Customize Form ####Step 1: Go to Customize Form
You can go to Customize Form from: Go to Customize Form from:
> Setup >> Customize >> Customize Form `Setup >> Customize >> Customize Form`
System Manager will find Customize Form option in the Sales Order list (or any other form for that matter) view as well. You can also reach the Customize Form tool from the List Views.
![Customize Form List View]({{docs_base_url}}/assets/old_images/erpnext/customize-form-list-view.png) <img alt="Customize Form List" class="screenshot" src="{{docs_base_url}}/assets/img/customize/customize-form-from-list-view.gif">
####Step 2: Select Docytpe/Document ####Step 2: Select Document Type
You should select Docytpe/Document which has field-to-be-customized located in it. If navigate from the list view, Document Type will be automatically set in the Customize Form.
![Customize Form Document]({{docs_base_url}}/assets/old_images/erpnext/customize-form-document.png) If you reach customize form from the Setup module, or from awesome bar, then you will have to manually select Document Type in which customization needs to be made.
####Step 3:Edit Property <img alt="Customize Form select doctype" class="screenshot" src="{{docs_base_url}}/assets/img/customize/customize-form-select-doctype.png">
On selecting Doctype/table, you will have all the fields of the table updated as rows in the Customize Form table. You should drill down to field you need to work on, Project Name in this case. ####Step 3: Edit Property
On clicking Project Name row, fields to set various property for this field will be shown. To Customize the mandatory property for a field, there is a field called "Mandatory". Checking this field will set Project Name field as mandatory in the Quotation form. On selecting Document Type, all the fields of the Document Type will updated as rows in the Customize Form.
![Customize Form Mandatory]({{docs_base_url}}/assets/old_images/erpnext/customize-form-mandatory.png) To customized Project field, click on the respective row, and check "Mandatory". With this, Project field will become mandatory in the Sales Order.
Like this, you can customize following properties of the field. <img alt="Customize Form select doctype" class="screenshot" src="{{docs_base_url}}/assets/img/customize/customize-form-edit-property.gif">
* Change field types (for e.g. you want to increase the number of decimal places, you can convert come fields from Float to Currency). Like setting setting field Mandatory, following are the other customization options in the Customize Form tool.
* Change labels to suit your industry / language.
* Make certain fields mandatory. * Change [Field Type]({{docs_base_url}}/user/manual/en/customize-erpnext/articles/field-types.html).
* Hide certain fields. * Edit Field Labels to suit your industry/language.
* Change layout (sequence of fields). To do this, select a field in the grid and click on“Up” or “Down” in the grid toolbar. * Set field precision for the Currency field.
* Add / edit “Select” Options. (for example, you can add more sources in Leads etc). * To hide field, check Hidden.
* Customize Options for the Select field.
####Step 4: Update ####Step 4: Update
![Customize Form Update]({{docs_base_url}}/assets/old_images/erpnext/customize-form-update.png) To save your customizations, Update Customize Form.
Before checking Sales Order form, you should clear cache and refresh browser tab for customization to take effect. To have customizations take effect, reload your ERPNext account once.
For Customize Form, you can also allow attachments, set max number of attachments and set the default Print Format. ####Other Customizations
From Customize Form, you can also do following customizations:
* Max Attachment Limit: Define [maximum no. of files]({{docs_base_url}}/user/manual/en/customize-erpnext/articles/increase-max-attachments.html) which can attached on a document.
* Default Print Format: For one document type, you can have multiple print formats. In the Customize Form, you can also set default Print Format for a document.
* Set [Title Field]({{docs_base_url}}/user/manual/en/customize-erpnext/document-title.html)
* Sort Field and Sort Order: Define field based on which documents in the list view will be sorted.
>Note: Though we want you to do everything you can to customize your ERP based on your business needs, we recommend that you do not make “wild” changes to the forms. This is because, these changes may affect certain operations and may mess up your forms. Make small changes and see its effect before doing some more. >Note: Though we want you to do everything you can to customize your ERP based on your business needs, we recommend that you do not make “wild” changes to the forms. This is because, these changes may affect certain operations and may mess up your forms. Make small changes and see its effect before doing some more.
Following are the properties which you can customize for a specific field from Customize Form. Following are the properties which you can customize for a specific field from Customize Form.
<style> <style>
td { td {
padding:5px 10px 5px 5px; padding:5px 10px 5px 5px;
@ -67,7 +76,11 @@ table, th, td {
</tr> </tr>
<tr> <tr>
<td>Print hide</td> <td>Print hide</td>
<td>Checking it will hide field from Standard print format.</td> <td>Checking it will hide field from the Standard print format.</td>
</tr>
<tr>
<td>Unique</td>
<td>For a unique field, same value cannot repeat in another document.</td>
</tr> </tr>
<tr> <tr>
<td>Hidden</td> <td>Hidden</td>
@ -79,7 +92,7 @@ table, th, td {
</tr> </tr>
<tr> <tr>
<td>Field Type</td> <td>Field Type</td>
<td>Click <a href="https://erpnext.com/kb/customize/field-types">here</a> to learn about of fields types.</td> <td>Click <a href="{{docs_base_url}}/user/manual/en/customize-erpnext/articles/field-types.html">here</a> to learn about of fields types.</td>
</tr> </tr>
<tr> <tr>
<td>Options</td> <td>Options</td>

View File

@ -12,7 +12,7 @@ To edit a default title, go to
1. Setup > Customize > Customize Form 1. Setup > Customize > Customize Form
2. Select your transaction 2. Select your transaction
3. Edit the **Default** field in your form 3. Edit the **Default** field in your forms
#### Defining Titles #### Defining Titles
@ -31,3 +31,5 @@ If your title is generated as a default title, it can be edited by the user by c
src="{{docs_base_url}}/assets/img/customize/editable-title.gif"> src="{{docs_base_url}}/assets/img/customize/editable-title.gif">
If you want a fixed title, you can set the rule in the **Options** property. In this way, the title will be automatically updated everytime the document is updated. If you want a fixed title, you can set the rule in the **Options** property. In this way, the title will be automatically updated everytime the document is updated.
{next}

View File

@ -1,16 +1,11 @@
### Hiding Unused Features As you have seen from this manual that ERPNext contains tons of features which you may not use. We have observed that most users start with using 20% of the features, though a different 20%. To hide fields belonging to features you
As you have seen from this manual that ERPNext contains tons of features which
you may not use. We have observed that most users start with using 20% of the
features, though a different 20%. To hide fields belonging to features you
dont require, go to: dont require, go to:
> Setup > Tools > Hide/Unhide Features `Setup > Customize > Features Setup`
![Hide Features]({{docs_base_url}}/assets/old_images/erpnext/hide-features.png) <img alt="Hide Features" class="screenshot" src="{{docs_base_url}}/assets/img/customize/feature-setup.png">
Check / uncheck the features you want to use and refresh your page for the Check the features you want to use. The features which are not checked, relevant fields will get hidden from the forms.
changes to take effect.
* * * * * *
@ -18,13 +13,12 @@ changes to take effect.
To hide modules (icons) from the home page, go to: To hide modules (icons) from the home page, go to:
Setup > Tools> Modules Setup `Setup > Permissions > Show / Hide Modules`
![Hide/Unhide Modules]({{docs_base_url}}/assets/old_images/erpnext/hide-module.png) <img alt="Hide Features" class="screenshot" src="{{docs_base_url}}/assets/img/customize/show-hide-modules.png">
> Note: Modules are automatically hidden for users that have no permissions on Click [here]({{docs_base_url}}/user/manual/en/customize-erpnext/articles/module-visibility.html) to learn about other features from where icons from the desktop can be hidden.
the documents within that module. For example, if a user has no permissions on
Purchase Order, Purchase Request, Supplier, the “Buying” module will > Note: Modules are automatically hidden for users that have no permissions on the documents within that module. For example, if a User has no permissions on Purchase Order, Purchase Request, Supplier, the “Buying” module will automatically hidden for that User.
automatically be hidden.
{next} {next}

View File

@ -1,8 +1,8 @@
custom-field custom-field
custom-doctype
custom-scripts
customize-form customize-form
custom-doctype
document-title document-title
hiding-modules-and-features hiding-modules-and-features
print-format print-format
custom-scripts
articles articles

View File

@ -16,9 +16,9 @@ upcoming release.
To create your own versions, open an existing template from: To create your own versions, open an existing template from:
> Setup > Printing > Print Formats `Setup > Printing > Print Formats`
![Print Format]({{docs_base_url}}/assets/old_images/erpnext/customize/print-format.png) <img alt="Print Format" class="screenshot" src="{{docs_base_url}}/assets/img/customize/print-format.png">
Select the type of Print Format you want to edit and click on the “Copy” Select the type of Print Format you want to edit and click on the “Copy”
button on the right column. A new Print Format will open up with “Is Standard” button on the right column. A new Print Format will open up with “Is Standard”
@ -43,9 +43,9 @@ will look incomplete (inconsistent) when you send them by mail.
To edit / update your print and PDF settings, go to: To edit / update your print and PDF settings, go to:
> Setup > Printing and Branding > Print Settings `Setup > Printing and Branding > Print Settings`
![Print Format]({{docs_base_url}}/assets/old_images/erpnext/customize/print-settings.png) <img alt="Print Format" class="screenshot" src="{{docs_base_url}}/assets/img/customize/print-settings.png">
#### Example #### Example

View File

@ -7,7 +7,7 @@ app_publisher = "Frappe Technologies Pvt. Ltd."
app_description = """ERP made simple""" app_description = """ERP made simple"""
app_icon = "icon-th" app_icon = "icon-th"
app_color = "#e74c3c" app_color = "#e74c3c"
app_version = "6.25.5" app_version = "6.26.0"
app_email = "info@erpnext.com" app_email = "info@erpnext.com"
app_license = "GNU General Public License (v3)" app_license = "GNU General Public License (v3)"
source_link = "https://github.com/frappe/erpnext" source_link = "https://github.com/frappe/erpnext"

View File

@ -17,6 +17,7 @@
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"label": "", "label": "",
@ -42,6 +43,7 @@
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"label": "Appraisal Template", "label": "Appraisal Template",
@ -70,6 +72,7 @@
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 1, "in_filter": 1,
"in_list_view": 0, "in_list_view": 0,
"label": "For Employee", "label": "For Employee",
@ -97,6 +100,7 @@
"fieldtype": "Data", "fieldtype": "Data",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 1, "in_filter": 1,
"in_list_view": 0, "in_list_view": 0,
"label": "For Employee Name", "label": "For Employee Name",
@ -123,6 +127,7 @@
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"length": 0, "length": 0,
@ -149,6 +154,7 @@
"fieldtype": "Select", "fieldtype": "Select",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 1, "in_filter": 1,
"in_list_view": 0, "in_list_view": 0,
"label": "Status", "label": "Status",
@ -176,6 +182,7 @@
"fieldtype": "Date", "fieldtype": "Date",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 1, "in_filter": 1,
"in_list_view": 1, "in_list_view": 1,
"label": "Start Date", "label": "Start Date",
@ -202,6 +209,7 @@
"fieldtype": "Date", "fieldtype": "Date",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 1, "in_filter": 1,
"in_list_view": 0, "in_list_view": 0,
"label": "End Date", "label": "End Date",
@ -228,6 +236,7 @@
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"label": "Goals", "label": "Goals",
@ -253,6 +262,7 @@
"fieldtype": "Table", "fieldtype": "Table",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"label": "Goals", "label": "Goals",
@ -279,6 +289,7 @@
"fieldtype": "Button", "fieldtype": "Button",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"label": "Calculate Total Score", "label": "Calculate Total Score",
@ -304,6 +315,7 @@
"fieldtype": "Float", "fieldtype": "Float",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 1, "in_list_view": 1,
"label": "Total Score (Out of 5)", "label": "Total Score (Out of 5)",
@ -330,6 +342,7 @@
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"length": 0, "length": 0,
@ -353,6 +366,7 @@
"fieldtype": "Text", "fieldtype": "Text",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"label": "Remarks", "label": "Remarks",
@ -377,6 +391,7 @@
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"label": "", "label": "",
@ -400,6 +415,7 @@
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 1, "in_filter": 1,
"in_list_view": 0, "in_list_view": 0,
"label": "Company", "label": "Company",
@ -426,6 +442,7 @@
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"length": 0, "length": 0,
@ -441,32 +458,6 @@
"set_only_once": 0, "set_only_once": 0,
"unique": 0 "unique": 0
}, },
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "fiscal_year",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 1,
"in_list_view": 0,
"label": "Fiscal Year",
"length": 0,
"no_copy": 0,
"oldfieldname": "fiscal_year",
"oldfieldtype": "Select",
"options": "Fiscal Year",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{ {
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
@ -475,6 +466,7 @@
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 1, "hidden": 1,
"ignore_user_permissions": 1, "ignore_user_permissions": 1,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"label": "Amended From", "label": "Amended From",
@ -505,7 +497,7 @@
"issingle": 0, "issingle": 0,
"istable": 0, "istable": 0,
"max_attachments": 0, "max_attachments": 0,
"modified": "2016-02-03 01:17:20.561443", "modified": "2016-03-04 02:08:11.258389",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "HR", "module": "HR",
"name": "Appraisal", "name": "Appraisal",

View File

@ -17,6 +17,7 @@
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"label": "", "label": "",
@ -42,6 +43,7 @@
"fieldtype": "Select", "fieldtype": "Select",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"label": "Series", "label": "Series",
@ -68,6 +70,7 @@
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 1, "in_filter": 1,
"in_list_view": 0, "in_list_view": 0,
"label": "Employee", "label": "Employee",
@ -94,6 +97,7 @@
"fieldtype": "Data", "fieldtype": "Data",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"label": "Employee Name", "label": "Employee Name",
@ -120,6 +124,7 @@
"fieldtype": "Select", "fieldtype": "Select",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 1, "in_filter": 1,
"in_list_view": 0, "in_list_view": 0,
"label": "Status", "label": "Status",
@ -146,6 +151,7 @@
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 1, "hidden": 1,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"label": "Leave Type", "label": "Leave Type",
@ -172,6 +178,7 @@
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"length": 0, "length": 0,
@ -196,6 +203,7 @@
"fieldtype": "Date", "fieldtype": "Date",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 1, "in_filter": 1,
"in_list_view": 1, "in_list_view": 1,
"label": "Attendance Date", "label": "Attendance Date",
@ -213,32 +221,6 @@
"set_only_once": 0, "set_only_once": 0,
"unique": 0 "unique": 0
}, },
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "fiscal_year",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 1,
"in_list_view": 0,
"label": "Fiscal Year",
"length": 0,
"no_copy": 0,
"oldfieldname": "fiscal_year",
"oldfieldtype": "Select",
"options": "Fiscal Year",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{ {
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
@ -247,6 +229,7 @@
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 1, "in_filter": 1,
"in_list_view": 0, "in_list_view": 0,
"label": "Company", "label": "Company",
@ -273,6 +256,7 @@
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 1, "ignore_user_permissions": 1,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"label": "Amended From", "label": "Amended From",
@ -300,7 +284,7 @@
"issingle": 0, "issingle": 0,
"istable": 0, "istable": 0,
"max_attachments": 0, "max_attachments": 0,
"modified": "2016-01-25 15:36:36.252173", "modified": "2016-03-04 01:18:30.089630",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "HR", "module": "HR",
"name": "Attendance", "name": "Attendance",

View File

@ -41,9 +41,7 @@ class Attendance(Document):
def validate(self): def validate(self):
from erpnext.controllers.status_updater import validate_status from erpnext.controllers.status_updater import validate_status
from erpnext.accounts.utils import validate_fiscal_year
validate_status(self.status, ["Present", "Absent", "Half Day"]) validate_status(self.status, ["Present", "Absent", "Half Day"])
validate_fiscal_year(self.att_date, self.fiscal_year, _("Attendance Date"), self)
self.validate_att_date() self.validate_att_date()
self.validate_duplicate_record() self.validate_duplicate_record()
self.check_leave_record() self.check_leave_record()

View File

@ -5,7 +5,6 @@
"employee": "_T-Employee-0001", "employee": "_T-Employee-0001",
"status": "Present", "status": "Present",
"att_date": "2014-02-01", "att_date": "2014-02-01",
"fiscal_year": "_Test Fiscal Year 2014",
"company": "_Test Company" "company": "_Test Company"
} }
] ]

View File

@ -227,3 +227,16 @@ def get_employees_who_are_born_today():
from tabEmployee where day(date_of_birth) = day(%(date)s) from tabEmployee where day(date_of_birth) = day(%(date)s)
and month(date_of_birth) = month(%(date)s) and month(date_of_birth) = month(%(date)s)
and status = 'Active'""", {"date": today()}, as_dict=True) and status = 'Active'""", {"date": today()}, as_dict=True)
def get_holiday_list_for_employee(employee, raise_exception=True):
employee = frappe.db.get_value("Employee", employee, ["holiday_list", "company"], as_dict=True)
holiday_list = employee.holiday_list
if not holiday_list:
holiday_list = frappe.db.get_value("Company", employee.company, "default_holiday_list")
if not holiday_list and raise_exception:
frappe.throw(_("Please set a Holiday List for either the Employee or the Company"))
return holiday_list

View File

@ -4,7 +4,6 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe import frappe
import copy
import json import json
from frappe.model.document import Document from frappe.model.document import Document

View File

@ -18,6 +18,7 @@
"fieldtype": "Select", "fieldtype": "Select",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"label": "Series", "label": "Series",
@ -45,6 +46,7 @@
"fieldtype": "Select", "fieldtype": "Select",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 1, "in_filter": 1,
"in_list_view": 0, "in_list_view": 0,
"label": "Approval Status", "label": "Approval Status",
@ -72,6 +74,7 @@
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"label": "Approver", "label": "Approver",
@ -99,6 +102,7 @@
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"length": 0, "length": 0,
@ -123,6 +127,7 @@
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 1, "in_list_view": 1,
"label": "Total Claimed Amount", "label": "Total Claimed Amount",
@ -150,6 +155,7 @@
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"label": "Total Sanctioned Amount", "label": "Total Sanctioned Amount",
@ -177,6 +183,7 @@
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"label": "", "label": "",
@ -201,6 +208,7 @@
"fieldtype": "Table", "fieldtype": "Table",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"label": "Expenses", "label": "Expenses",
@ -227,6 +235,7 @@
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"length": 0, "length": 0,
@ -251,6 +260,7 @@
"fieldtype": "Date", "fieldtype": "Date",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 1, "in_filter": 1,
"in_list_view": 0, "in_list_view": 0,
"label": "Posting Date", "label": "Posting Date",
@ -276,6 +286,7 @@
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 1, "in_filter": 1,
"in_list_view": 0, "in_list_view": 0,
"label": "From Employee", "label": "From Employee",
@ -302,6 +313,7 @@
"fieldtype": "Data", "fieldtype": "Data",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 1, "in_filter": 1,
"in_list_view": 0, "in_list_view": 0,
"label": "Employee Name", "label": "Employee Name",
@ -328,6 +340,7 @@
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 1, "in_filter": 1,
"in_list_view": 0, "in_list_view": 0,
"label": "Company", "label": "Company",
@ -346,32 +359,6 @@
"set_only_once": 0, "set_only_once": 0,
"unique": 0 "unique": 0
}, },
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "fiscal_year",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 1,
"in_list_view": 0,
"label": "Fiscal Year",
"length": 0,
"no_copy": 0,
"oldfieldname": "fiscal_year",
"oldfieldtype": "Select",
"options": "Fiscal Year",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{ {
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
@ -380,6 +367,7 @@
"fieldtype": "Column Break", "fieldtype": "Column Break",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"length": 0, "length": 0,
@ -402,6 +390,7 @@
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"label": "Total Amount Reimbursed", "label": "Total Amount Reimbursed",
@ -427,6 +416,7 @@
"fieldtype": "Small Text", "fieldtype": "Small Text",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"label": "Remark", "label": "Remark",
@ -452,6 +442,7 @@
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"label": "Project", "label": "Project",
@ -477,6 +468,7 @@
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"label": "Task", "label": "Task",
@ -503,6 +495,7 @@
"fieldtype": "Data", "fieldtype": "Data",
"hidden": 1, "hidden": 1,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"label": "Title", "label": "Title",
@ -527,6 +520,7 @@
"fieldtype": "Data", "fieldtype": "Data",
"hidden": 1, "hidden": 1,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"label": "Employees Email Id", "label": "Employees Email Id",
@ -552,6 +546,7 @@
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 1, "ignore_user_permissions": 1,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"label": "Amended From", "label": "Amended From",
@ -583,7 +578,7 @@
"istable": 0, "istable": 0,
"max_attachments": 0, "max_attachments": 0,
"menu_index": 0, "menu_index": 0,
"modified": "2016-02-03 01:17:32.673216", "modified": "2016-03-03 04:00:28.190351",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "HR", "module": "HR",
"name": "Expense Claim", "name": "Expense Claim",

View File

@ -7,7 +7,6 @@ from frappe import _
from frappe.utils import get_fullname, flt from frappe.utils import get_fullname, flt
from frappe.model.document import Document from frappe.model.document import Document
from erpnext.hr.utils import set_employee_name from erpnext.hr.utils import set_employee_name
from erpnext.accounts.utils import validate_fiscal_year
class InvalidExpenseApproverError(frappe.ValidationError): pass class InvalidExpenseApproverError(frappe.ValidationError): pass
@ -17,7 +16,6 @@ class ExpenseClaim(Document):
self.employee_name, self.total_claimed_amount) self.employee_name, self.total_claimed_amount)
def validate(self): def validate(self):
validate_fiscal_year(self.posting_date, self.fiscal_year, _("Posting Date"), self)
self.validate_sanctioned_amount() self.validate_sanctioned_amount()
self.validate_expense_approver() self.validate_expense_approver()
self.calculate_total_amount() self.calculate_total_amount()
@ -67,5 +65,6 @@ def get_expense_approver(doctype, txt, searchfield, start, page_len, filters):
return frappe.db.sql(""" return frappe.db.sql("""
select u.name, concat(u.first_name, ' ', u.last_name) select u.name, concat(u.first_name, ' ', u.last_name)
from tabUser u, tabUserRole r from tabUser u, tabUserRole r
where u.name = r.parent and r.role = 'Expense Approver' and u.name like %s where u.name = r.parent and r.role = 'Expense Approver'
and u.enabled = 1 and u.name like %s
""", ("%" + txt + "%")) """, ("%" + txt + "%"))

View File

@ -6,32 +6,8 @@
"custom": 0, "custom": 0,
"docstatus": 0, "docstatus": 0,
"doctype": "DocType", "doctype": "DocType",
"document_type": "Setup",
"fields": [ "fields": [
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "description",
"fieldtype": "Text Editor",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Description",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"print_width": "300px",
"read_only": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"unique": 0,
"width": "300px"
},
{ {
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
@ -40,6 +16,7 @@
"fieldtype": "Date", "fieldtype": "Date",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 1, "in_list_view": 1,
"label": "Date", "label": "Date",
@ -56,6 +33,32 @@
"search_index": 0, "search_index": 0,
"set_only_once": 0, "set_only_once": 0,
"unique": 0 "unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "description",
"fieldtype": "Text Editor",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Description",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"print_width": "300px",
"read_only": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"unique": 0,
"width": "300px"
} }
], ],
"hide_heading": 0, "hide_heading": 0,
@ -67,7 +70,7 @@
"issingle": 0, "issingle": 0,
"istable": 1, "istable": 1,
"max_attachments": 0, "max_attachments": 0,
"modified": "2016-01-27 11:52:46.864792", "modified": "2016-03-11 06:39:10.913467",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "HR", "module": "HR",
"name": "Holiday", "name": "Holiday",

View File

@ -0,0 +1,14 @@
// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
// For license information, please see license.txt
frappe.ui.form.on('Holiday List', {
refresh: function(frm) {
},
from_date: function(frm) {
if (frm.doc.from_date && !frm.doc.to_date) {
var a_year_from_start = frappe.datetime.add_months(frm.doc.from_date, 12);
frm.set_value("to_date", frappe.datetime.add_days(a_year_from_start, -1));
}
}
});

View File

@ -17,6 +17,7 @@
"fieldtype": "Data", "fieldtype": "Data",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 1, "in_list_view": 1,
"label": "Holiday List Name", "label": "Holiday List Name",
@ -26,6 +27,7 @@
"oldfieldtype": "Data", "oldfieldtype": "Data",
"permlevel": 0, "permlevel": 0,
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 1, "reqd": 1,
@ -37,20 +39,23 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"fieldname": "is_default", "fieldname": "from_date",
"fieldtype": "Check", "fieldtype": "Date",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 1, "in_list_view": 0,
"label": "Default", "label": "From Date",
"length": 0, "length": 0,
"no_copy": 0, "no_copy": 0,
"permlevel": 0, "permlevel": 0,
"precision": "",
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 1,
"search_index": 0, "search_index": 0,
"set_only_once": 0, "set_only_once": 0,
"unique": 0 "unique": 0
@ -59,20 +64,20 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"fieldname": "fiscal_year", "fieldname": "to_date",
"fieldtype": "Link", "fieldtype": "Date",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"in_filter": 1, "ignore_xss_filter": 0,
"in_list_view": 1, "in_filter": 0,
"label": "Fiscal Year", "in_list_view": 0,
"label": "To Date",
"length": 0, "length": 0,
"no_copy": 0, "no_copy": 0,
"oldfieldname": "fiscal_year",
"oldfieldtype": "Link",
"options": "Fiscal Year",
"permlevel": 0, "permlevel": 0,
"precision": "",
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 1, "reqd": 1,
@ -88,6 +93,7 @@
"fieldtype": "Select", "fieldtype": "Select",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 1, "in_list_view": 1,
"label": "Weekly Off", "label": "Weekly Off",
@ -96,6 +102,7 @@
"options": "\nSunday\nMonday\nTuesday\nWednesday\nThursday\nFriday\nSaturday", "options": "\nSunday\nMonday\nTuesday\nWednesday\nThursday\nFriday\nSaturday",
"permlevel": 0, "permlevel": 0,
"print_hide": 1, "print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"report_hide": 1, "report_hide": 1,
"reqd": 0, "reqd": 0,
@ -111,6 +118,7 @@
"fieldtype": "Button", "fieldtype": "Button",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"label": "Get Weekly Off Dates", "label": "Get Weekly Off Dates",
@ -119,6 +127,7 @@
"options": "get_weekly_off_dates", "options": "get_weekly_off_dates",
"permlevel": 0, "permlevel": 0,
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
@ -134,6 +143,7 @@
"fieldtype": "Table", "fieldtype": "Table",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"label": "Holidays", "label": "Holidays",
@ -144,6 +154,7 @@
"options": "Holiday", "options": "Holiday",
"permlevel": 0, "permlevel": 0,
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
@ -159,6 +170,7 @@
"fieldtype": "Button", "fieldtype": "Button",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"label": "Clear Table", "label": "Clear Table",
@ -167,6 +179,7 @@
"options": "clear_table", "options": "clear_table",
"permlevel": 0, "permlevel": 0,
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
@ -185,7 +198,7 @@
"issingle": 0, "issingle": 0,
"istable": 0, "istable": 0,
"max_attachments": 0, "max_attachments": 0,
"modified": "2015-11-16 06:29:47.519087", "modified": "2016-03-11 05:26:24.819829",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "HR", "module": "HR",
"name": "Holiday List", "name": "Holiday List",

View File

@ -3,22 +3,20 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe import frappe
import json
from frappe.utils import cint from frappe.utils import cint, getdate, formatdate
from frappe.model.naming import make_autoname
from frappe import throw, _ from frappe import throw, _
from frappe.model.document import Document from frappe.model.document import Document
class OverlapError(frappe.ValidationError): pass
class HolidayList(Document): class HolidayList(Document):
def validate(self): def validate(self):
self.update_default_holiday_list() self.validate_days()
def get_weekly_off_dates(self): def get_weekly_off_dates(self):
self.validate_values() self.validate_values()
self.validate_days() date_list = self.get_weekly_off_date_list(self.from_date, self.to_date)
yr_start_date, yr_end_date = get_fy_start_end_dates(self.fiscal_year)
date_list = self.get_weekly_off_date_list(yr_start_date, yr_end_date)
last_idx = max([cint(d.idx) for d in self.get("holidays")] or [0,]) last_idx = max([cint(d.idx) for d in self.get("holidays")] or [0,])
for i, d in enumerate(date_list): for i, d in enumerate(date_list):
ch = self.append('holidays', {}) ch = self.append('holidays', {})
@ -27,29 +25,34 @@ class HolidayList(Document):
ch.idx = last_idx + i + 1 ch.idx = last_idx + i + 1
def validate_values(self): def validate_values(self):
if not self.fiscal_year:
throw(_("Please select Fiscal Year"))
if not self.weekly_off: if not self.weekly_off:
throw(_("Please select weekly off day")) throw(_("Please select weekly off day"))
def validate_days(self):
for day in self.get("holidays"):
if (self.weekly_off or "").upper() == (day.description or "").upper():
frappe.throw("Records already exist for mentioned weekly off")
def get_weekly_off_date_list(self, year_start_date, year_end_date): def validate_days(self):
from frappe.utils import getdate if self.from_date > self.to_date:
year_start_date, year_end_date = getdate(year_start_date), getdate(year_end_date) throw(_("To Date cannot be before From Date"))
for day in self.get("holidays"):
if not (self.from_date <= day.holiday_date <= self.to_date):
frappe.throw(_("The holiday on {0} is not between From Date and To Date").format(formatdate(day.holiday_date)))
def get_weekly_off_date_list(self, start_date, end_date):
start_date, end_date = getdate(start_date), getdate(end_date)
from dateutil import relativedelta from dateutil import relativedelta
from datetime import timedelta from datetime import timedelta
import calendar import calendar
date_list = [] date_list = []
existing_date_list = []
weekday = getattr(calendar, (self.weekly_off).upper()) weekday = getattr(calendar, (self.weekly_off).upper())
reference_date = year_start_date + relativedelta.relativedelta(weekday=weekday) reference_date = start_date + relativedelta.relativedelta(weekday=weekday)
while reference_date <= year_end_date: existing_date_list = [getdate(holiday.holiday_date) for holiday in self.get("holidays")]
while reference_date <= end_date:
if reference_date not in existing_date_list:
date_list.append(reference_date) date_list.append(reference_date)
reference_date += timedelta(days=7) reference_date += timedelta(days=7)
@ -58,42 +61,35 @@ class HolidayList(Document):
def clear_table(self): def clear_table(self):
self.set('holidays', []) self.set('holidays', [])
def update_default_holiday_list(self):
frappe.db.sql("""update `tabHoliday List` set is_default = 0
where is_default = 1 and fiscal_year = %s""", (self.fiscal_year,))
@frappe.whitelist() @frappe.whitelist()
def get_events(start, end, filters=None): def get_events(start, end, filters=None):
import json
"""Returns events for Gantt / Calendar view rendering. """Returns events for Gantt / Calendar view rendering.
:param start: Start date-time. :param start: Start date-time.
:param end: End date-time. :param end: End date-time.
:param filters: Filters (JSON). :param filters: Filters (JSON).
""" """
from frappe.desk.calendar import get_event_conditions condition = ''
conditions = get_event_conditions("Holiday List", filters) values = {
"start_date": getdate(start),
"end_date": getdate(end)
}
fiscal_year = None
if filters: if filters:
fiscal_year = json.loads(filters).get("fiscal_year") if isinstance(filters, basestring):
filters = json.loads(filters)
if not fiscal_year: if filters.get('holiday_list'):
fiscal_year = frappe.db.get_value("Global Defaults", None, "current_fiscal_year") condition = 'and hlist.name=%(holiday_list)s'
values['holiday_list'] = filters['holiday_list']
yr_start_date, yr_end_date = get_fy_start_end_dates(fiscal_year) data = frappe.db.sql("""select hlist.name, h.holiday_date, h.description
from `tabHoliday List` hlist, tabHoliday h
data = frappe.db.sql("""select hl.name, hld.holiday_date, hld.description where h.parent = hlist.name
from `tabHoliday List` hl, tabHoliday hld and h.holiday_date is not null
where hld.parent = hl.name and h.holiday_date >= %(start_date)s
and (ifnull(hld.holiday_date, "0000-00-00") != "0000-00-00" and h.holiday_date <= %(end_date)s
and hld.holiday_date between %(start)s and %(end)s) {condition}""".format(condition=condition),
{conditions}""".format(conditions=conditions), { values, as_dict=True, update={"allDay": 1})
"start": yr_start_date,
"end": yr_end_date
}, as_dict=True, update={"allDay": 1})
return data return data
def get_fy_start_end_dates(fiscal_year):
return frappe.db.get_value("Fiscal Year", fiscal_year, ["year_start_date", "year_end_date"])

View File

@ -9,14 +9,13 @@ frappe.views.calendar["Holiday List"] = {
"title": "description", "title": "description",
"allDay": "allDay" "allDay": "allDay"
}, },
get_events_method: "erpnext.hr.doctype.holiday_list.holiday_list.get_events",
filters: [ filters: [
{ {
"fieldtype": "Link", 'fieldtype': 'Link',
"fieldname": "fiscal_year", 'fieldname': 'holiday_list',
"options": "Fiscal Year", 'options': 'Holiday List',
"label": __("Fiscal Year"), 'label': __('Holiday List')
"default": frappe.defaults.get_user_default("fiscal_year")
} }
], ]
get_events_method: "erpnext.hr.doctype.holiday_list.holiday_list.get_events"
} }

View File

@ -1,7 +1,8 @@
[ [
{ {
"doctype": "Holiday List", "doctype": "Holiday List",
"fiscal_year": "_Test Fiscal Year 2013", "from_date": "2013-01-01",
"to_date":"2013-12-31",
"holidays": [ "holidays": [
{ {
"description": "New Year", "description": "New Year",
@ -16,7 +17,6 @@
"holiday_date": "2013-02-01" "holiday_date": "2013-02-01"
} }
], ],
"holiday_list_name": "_Test Holiday List", "holiday_list_name": "_Test Holiday List"
"is_default": 1
} }
] ]

View File

@ -8,6 +8,7 @@ from frappe.utils import cint, cstr, date_diff, flt, formatdate, getdate, get_li
comma_or, get_fullname comma_or, get_fullname
from erpnext.hr.utils import set_employee_name from erpnext.hr.utils import set_employee_name
from erpnext.hr.doctype.leave_block_list.leave_block_list import get_applicable_block_dates from erpnext.hr.doctype.leave_block_list.leave_block_list import get_applicable_block_dates
from erpnext.hr.doctype.employee.employee import get_holiday_list_for_employee
class LeaveDayBlockedError(frappe.ValidationError): pass class LeaveDayBlockedError(frappe.ValidationError): pass
@ -131,6 +132,7 @@ class LeaveApplication(Document):
def validate_leave_overlap(self): def validate_leave_overlap(self):
if not self.name: if not self.name:
# hack! if name is null, it could cause problems with !=
self.name = "New Leave Application" self.name = "New Leave Application"
for d in frappe.db.sql("""select name, leave_type, posting_date, from_date, to_date, total_leave_days for d in frappe.db.sql("""select name, leave_type, posting_date, from_date, to_date, total_leave_days
@ -421,7 +423,7 @@ def add_block_dates(events, start, end, employee, company):
cnt+=1 cnt+=1
def add_holidays(events, start, end, employee, company): def add_holidays(events, start, end, employee, company):
applicable_holiday_list = frappe.db.get_value("Employee", employee, "holiday_list") applicable_holiday_list = get_holiday_list_for_employee(employee, company)
if not applicable_holiday_list: if not applicable_holiday_list:
return return

View File

@ -15,7 +15,6 @@ _test_records = [
"company": "_Test Company", "company": "_Test Company",
"doctype": "Leave Application", "doctype": "Leave Application",
"employee": "_T-Employee-0001", "employee": "_T-Employee-0001",
"fiscal_year": "_Test Fiscal Year 2013",
"from_date": "2013-05-01", "from_date": "2013-05-01",
"leave_type": "_Test Leave Type", "leave_type": "_Test Leave Type",
"posting_date": "2013-01-02", "posting_date": "2013-01-02",
@ -25,7 +24,6 @@ _test_records = [
"company": "_Test Company", "company": "_Test Company",
"doctype": "Leave Application", "doctype": "Leave Application",
"employee": "_T-Employee-0002", "employee": "_T-Employee-0002",
"fiscal_year": "_Test Fiscal Year 2013",
"from_date": "2013-05-01", "from_date": "2013-05-01",
"leave_type": "_Test Leave Type", "leave_type": "_Test Leave Type",
"posting_date": "2013-01-02", "posting_date": "2013-01-02",
@ -35,7 +33,6 @@ _test_records = [
"company": "_Test Company", "company": "_Test Company",
"doctype": "Leave Application", "doctype": "Leave Application",
"employee": "_T-Employee-0001", "employee": "_T-Employee-0001",
"fiscal_year": "_Test Fiscal Year 2013",
"from_date": "2013-01-15", "from_date": "2013-01-15",
"leave_type": "_Test Leave Type LWP", "leave_type": "_Test Leave Type LWP",
"posting_date": "2013-01-02", "posting_date": "2013-01-02",

View File

@ -18,6 +18,7 @@
"fieldtype": "Data", "fieldtype": "Data",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 1, "in_list_view": 1,
"label": "Leave Block List Name", "label": "Leave Block List Name",
@ -25,29 +26,7 @@
"no_copy": 0, "no_copy": 0,
"permlevel": 0, "permlevel": 0,
"print_hide": 0, "print_hide": 0,
"read_only": 0, "print_hide_if_no_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "year",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Year",
"length": 0,
"no_copy": 0,
"options": "Fiscal Year",
"permlevel": 0,
"print_hide": 0,
"read_only": 0, "read_only": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 1, "reqd": 1,
@ -63,6 +42,7 @@
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 1, "in_list_view": 1,
"label": "Company", "label": "Company",
@ -71,6 +51,7 @@
"options": "Company", "options": "Company",
"permlevel": 0, "permlevel": 0,
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 1, "reqd": 1,
@ -87,6 +68,7 @@
"fieldtype": "Check", "fieldtype": "Check",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 1, "in_list_view": 1,
"label": "Applies to Company", "label": "Applies to Company",
@ -94,6 +76,7 @@
"no_copy": 0, "no_copy": 0,
"permlevel": 0, "permlevel": 0,
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
@ -110,6 +93,7 @@
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"label": "Block Days", "label": "Block Days",
@ -117,6 +101,7 @@
"no_copy": 0, "no_copy": 0,
"permlevel": 0, "permlevel": 0,
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
@ -132,6 +117,7 @@
"fieldtype": "Table", "fieldtype": "Table",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"label": "Leave Block List Dates", "label": "Leave Block List Dates",
@ -140,6 +126,7 @@
"options": "Leave Block List Date", "options": "Leave Block List Date",
"permlevel": 0, "permlevel": 0,
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
@ -156,6 +143,7 @@
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"label": "Allow Users", "label": "Allow Users",
@ -163,6 +151,7 @@
"no_copy": 0, "no_copy": 0,
"permlevel": 0, "permlevel": 0,
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
@ -178,6 +167,7 @@
"fieldtype": "Table", "fieldtype": "Table",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"label": "Leave Block List Allowed", "label": "Leave Block List Allowed",
@ -186,6 +176,7 @@
"options": "Leave Block List Allow", "options": "Leave Block List Allow",
"permlevel": 0, "permlevel": 0,
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
@ -204,7 +195,7 @@
"issingle": 0, "issingle": 0,
"istable": 0, "istable": 0,
"max_attachments": 0, "max_attachments": 0,
"modified": "2015-11-16 06:29:49.553862", "modified": "2016-03-07 00:48:25.784577",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "HR", "module": "HR",
"name": "Leave Block List", "name": "Leave Block List",
@ -232,5 +223,6 @@
} }
], ],
"read_only": 0, "read_only": 0,
"read_only_onload": 0 "read_only_onload": 0,
"sort_order": "ASC"
} }

View File

@ -5,7 +5,6 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe import frappe
from erpnext.accounts.utils import validate_fiscal_year
from frappe import _ from frappe import _
from frappe.model.document import Document from frappe.model.document import Document
@ -14,8 +13,6 @@ class LeaveBlockList(Document):
def validate(self): def validate(self):
dates = [] dates = []
for d in self.get("leave_block_list_dates"): for d in self.get("leave_block_list_dates"):
# validate fiscal year
validate_fiscal_year(d.block_date, self.year, _("Block Date"))
# date is not repeated # date is not repeated
if d.block_date in dates: if d.block_date in dates:

View File

@ -11,7 +11,7 @@ from frappe import msgprint, _
from erpnext.setup.utils import get_company_currency from erpnext.setup.utils import get_company_currency
from erpnext.hr.utils import set_employee_name from erpnext.hr.utils import set_employee_name
from erpnext.hr.doctype.process_payroll.process_payroll import get_month_details from erpnext.hr.doctype.process_payroll.process_payroll import get_month_details
from erpnext.hr.doctype.employee.employee import get_holiday_list_for_employee
from erpnext.utilities.transaction_base import TransactionBase from erpnext.utilities.transaction_base import TransactionBase
class SalarySlip(TransactionBase): class SalarySlip(TransactionBase):
@ -108,21 +108,19 @@ class SalarySlip(TransactionBase):
return payment_days return payment_days
def get_holidays_for_employee(self, start_date, end_date): def get_holidays_for_employee(self, start_date, end_date):
holidays = frappe.db.sql("""select t1.holiday_date holiday_list = get_holiday_list_for_employee(self.employee)
from `tabHoliday` t1, tabEmployee t2 holidays = frappe.db.sql_list('''select holiday_date from `tabHoliday`
where t1.parent = t2.holiday_list and t2.name = %s where
and t1.holiday_date between %s and %s""", parent=%(holiday_list)s
(self.employee, start_date, end_date)) and holiday_date >= %(start_date)s
and holiday_date <= %(end_date)s''', {
"holiday_list": holiday_list,
"start_date": start_date,
"end_date": end_date
})
if not holidays: holidays = [cstr(i) for i in holidays]
holidays = frappe.db.sql("""select t1.holiday_date
from `tabHoliday` t1, `tabHoliday List` t2
where t1.parent = t2.name and t2.is_default = 1
and t2.fiscal_year = %s
and t1.holiday_date between %s and %s""",
(self.fiscal_year, start_date, end_date))
holidays = [cstr(i[0]) for i in holidays]
return holidays return holidays
def calculate_lwp(self, holidays, m): def calculate_lwp(self, holidays, m):

View File

@ -16,7 +16,7 @@ class TestSalarySlip(unittest.TestCase):
make_allocation_record(leave_type="_Test Leave Type LWP") make_allocation_record(leave_type="_Test Leave Type LWP")
frappe.db.set_value("Holiday List", "_Test Holiday List", "is_default", 1) frappe.db.set_value("Company", "_Test Company", "default_holiday_list", "_Test Holiday List")
from erpnext.hr.doctype.leave_application.test_leave_application import _test_records as leave_applications from erpnext.hr.doctype.leave_application.test_leave_application import _test_records as leave_applications
la = frappe.copy_doc(leave_applications[2]) la = frappe.copy_doc(leave_applications[2])

View File

@ -37,12 +37,10 @@ def add_header(w):
w.writerow(["Status should be one of these values: " + status]) w.writerow(["Status should be one of these values: " + status])
w.writerow(["If you are overwriting existing attendance records, 'ID' column mandatory"]) w.writerow(["If you are overwriting existing attendance records, 'ID' column mandatory"])
w.writerow(["ID", "Employee", "Employee Name", "Date", "Status", w.writerow(["ID", "Employee", "Employee Name", "Date", "Status",
"Fiscal Year", "Company", "Naming Series"]) "Company", "Naming Series"])
return w return w
def add_data(w, args): def add_data(w, args):
from erpnext.accounts.utils import get_fiscal_year
dates = get_dates(args) dates = get_dates(args)
employees = get_active_employees() employees = get_active_employees()
existing_attendance_records = get_existing_attendance_records(args) existing_attendance_records = get_existing_attendance_records(args)
@ -55,8 +53,7 @@ def add_data(w, args):
row = [ row = [
existing_attendance and existing_attendance.name or "", existing_attendance and existing_attendance.name or "",
employee.name, employee.employee_name, date, employee.name, employee.employee_name, date,
existing_attendance and existing_attendance.status or "", existing_attendance and existing_attendance.status or "", employee.company,
get_fiscal_year(date)[0], employee.company,
existing_attendance and existing_attendance.naming_series or get_naming_series(), existing_attendance and existing_attendance.naming_series or get_naming_series(),
] ]
w.writerow(row) w.writerow(row)

View File

@ -1,6 +1,7 @@
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors // Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
// License: GNU General Public License v3. See license.txt // License: GNU General Public License v3. See license.txt
frappe.query_reports["Monthly Attendance Sheet"] = { frappe.query_reports["Monthly Attendance Sheet"] = {
"filters": [ "filters": [
{ {
@ -12,11 +13,10 @@ frappe.query_reports["Monthly Attendance Sheet"] = {
"Dec"][frappe.datetime.str_to_obj(frappe.datetime.get_today()).getMonth()], "Dec"][frappe.datetime.str_to_obj(frappe.datetime.get_today()).getMonth()],
}, },
{ {
"fieldname":"fiscal_year", "fieldname":"year",
"label": __("Fiscal Year"), "label": __("Year"),
"fieldtype": "Link", "fieldtype": "Select",
"options": "Fiscal Year", "reqd": 1
"default": sys_defaults.fiscal_year,
}, },
{ {
"fieldname":"employee", "fieldname":"employee",
@ -29,7 +29,21 @@ frappe.query_reports["Monthly Attendance Sheet"] = {
"label": __("Company"), "label": __("Company"),
"fieldtype": "Link", "fieldtype": "Link",
"options": "Company", "options": "Company",
"default": frappe.defaults.get_user_default("Company") "default": frappe.defaults.get_user_default("Company"),
"reqd": 1
}
],
"onload": function(me) {
return frappe.call({
method: "erpnext.hr.report.monthly_attendance_sheet.monthly_attendance_sheet.get_attendance_years",
callback: function(r) {
var year_filter = me.filters_by_name.year;
year_filter.df.options = r.message;
year_filter.df.default = r.message.split("\n")[0];
year_filter.refresh();
year_filter.set_input(year_filter.df.default);
}
});
} }
]
} }

View File

@ -3,7 +3,7 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe import frappe
from frappe.utils import cstr, cint from frappe.utils import cstr, cint, getdate
from frappe import msgprint, _ from frappe import msgprint, _
from calendar import monthrange from calendar import monthrange
@ -69,23 +69,15 @@ def get_attendance_list(conditions, filters):
return att_map return att_map
def get_conditions(filters): def get_conditions(filters):
if not (filters.get("month") and filters.get("fiscal_year")): if not (filters.get("month") and filters.get("year")):
msgprint(_("Please select month and year"), raise_exception=1) msgprint(_("Please select month and year"), raise_exception=1)
filters["month"] = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", filters["month"] = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov",
"Dec"].index(filters.month) + 1 "Dec"].index(filters.month) + 1
year_start_date, year_end_date = frappe.db.get_value("Fiscal Year", filters.fiscal_year, filters["total_days_in_month"] = monthrange(cint(filters.year), filters.month)[1]
["year_start_date", "year_end_date"])
if filters.month >= year_start_date.strftime("%m"): conditions = " and month(att_date) = %(month)s and year(att_date) = %(year)s"
year = year_start_date.strftime("%Y")
else:
year = year_end_date.strftime("%Y")
filters["total_days_in_month"] = monthrange(cint(year), filters.month)[1]
conditions = " and month(att_date) = %(month)s and fiscal_year = %(fiscal_year)s"
if filters.get("company"): conditions += " and company = %(company)s" if filters.get("company"): conditions += " and company = %(company)s"
if filters.get("employee"): conditions += " and employee = %(employee)s" if filters.get("employee"): conditions += " and employee = %(employee)s"
@ -100,3 +92,11 @@ def get_employee_details():
emp_map.setdefault(d.name, d) emp_map.setdefault(d.name, d)
return emp_map return emp_map
@frappe.whitelist()
def get_attendance_years():
year_list = frappe.db.sql_list("""select distinct YEAR(att_date) from tabAttendance ORDER BY YEAR(att_date) DESC""")
if not year_list:
year_list = [getdate().year]
return "\n".join(str(year) for year in year_list)

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