[fix] additional fixes after deprecating Fiscal Year
This commit is contained in:
parent
d9cc14ddd5
commit
c75c1d7e3e
@ -1,156 +1,156 @@
|
|||||||
{
|
{
|
||||||
"allow_copy": 0,
|
"allow_copy": 0,
|
||||||
"allow_import": 0,
|
"allow_import": 0,
|
||||||
"allow_rename": 0,
|
"allow_rename": 0,
|
||||||
"autoname": "field:distribution_id",
|
"autoname": "field:distribution_id",
|
||||||
"creation": "2013-01-10 16:34:05",
|
"creation": "2013-01-10 16:34:05",
|
||||||
"custom": 0,
|
"custom": 0,
|
||||||
"description": "**Monthly Distribution** helps you distribute your budget across months if you have seasonality in your business.\n\nTo distribute a budget using this distribution, set this **Monthly Distribution** in the **Cost Center**",
|
"description": "**Monthly Distribution** helps you distribute your budget across months if you have seasonality in your business.\n\nTo distribute a budget using this distribution, set this **Monthly Distribution** in the **Cost Center**",
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"doctype": "DocType",
|
"doctype": "DocType",
|
||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
"description": "Name of the Monthly Distribution",
|
"description": "Name of the Monthly Distribution",
|
||||||
"fieldname": "distribution_id",
|
"fieldname": "distribution_id",
|
||||||
"fieldtype": "Data",
|
"fieldtype": "Data",
|
||||||
"hidden": 0,
|
"hidden": 0,
|
||||||
"ignore_user_permissions": 0,
|
"ignore_user_permissions": 0,
|
||||||
"ignore_xss_filter": 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",
|
||||||
"length": 0,
|
"length": 0,
|
||||||
"no_copy": 0,
|
"no_copy": 0,
|
||||||
"oldfieldname": "distribution_id",
|
"oldfieldname": "distribution_id",
|
||||||
"oldfieldtype": "Data",
|
"oldfieldtype": "Data",
|
||||||
"permlevel": 0,
|
"permlevel": 0,
|
||||||
"print_hide": 0,
|
"print_hide": 0,
|
||||||
"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": 1,
|
||||||
"search_index": 0,
|
"search_index": 0,
|
||||||
"set_only_once": 0,
|
"set_only_once": 0,
|
||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
"fieldname": "fiscal_year",
|
"fieldname": "fiscal_year",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"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": 1,
|
||||||
"in_list_view": 1,
|
"in_list_view": 1,
|
||||||
"label": "Fiscal Year",
|
"label": "Fiscal Year",
|
||||||
"length": 0,
|
"length": 0,
|
||||||
"no_copy": 0,
|
"no_copy": 0,
|
||||||
"oldfieldname": "fiscal_year",
|
"oldfieldname": "fiscal_year",
|
||||||
"oldfieldtype": "Select",
|
"oldfieldtype": "Select",
|
||||||
"options": "Fiscal Year",
|
"options": "Fiscal Year",
|
||||||
"permlevel": 0,
|
"permlevel": 0,
|
||||||
"print_hide": 0,
|
"print_hide": 0,
|
||||||
"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": 0,
|
"reqd": 0,
|
||||||
"search_index": 1,
|
"search_index": 1,
|
||||||
"set_only_once": 0,
|
"set_only_once": 0,
|
||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
"fieldname": "percentages",
|
"fieldname": "percentages",
|
||||||
"fieldtype": "Table",
|
"fieldtype": "Table",
|
||||||
"hidden": 0,
|
"hidden": 0,
|
||||||
"ignore_user_permissions": 0,
|
"ignore_user_permissions": 0,
|
||||||
"ignore_xss_filter": 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",
|
||||||
"length": 0,
|
"length": 0,
|
||||||
"no_copy": 0,
|
"no_copy": 0,
|
||||||
"oldfieldname": "budget_distribution_details",
|
"oldfieldname": "budget_distribution_details",
|
||||||
"oldfieldtype": "Table",
|
"oldfieldtype": "Table",
|
||||||
"options": "Monthly Distribution Percentage",
|
"options": "Monthly Distribution Percentage",
|
||||||
"permlevel": 0,
|
"permlevel": 0,
|
||||||
"print_hide": 0,
|
"print_hide": 0,
|
||||||
"print_hide_if_no_value": 0,
|
"print_hide_if_no_value": 0,
|
||||||
"read_only": 1,
|
"read_only": 0,
|
||||||
"report_hide": 0,
|
"report_hide": 0,
|
||||||
"reqd": 0,
|
"reqd": 0,
|
||||||
"search_index": 0,
|
"search_index": 0,
|
||||||
"set_only_once": 0,
|
"set_only_once": 0,
|
||||||
"unique": 0
|
"unique": 0
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"hide_heading": 0,
|
"hide_heading": 0,
|
||||||
"hide_toolbar": 0,
|
"hide_toolbar": 0,
|
||||||
"icon": "icon-bar-chart",
|
"icon": "icon-bar-chart",
|
||||||
"idx": 1,
|
"idx": 1,
|
||||||
"in_create": 0,
|
"in_create": 0,
|
||||||
"in_dialog": 0,
|
"in_dialog": 0,
|
||||||
"is_submittable": 0,
|
"is_submittable": 0,
|
||||||
"issingle": 0,
|
"issingle": 0,
|
||||||
"istable": 0,
|
"istable": 0,
|
||||||
"max_attachments": 0,
|
"max_attachments": 0,
|
||||||
"modified": "2016-03-03 02:46:44.493856",
|
"modified": "2016-03-03 02:46:44.493857",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Accounts",
|
"module": "Accounts",
|
||||||
"name": "Monthly Distribution",
|
"name": "Monthly Distribution",
|
||||||
"name_case": "Title Case",
|
"name_case": "Title Case",
|
||||||
"owner": "Administrator",
|
"owner": "Administrator",
|
||||||
"permissions": [
|
"permissions": [
|
||||||
{
|
{
|
||||||
"amend": 0,
|
"amend": 0,
|
||||||
"apply_user_permissions": 0,
|
"apply_user_permissions": 0,
|
||||||
"cancel": 0,
|
"cancel": 0,
|
||||||
"create": 1,
|
"create": 1,
|
||||||
"delete": 1,
|
"delete": 1,
|
||||||
"email": 1,
|
"email": 1,
|
||||||
"export": 0,
|
"export": 0,
|
||||||
"if_owner": 0,
|
"if_owner": 0,
|
||||||
"import": 0,
|
"import": 0,
|
||||||
"permlevel": 0,
|
"permlevel": 0,
|
||||||
"print": 1,
|
"print": 1,
|
||||||
"read": 1,
|
"read": 1,
|
||||||
"report": 1,
|
"report": 1,
|
||||||
"role": "Accounts Manager",
|
"role": "Accounts Manager",
|
||||||
"set_user_permissions": 0,
|
"set_user_permissions": 0,
|
||||||
"share": 1,
|
"share": 1,
|
||||||
"submit": 0,
|
"submit": 0,
|
||||||
"write": 1
|
"write": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"amend": 0,
|
"amend": 0,
|
||||||
"apply_user_permissions": 0,
|
"apply_user_permissions": 0,
|
||||||
"cancel": 0,
|
"cancel": 0,
|
||||||
"create": 0,
|
"create": 0,
|
||||||
"delete": 0,
|
"delete": 0,
|
||||||
"email": 0,
|
"email": 0,
|
||||||
"export": 0,
|
"export": 0,
|
||||||
"if_owner": 0,
|
"if_owner": 0,
|
||||||
"import": 0,
|
"import": 0,
|
||||||
"permlevel": 2,
|
"permlevel": 2,
|
||||||
"print": 0,
|
"print": 0,
|
||||||
"read": 1,
|
"read": 1,
|
||||||
"report": 1,
|
"report": 1,
|
||||||
"role": "Accounts Manager",
|
"role": "Accounts Manager",
|
||||||
"set_user_permissions": 0,
|
"set_user_permissions": 0,
|
||||||
"share": 0,
|
"share": 0,
|
||||||
"submit": 0,
|
"submit": 0,
|
||||||
"write": 0
|
"write": 0
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"read_only": 0,
|
"read_only": 0,
|
||||||
"read_only_onload": 0,
|
"read_only_onload": 0,
|
||||||
"sort_field": "modified",
|
"sort_field": "modified",
|
||||||
"sort_order": "DESC"
|
"sort_order": "DESC"
|
||||||
}
|
}
|
||||||
|
@ -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)
|
||||||
"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):
|
||||||
|
@ -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
|
||||||
@ -106,7 +106,7 @@ def get_balance_on(account=None, date=None, party_type=None, party=None, in_acco
|
|||||||
in_account_currency = False
|
in_account_currency = False
|
||||||
else:
|
else:
|
||||||
cond.append("""gle.account = "%s" """ % (frappe.db.escape(account, percent=False), ))
|
cond.append("""gle.account = "%s" """ % (frappe.db.escape(account, percent=False), ))
|
||||||
|
|
||||||
if party_type and party:
|
if party_type and party:
|
||||||
cond.append("""gle.party_type = "%s" and gle.party = "%s" """ %
|
cond.append("""gle.party_type = "%s" and gle.party = "%s" """ %
|
||||||
(frappe.db.escape(party_type), frappe.db.escape(party, percent=False)))
|
(frappe.db.escape(party_type), frappe.db.escape(party, percent=False)))
|
||||||
@ -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")
|
||||||
|
|
@ -89,7 +89,7 @@ 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,
|
||||||
"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))
|
||||||
})
|
})
|
||||||
|
|
||||||
# copy document fields
|
# copy document fields
|
||||||
|
@ -9,7 +9,7 @@ frappe.query_reports["Monthly Attendance Sheet"] = {
|
|||||||
"label": __("Month"),
|
"label": __("Month"),
|
||||||
"fieldtype": "Select",
|
"fieldtype": "Select",
|
||||||
"options": "Jan\nFeb\nMar\nApr\nMay\nJun\nJul\nAug\nSep\nOct\nNov\nDec",
|
"options": "Jan\nFeb\nMar\nApr\nMay\nJun\nJul\nAug\nSep\nOct\nNov\nDec",
|
||||||
"default": ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov",
|
"default": ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov",
|
||||||
"Dec"][frappe.datetime.str_to_obj(frappe.datetime.get_today()).getMonth()],
|
"Dec"][frappe.datetime.str_to_obj(frappe.datetime.get_today()).getMonth()],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -40,9 +40,10 @@ frappe.query_reports["Monthly Attendance Sheet"] = {
|
|||||||
callback: function(r) {
|
callback: function(r) {
|
||||||
var year_filter = me.filters_by_name.year;
|
var year_filter = me.filters_by_name.year;
|
||||||
year_filter.df.options = r.message;
|
year_filter.df.options = r.message;
|
||||||
year_filter.set_options(r.message.split("\n")[0]);
|
year_filter.df.default = r.message.split("\n")[0];
|
||||||
year_filter.refresh();
|
year_filter.refresh();
|
||||||
|
year_filter.set_input(year_filter.df.default);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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
|
||||||
|
|
||||||
@ -74,7 +74,7 @@ def get_conditions(filters):
|
|||||||
|
|
||||||
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
|
||||||
|
|
||||||
filters["total_days_in_month"] = monthrange(cint(filters.year), filters.month)[1]
|
filters["total_days_in_month"] = monthrange(cint(filters.year), filters.month)[1]
|
||||||
|
|
||||||
conditions = " and month(att_date) = %(month)s and year(att_date) = %(year)s"
|
conditions = " and month(att_date) = %(month)s and year(att_date) = %(year)s"
|
||||||
@ -95,5 +95,8 @@ def get_employee_details():
|
|||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def get_attendance_years():
|
def get_attendance_years():
|
||||||
year_list = frappe.db.sql_list("""select distinct YEAR(att_date) from tabAttendance ORDER BY YEAR(att_date)""")
|
year_list = frappe.db.sql_list("""select distinct YEAR(att_date) from tabAttendance ORDER BY YEAR(att_date) DESC""")
|
||||||
return "\n".join(str(year) for year in year_list)
|
if not year_list:
|
||||||
|
year_list = [getdate().year]
|
||||||
|
|
||||||
|
return "\n".join(str(year) for year in year_list)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user