Merge branch 'leave-management' of https://github.com/Mangesh-Khairnar/erpnext into leave-management
This commit is contained in:
commit
35786c0067
@ -333,6 +333,9 @@ def reconcile_against_document(args):
|
|||||||
doc = frappe.get_doc(d.voucher_type, d.voucher_no)
|
doc = frappe.get_doc(d.voucher_type, d.voucher_no)
|
||||||
doc.make_gl_entries(cancel = 0, adv_adj =1)
|
doc.make_gl_entries(cancel = 0, adv_adj =1)
|
||||||
|
|
||||||
|
if d.voucher_type in ('Payment Entry', 'Journal Entry'):
|
||||||
|
doc.update_expense_claim()
|
||||||
|
|
||||||
def check_if_advance_entry_modified(args):
|
def check_if_advance_entry_modified(args):
|
||||||
"""
|
"""
|
||||||
check if there is already a voucher reference
|
check if there is already a voucher reference
|
||||||
@ -375,9 +378,9 @@ def check_if_advance_entry_modified(args):
|
|||||||
|
|
||||||
def validate_allocated_amount(args):
|
def validate_allocated_amount(args):
|
||||||
if args.get("allocated_amount") < 0:
|
if args.get("allocated_amount") < 0:
|
||||||
throw(_("Allocated amount can not be negative"))
|
throw(_("Allocated amount cannot be negative"))
|
||||||
elif args.get("allocated_amount") > args.get("unadjusted_amount"):
|
elif args.get("allocated_amount") > args.get("unadjusted_amount"):
|
||||||
throw(_("Allocated amount can not greater than unadjusted amount"))
|
throw(_("Allocated amount cannot be greater than unadjusted amount"))
|
||||||
|
|
||||||
def update_reference_in_journal_entry(d, jv_obj):
|
def update_reference_in_journal_entry(d, jv_obj):
|
||||||
"""
|
"""
|
||||||
|
|||||||
@ -355,7 +355,7 @@ class AccountsController(TransactionBase):
|
|||||||
'fiscal_year': fiscal_year,
|
'fiscal_year': fiscal_year,
|
||||||
'voucher_type': self.doctype,
|
'voucher_type': self.doctype,
|
||||||
'voucher_no': self.name,
|
'voucher_no': self.name,
|
||||||
'remarks': self.get("remarks"),
|
'remarks': self.get("remarks") or self.get("remark"),
|
||||||
'debit': 0,
|
'debit': 0,
|
||||||
'credit': 0,
|
'credit': 0,
|
||||||
'debit_in_account_currency': 0,
|
'debit_in_account_currency': 0,
|
||||||
|
|||||||
@ -9,12 +9,14 @@ frappe.ui.form.on('Appraisal', {
|
|||||||
return{ query: "erpnext.controllers.queries.employee_query" }
|
return{ query: "erpnext.controllers.queries.employee_query" }
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
onload: function(frm) {
|
|
||||||
|
onload: function(frm) {
|
||||||
if(!frm.doc.status) {
|
if(!frm.doc.status) {
|
||||||
frm.set_value('status', 'Draft');
|
frm.set_value('status', 'Draft');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
kra_template: function(frm) {
|
|
||||||
|
kra_template: function(frm) {
|
||||||
frm.doc.goals = [];
|
frm.doc.goals = [];
|
||||||
erpnext.utils.map_current_doc({
|
erpnext.utils.map_current_doc({
|
||||||
method: "erpnext.hr.doctype.appraisal.appraisal.fetch_appraisal_template",
|
method: "erpnext.hr.doctype.appraisal.appraisal.fetch_appraisal_template",
|
||||||
@ -22,7 +24,8 @@ frappe.ui.form.on('Appraisal', {
|
|||||||
frm: frm
|
frm: frm
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
calculate_total: function(frm) {
|
|
||||||
|
calculate_total: function(frm) {
|
||||||
let goals = frm.doc.goals || [];
|
let goals = frm.doc.goals || [];
|
||||||
let total =0;
|
let total =0;
|
||||||
for(let i = 0; i<goals.length; i++){
|
for(let i = 0; i<goals.length; i++){
|
||||||
@ -35,20 +38,17 @@ frappe.ui.form.on('Appraisal', {
|
|||||||
frappe.ui.form.on('Appraisal Goal', {
|
frappe.ui.form.on('Appraisal Goal', {
|
||||||
score: function(frm, cdt, cdn) {
|
score: function(frm, cdt, cdn) {
|
||||||
var d = locals[cdt][cdn];
|
var d = locals[cdt][cdn];
|
||||||
if (d.score){
|
if (d.score) {
|
||||||
if (flt(d.score) > 5) {
|
if (flt(d.score) > 5) {
|
||||||
frappe.msgprint(__("Score must be less than or equal to 5"));
|
frappe.msgprint(__("Score must be less than or equal to 5"));
|
||||||
d.score = 0;
|
d.score = 0;
|
||||||
refresh_field('score', d.name, 'goals');
|
refresh_field('score', d.name, 'goals');
|
||||||
}
|
}
|
||||||
var total = flt(d.per_weightage*d.score)/100;
|
d.score_earned = flt(d.per_weightage*d.score, precision("score_earned", d))/100;
|
||||||
d.score_earned = total.toPrecision(2);
|
} else {
|
||||||
refresh_field('score_earned', d.name, 'goals');
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
d.score_earned = 0;
|
d.score_earned = 0;
|
||||||
refresh_field('score_earned', d.name, 'goals');
|
|
||||||
}
|
}
|
||||||
frm.trigger('calculate_total');
|
refresh_field('score_earned', d.name, 'goals');
|
||||||
|
frm.trigger('calculate_total');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -219,7 +219,8 @@ frappe.ui.form.on("Expense Claim", {
|
|||||||
frm.fields_dict["cost_center"].get_query = function() {
|
frm.fields_dict["cost_center"].get_query = function() {
|
||||||
return {
|
return {
|
||||||
filters: {
|
filters: {
|
||||||
"company": frm.doc.company
|
"company": frm.doc.company,
|
||||||
|
"is_group": 0
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@ -230,7 +231,9 @@ frappe.ui.form.on("Expense Claim", {
|
|||||||
return {
|
return {
|
||||||
filters: {
|
filters: {
|
||||||
"report_type": "Balance Sheet",
|
"report_type": "Balance Sheet",
|
||||||
"account_type": "Payable"
|
"account_type": "Payable",
|
||||||
|
"company": frm.doc.company,
|
||||||
|
"is_group": 0
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
20
erpnext/hr/doctype/expense_claim/expense_claim_dashboard.py
Normal file
20
erpnext/hr/doctype/expense_claim/expense_claim_dashboard.py
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
from frappe import _
|
||||||
|
|
||||||
|
def get_data():
|
||||||
|
return {
|
||||||
|
'fieldname': 'reference_name',
|
||||||
|
'internal_links': {
|
||||||
|
'Employee Advance': ['advances', 'employee_advance']
|
||||||
|
},
|
||||||
|
'transactions': [
|
||||||
|
{
|
||||||
|
'label': _('Payment'),
|
||||||
|
'items': ['Payment Entry', 'Journal Entry']
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'label': _('Reference'),
|
||||||
|
'items': ['Employee Advance']
|
||||||
|
},
|
||||||
|
]
|
||||||
|
}
|
||||||
@ -79,6 +79,7 @@ def get_events(start, end, filters=None):
|
|||||||
filters.append(['Holiday', 'holiday_date', '>', getdate(start)])
|
filters.append(['Holiday', 'holiday_date', '>', getdate(start)])
|
||||||
if end:
|
if end:
|
||||||
filters.append(['Holiday', 'holiday_date', '<', getdate(end)])
|
filters.append(['Holiday', 'holiday_date', '<', getdate(end)])
|
||||||
|
|
||||||
return frappe.get_list('Holiday List',
|
return frappe.get_list('Holiday List',
|
||||||
fields=['name', '`tabHoliday`.holiday_date', '`tabHoliday`.description', '`tabHoliday List`.color'],
|
fields=['name', '`tabHoliday`.holiday_date', '`tabHoliday`.description', '`tabHoliday List`.color'],
|
||||||
filters = filters,
|
filters = filters,
|
||||||
|
|||||||
@ -3,8 +3,8 @@
|
|||||||
|
|
||||||
frappe.views.calendar["Holiday List"] = {
|
frappe.views.calendar["Holiday List"] = {
|
||||||
field_map: {
|
field_map: {
|
||||||
"start": "from_date",
|
"start": "holiday_date",
|
||||||
"end": "to_date",
|
"end": "holiday_date",
|
||||||
"id": "name",
|
"id": "name",
|
||||||
"title": "description",
|
"title": "description",
|
||||||
"allDay": "allDay"
|
"allDay": "allDay"
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -67,7 +67,8 @@ class Gstr1Report(object):
|
|||||||
row.append("Y" if invoice_details.posting_date <= date(2017, 7, 1) else "N")
|
row.append("Y" if invoice_details.posting_date <= date(2017, 7, 1) else "N")
|
||||||
row.append("C" if invoice_details.return_against else "R")
|
row.append("C" if invoice_details.return_against else "R")
|
||||||
|
|
||||||
self.data.append(row)
|
if taxable_value:
|
||||||
|
self.data.append(row)
|
||||||
|
|
||||||
def get_b2cs_data(self):
|
def get_b2cs_data(self):
|
||||||
b2cs_output = {}
|
b2cs_output = {}
|
||||||
@ -113,9 +114,14 @@ class Gstr1Report(object):
|
|||||||
row.append(export_type)
|
row.append(export_type)
|
||||||
else:
|
else:
|
||||||
row.append(invoice_details.get(fieldname))
|
row.append(invoice_details.get(fieldname))
|
||||||
|
taxable_value = 0
|
||||||
|
for item_code, net_amount in self.invoice_items.get(invoice).items():
|
||||||
|
if item_code in items:
|
||||||
|
if self.item_tax_rate.get(invoice) and tax_rate == self.item_tax_rate.get(invoice, {}).get(item_code):
|
||||||
|
taxable_value += abs(net_amount)
|
||||||
|
elif not self.item_tax_rate.get(invoice):
|
||||||
|
taxable_value += abs(net_amount)
|
||||||
|
|
||||||
taxable_value = sum([abs(net_amount)
|
|
||||||
for item_code, net_amount in self.invoice_items.get(invoice).items() if item_code in items])
|
|
||||||
row += [tax_rate or 0, taxable_value]
|
row += [tax_rate or 0, taxable_value]
|
||||||
|
|
||||||
return row, taxable_value
|
return row, taxable_value
|
||||||
@ -184,8 +190,10 @@ class Gstr1Report(object):
|
|||||||
|
|
||||||
def get_invoice_items(self):
|
def get_invoice_items(self):
|
||||||
self.invoice_items = frappe._dict()
|
self.invoice_items = frappe._dict()
|
||||||
|
self.item_tax_rate = frappe._dict()
|
||||||
|
|
||||||
items = frappe.db.sql("""
|
items = frappe.db.sql("""
|
||||||
select item_code, parent, base_net_amount
|
select item_code, parent, base_net_amount, item_tax_rate
|
||||||
from `tab%s Item`
|
from `tab%s Item`
|
||||||
where parent in (%s)
|
where parent in (%s)
|
||||||
""" % (self.doctype, ', '.join(['%s']*len(self.invoices))), tuple(self.invoices), as_dict=1)
|
""" % (self.doctype, ', '.join(['%s']*len(self.invoices))), tuple(self.invoices), as_dict=1)
|
||||||
@ -196,6 +204,12 @@ class Gstr1Report(object):
|
|||||||
sum(i.get('base_net_amount', 0) for i in items
|
sum(i.get('base_net_amount', 0) for i in items
|
||||||
if i.item_code == d.item_code and i.parent == d.parent))
|
if i.item_code == d.item_code and i.parent == d.parent))
|
||||||
|
|
||||||
|
item_tax_rate = json.loads(d.item_tax_rate)
|
||||||
|
|
||||||
|
if item_tax_rate:
|
||||||
|
for account, rate in item_tax_rate.items():
|
||||||
|
self.item_tax_rate.setdefault(d.parent, {}).setdefault(d.item_code, rate)
|
||||||
|
|
||||||
def get_items_based_on_tax_rate(self):
|
def get_items_based_on_tax_rate(self):
|
||||||
self.tax_details = frappe.db.sql("""
|
self.tax_details = frappe.db.sql("""
|
||||||
select
|
select
|
||||||
|
|||||||
@ -276,7 +276,8 @@ def get_items(warehouse, posting_date, posting_time, company):
|
|||||||
items = frappe.db.sql("""
|
items = frappe.db.sql("""
|
||||||
select i.name, i.item_name, bin.warehouse
|
select i.name, i.item_name, bin.warehouse
|
||||||
from tabBin bin, tabItem i
|
from tabBin bin, tabItem i
|
||||||
where i.name=bin.item_code and i.disabled=0
|
where i.name=bin.item_code and i.disabled=0 and i.is_stock_item = 1
|
||||||
|
and i.has_variants = 0 and i.has_serial_no = 0 and i.has_batch_no = 0
|
||||||
and exists(select name from `tabWarehouse` where lft >= %s and rgt <= %s and name=bin.warehouse)
|
and exists(select name from `tabWarehouse` where lft >= %s and rgt <= %s and name=bin.warehouse)
|
||||||
""", (lft, rgt))
|
""", (lft, rgt))
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user