Merge branch 'hotfix'

This commit is contained in:
Nabin Hait 2016-12-30 14:56:20 +05:30
commit 257ecf71ac
5 changed files with 23 additions and 27 deletions

View File

@ -2,7 +2,7 @@
from __future__ import unicode_literals
import frappe
__version__ = '7.2.3'
__version__ = '7.2.4'
def get_default_company(user=None):
'''Get default company for user'''

View File

@ -651,7 +651,8 @@ def get_payment_entry(ref_doc, args):
if args.get("party_account"):
# Modified to include the posting date for which the exchange rate is required.
# Assumed to be the posting date in the reference document
exchange_rate = get_exchange_rate(ref_doc.posting_date, args.get("party_account"), args.get("party_account_currency"),
exchange_rate = get_exchange_rate(ref_doc.get("posting_date") or ref_doc.get("transaction_date"),
args.get("party_account"), args.get("party_account_currency"),
ref_doc.company, ref_doc.doctype, ref_doc.name)
je = frappe.new_doc("Journal Entry")
@ -686,7 +687,8 @@ def get_payment_entry(ref_doc, args):
bank_row.update(bank_account)
# Modified to include the posting date for which the exchange rate is required.
# Assumed to be the posting date of the reference date
bank_row.exchange_rate = get_exchange_rate(ref_doc.posting_date, bank_account["account"],
bank_row.exchange_rate = get_exchange_rate(ref_doc.get("posting_date")
or ref_doc.get("transaction_date"), bank_account["account"],
bank_account["account_currency"], ref_doc.company)
bank_row.cost_center = cost_center

View File

@ -4,19 +4,18 @@
frappe.query_reports["Monthly Salary Register"] = {
"filters": [
{
"fieldname":"month",
"label": __("Month"),
"fieldtype": "Select",
"options": "\nJan\nFeb\nMar\nApr\nMay\nJun\nJul\nAug\nSep\nOct\nNov\nDec",
"default": ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov",
"Dec"][frappe.datetime.str_to_obj(frappe.datetime.get_today()).getMonth()],
"fieldname":"from_date",
"label": __("From"),
"fieldtype": "Date",
"default": frappe.datetime.add_months(frappe.datetime.get_today(), -1),
"reqd": 1
},
{
"fieldname":"fiscal_year",
"label": __("Fiscal Year"),
"fieldtype": "Link",
"options": "Fiscal Year",
"default": sys_defaults.fiscal_year,
"fieldname":"to_date",
"label": __("To"),
"fieldtype": "Date",
"default": frappe.datetime.get_today(),
"reqd": 1
},
{
"fieldname":"employee",

View File

@ -18,7 +18,7 @@ def execute(filters=None):
data = []
for ss in salary_slips:
row = [ss.name, ss.employee, ss.employee_name, ss.branch, ss.department, ss.designation,
ss.company, ss.month, ss.leave_withut_pay, ss.payment_days]
ss.company, ss.start_date, ss.end_date, ss.leave_withut_pay, ss.payment_days]
for e in earning_types:
row.append(ss_earning_map.get(ss.name, {}).get(e))
@ -38,7 +38,7 @@ def get_columns(salary_slips):
columns = [
_("Salary Slip ID") + ":Link/Salary Slip:150",_("Employee") + ":Link/Employee:120", _("Employee Name") + "::140", _("Branch") + ":Link/Branch:120",
_("Department") + ":Link/Department:120", _("Designation") + ":Link/Designation:120",
_("Company") + ":Link/Company:120", _("Month") + "::80", _("Leave Without Pay") + ":Float:130",
_("Company") + ":Link/Company:120", _("Start Date") + "::80", _("End Date") + "::80", _("Leave Without Pay") + ":Float:130",
_("Payment Days") + ":Float:120"
]
@ -60,23 +60,18 @@ def get_columns(salary_slips):
def get_salary_slips(filters):
conditions, filters = get_conditions(filters)
salary_slips = frappe.db.sql("""select * from `tabSalary Slip` where docstatus = 1 %s
order by employee, month""" % conditions, filters, as_dict=1)
order by employee""" % conditions, filters, as_dict=1)
if not salary_slips:
frappe.throw(_("No salary slip found for month {0} and year {1}").format(
filters.get("month"), filters.get("fiscal_year")))
frappe.throw(_("No salary slip found between {0} and {1}").format(
filters.get("from_date"), filters.get("to_date")))
return salary_slips
def get_conditions(filters):
conditions = ""
if filters.get("month"):
month = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov",
"Dec"].index(filters["month"]) + 1
filters["month"] = month
conditions += " and month = %(month)s"
if filters.get("fiscal_year"): conditions += " and fiscal_year = %(fiscal_year)s"
if filters.get("from_date"): conditions += " and start_date >= %(from_date)s"
if filters.get("to_date"): conditions += " and end_date <= %(to_date)s"
if filters.get("company"): conditions += " and company = %(company)s"
if filters.get("employee"): conditions += " and employee = %(employee)s"

View File

@ -9,7 +9,7 @@ cur_frm.fields_dict['item_code'].get_query = function(doc, cdt, cdn) {
return {
query: "erpnext.stock.doctype.quality_inspection.quality_inspection.item_query",
filters: {
"from": doc.reference_type,
"from": doc.reference_type + " Item",
"parent": doc.reference_name
}
}