Merge branch 'develop' into leave-management

This commit is contained in:
Nabin Hait 2019-05-27 13:59:27 +05:30 committed by GitHub
commit c9a4111f4d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 548 additions and 1823 deletions

View File

@ -333,6 +333,9 @@ def reconcile_against_document(args):
doc = frappe.get_doc(d.voucher_type, d.voucher_no)
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):
"""
check if there is already a voucher reference
@ -375,9 +378,9 @@ def check_if_advance_entry_modified(args):
def validate_allocated_amount(args):
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"):
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):
"""

View File

@ -355,7 +355,7 @@ class AccountsController(TransactionBase):
'fiscal_year': fiscal_year,
'voucher_type': self.doctype,
'voucher_no': self.name,
'remarks': self.get("remarks"),
'remarks': self.get("remarks") or self.get("remark"),
'debit': 0,
'credit': 0,
'debit_in_account_currency': 0,

View File

@ -9,12 +9,14 @@ frappe.ui.form.on('Appraisal', {
return{ query: "erpnext.controllers.queries.employee_query" }
};
},
onload: function(frm) {
onload: function(frm) {
if(!frm.doc.status) {
frm.set_value('status', 'Draft');
}
},
kra_template: function(frm) {
kra_template: function(frm) {
frm.doc.goals = [];
erpnext.utils.map_current_doc({
method: "erpnext.hr.doctype.appraisal.appraisal.fetch_appraisal_template",
@ -22,7 +24,8 @@ frappe.ui.form.on('Appraisal', {
frm: frm
});
},
calculate_total: function(frm) {
calculate_total: function(frm) {
let goals = frm.doc.goals || [];
let total =0;
for(let i = 0; i<goals.length; i++){
@ -35,20 +38,17 @@ frappe.ui.form.on('Appraisal', {
frappe.ui.form.on('Appraisal Goal', {
score: function(frm, cdt, cdn) {
var d = locals[cdt][cdn];
if (d.score){
if (d.score) {
if (flt(d.score) > 5) {
frappe.msgprint(__("Score must be less than or equal to 5"));
d.score = 0;
refresh_field('score', d.name, 'goals');
}
var total = flt(d.per_weightage*d.score)/100;
d.score_earned = total.toPrecision(2);
refresh_field('score_earned', d.name, 'goals');
}
else{
d.score_earned = flt(d.per_weightage*d.score, precision("score_earned", d))/100;
} else {
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');
}
});

View File

@ -219,7 +219,8 @@ frappe.ui.form.on("Expense Claim", {
frm.fields_dict["cost_center"].get_query = function() {
return {
filters: {
"company": frm.doc.company
"company": frm.doc.company,
"is_group": 0
}
};
};
@ -230,7 +231,9 @@ frappe.ui.form.on("Expense Claim", {
return {
filters: {
"report_type": "Balance Sheet",
"account_type": "Payable"
"account_type": "Payable",
"company": frm.doc.company,
"is_group": 0
}
};
};

View 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']
},
]
}

View File

@ -79,6 +79,7 @@ def get_events(start, end, filters=None):
filters.append(['Holiday', 'holiday_date', '>', getdate(start)])
if end:
filters.append(['Holiday', 'holiday_date', '<', getdate(end)])
return frappe.get_list('Holiday List',
fields=['name', '`tabHoliday`.holiday_date', '`tabHoliday`.description', '`tabHoliday List`.color'],
filters = filters,

View File

@ -3,8 +3,8 @@
frappe.views.calendar["Holiday List"] = {
field_map: {
"start": "from_date",
"end": "to_date",
"start": "holiday_date",
"end": "holiday_date",
"id": "name",
"title": "description",
"allDay": "allDay"

File diff suppressed because it is too large Load Diff

View File

@ -67,7 +67,8 @@ class Gstr1Report(object):
row.append("Y" if invoice_details.posting_date <= date(2017, 7, 1) else "N")
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):
b2cs_output = {}
@ -113,9 +114,14 @@ class Gstr1Report(object):
row.append(export_type)
else:
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]
return row, taxable_value
@ -184,8 +190,10 @@ class Gstr1Report(object):
def get_invoice_items(self):
self.invoice_items = frappe._dict()
self.item_tax_rate = frappe._dict()
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`
where parent in (%s)
""" % (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
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):
self.tax_details = frappe.db.sql("""
select

View File

@ -276,7 +276,8 @@ def get_items(warehouse, posting_date, posting_time, company):
items = frappe.db.sql("""
select i.name, i.item_name, bin.warehouse
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)
""", (lft, rgt))