feat: change the claim amount in expenses to amount
diff --git a/erpnext/demo/user/hr.py b/erpnext/demo/user/hr.py
index 79f3c19..0211bc8 100644
--- a/erpnext/demo/user/hr.py
+++ b/erpnext/demo/user/hr.py
@@ -97,7 +97,7 @@
"expense_date": frappe.flags.current_date,
"expense_type": expense_type.name,
"default_account": expense_type.default_account or "Miscellaneous Expenses - WPL",
- "claim_amount": claim_amount,
+ "amount": claim_amount,
"sanctioned_amount": claim_amount
})
@@ -107,7 +107,7 @@
for expense in expense_claim.expenses:
sanctioned_amount = random.randint(1,20)*10
- if sanctioned_amount < expense.claim_amount:
+ if sanctioned_amount < expense.amount:
expense.sanctioned_amount = sanctioned_amount
def get_timesheet_based_salary_slip_employee():
diff --git a/erpnext/hr/doctype/expense_claim/expense_claim.js b/erpnext/hr/doctype/expense_claim/expense_claim.js
index 0ff70cb..6425b95 100644
--- a/erpnext/hr/doctype/expense_claim/expense_claim.js
+++ b/erpnext/hr/doctype/expense_claim/expense_claim.js
@@ -109,7 +109,7 @@
doc.total_claimed_amount = 0;
doc.total_sanctioned_amount = 0;
$.each((doc.expenses || []), function(i, d) {
- doc.total_claimed_amount += d.claim_amount;
+ doc.total_claimed_amount += d.amount;
doc.total_sanctioned_amount += d.sanctioned_amount;
});
@@ -308,10 +308,10 @@
});
frappe.ui.form.on("Expense Claim Detail", {
- claim_amount: function(frm, cdt, cdn) {
+ amount: function(frm, cdt, cdn) {
var child = locals[cdt][cdn];
var doc = frm.doc;
- frappe.model.set_value(cdt, cdn, 'sanctioned_amount', child.claim_amount);
+ frappe.model.set_value(cdt, cdn, 'sanctioned_amount', child.amount);
cur_frm.cscript.calculate_total(doc,cdt,cdn);
},
diff --git a/erpnext/hr/doctype/expense_claim/expense_claim.json b/erpnext/hr/doctype/expense_claim/expense_claim.json
index 007e646..409bdc8 100644
--- a/erpnext/hr/doctype/expense_claim/expense_claim.json
+++ b/erpnext/hr/doctype/expense_claim/expense_claim.json
@@ -13,20 +13,21 @@
"column_break_5",
"expense_approver",
"approval_status",
- "total_claimed_amount",
- "total_sanctioned_amount",
"is_paid",
"expense_details",
"expenses",
"sb1",
"taxes",
- "net_total",
+ "transactions_section",
+ "total_tax_amount",
+ "total_amount_reimbursed",
+ "total_sanctioned_amount",
+ "total_claimed_amount",
"section_break_16",
"posting_date",
"vehicle_log",
"task",
"cb1",
- "total_amount_reimbursed",
"remark",
"title",
"email_id",
@@ -331,16 +332,22 @@
"fieldtype": "Section Break"
},
{
- "fieldname": "net_total",
+ "fieldname": "transactions_section",
+ "fieldtype": "Section Break",
+ "label": "Transactions"
+ },
+ {
+ "fieldname": "total_tax_amount",
"fieldtype": "Currency",
- "label": "Net Total",
+ "label": "Total Tax Amount",
+ "options": "Company:company:default_currency",
"read_only": 1
}
],
"icon": "fa fa-money",
"idx": 1,
"is_submittable": 1,
- "modified": "2019-06-11 13:21:42.386420",
+ "modified": "2019-06-12 12:32:13.775009",
"modified_by": "Administrator",
"module": "HR",
"name": "Expense Claim",
diff --git a/erpnext/hr/doctype/expense_claim/expense_claim.py b/erpnext/hr/doctype/expense_claim/expense_claim.py
index c5b6ebe..07e7119 100644
--- a/erpnext/hr/doctype/expense_claim/expense_claim.py
+++ b/erpnext/hr/doctype/expense_claim/expense_claim.py
@@ -172,11 +172,11 @@
})
)
- gl_entry = self.make_tax_gl_entries(gl_entry)
+ self.add_tax_gl_entries(gl_entry)
return gl_entry
- def make_tax_gl_entries(self, gl_entries):
+ def add_tax_gl_entries(self, gl_entries):
# tax table gl entries
for tax in self.get("taxes"):
account_currency = get_account_currency(tax.account_head)
@@ -190,7 +190,6 @@
"against_voucher": self.name
}, account_currency)
)
- return gl_entries
def validate_account_details(self):
if not self.cost_center:
@@ -210,7 +209,7 @@
if self.approval_status == 'Rejected':
d.sanctioned_amount = 0.0
- self.total_claimed_amount += flt(d.claim_amount)
+ self.total_claimed_amount += flt(d.amount)
self.total_sanctioned_amount += flt(d.sanctioned_amount)
def calculate_taxes(self):
@@ -253,7 +252,7 @@
def validate_sanctioned_amount(self):
for d in self.get('expenses'):
- if flt(d.sanctioned_amount) > flt(d.claim_amount):
+ if flt(d.sanctioned_amount) > flt(d.amount):
frappe.throw(_("Sanctioned Amount cannot be greater than Claim Amount in Row {0}.").format(d.idx))
def set_expense_account(self, validate=False):
diff --git a/erpnext/hr/doctype/expense_claim/test_expense_claim.js b/erpnext/hr/doctype/expense_claim/test_expense_claim.js
index 070474e..d0c43d3 100644
--- a/erpnext/hr/doctype/expense_claim/test_expense_claim.js
+++ b/erpnext/hr/doctype/expense_claim/test_expense_claim.js
@@ -17,7 +17,7 @@
d.expense_date = '2017-08-01',
d.expense_type = 'Test Expense Type 1',
d.description = 'This is just to test Expense Claim',
- d.claim_amount = 2000,
+ d.amount = 2000,
d.sanctioned_amount=2000,
refresh_field('expenses');
},
diff --git a/erpnext/hr/doctype/expense_claim/test_expense_claim.py b/erpnext/hr/doctype/expense_claim/test_expense_claim.py
index 075bc63..6fc2a83 100644
--- a/erpnext/hr/doctype/expense_claim/test_expense_claim.py
+++ b/erpnext/hr/doctype/expense_claim/test_expense_claim.py
@@ -89,7 +89,7 @@
"payable_account": payable_account,
"approval_status": "Rejected",
"expenses":
- [{ "expense_type": "Travel", "default_account": "Travel Expenses - WP", "claim_amount": 300, "sanctioned_amount": 200 }]
+ [{ "expense_type": "Travel", "default_account": "Travel Expenses - WP", "amount": 300, "sanctioned_amount": 200 }]
})
expense_claim.submit()
@@ -102,7 +102,7 @@
def get_payable_account(company):
return frappe.get_cached_value('Company', company, 'default_payable_account')
-def make_expense_claim(payable_account,claim_amount, sanctioned_amount, company, account, project=None, task_name=None):
+def make_expense_claim(payable_account,amount, sanctioned_amount, company, account, project=None, task_name=None):
expense_claim = frappe.get_doc({
"doctype": "Expense Claim",
"employee": "_T-Employee-00001",
@@ -110,7 +110,7 @@
"approval_status": "Approved",
"company": company,
"expenses":
- [{ "expense_type": "Travel", "default_account": account, "claim_amount": claim_amount, "sanctioned_amount": sanctioned_amount }]
+ [{ "expense_type": "Travel", "default_account": account, "amount": amount, "sanctioned_amount": sanctioned_amount }]
})
if project:
expense_claim.project = project
diff --git a/erpnext/hr/doctype/expense_claim_detail/expense_claim_detail.json b/erpnext/hr/doctype/expense_claim_detail/expense_claim_detail.json
index d4e7057..b23fb6a 100644
--- a/erpnext/hr/doctype/expense_claim_detail/expense_claim_detail.json
+++ b/erpnext/hr/doctype/expense_claim_detail/expense_claim_detail.json
@@ -253,7 +253,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
- "fieldname": "claim_amount",
+ "fieldname": "amount",
"fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
@@ -262,7 +262,7 @@
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
- "label": "Claim Amount",
+ "label": "Amount",
"length": 0,
"no_copy": 0,
"oldfieldname": "claim_amount",
@@ -360,7 +360,7 @@
"issingle": 0,
"istable": 1,
"max_attachments": 0,
- "modified": "2019-02-24 08:41:36.122565",
+ "modified": "2019-06-10 08:41:36.122565",
"modified_by": "Administrator",
"module": "HR",
"name": "Expense Claim Detail",
diff --git a/erpnext/hr/doctype/vehicle_log/vehicle_log.py b/erpnext/hr/doctype/vehicle_log/vehicle_log.py
index ceea493..df63361 100644
--- a/erpnext/hr/doctype/vehicle_log/vehicle_log.py
+++ b/erpnext/hr/doctype/vehicle_log/vehicle_log.py
@@ -18,11 +18,11 @@
if (service_detail.service_item or service_detail.type or service_detail.frequency or service_detail.expense_amount):
if not (service_detail.service_item and service_detail.type and service_detail.frequency and service_detail.expense_amount):
frappe.throw(_("Service Item,Type,frequency and expense amount are required"))
-
+
def on_submit(self):
frappe.db.sql("update `tabVehicle` set last_odometer=%s where license_plate=%s",
(self.odometer, self.license_plate))
-
+
@frappe.whitelist()
def get_make_model(license_plate):
vehicle=frappe.get_doc("Vehicle",license_plate)
@@ -41,7 +41,7 @@
for serdetail in vehicle_log.service_detail:
total_exp_amt = total_exp_amt + serdetail.expense_amount
return total_exp_amt
-
+
vehicle_log = frappe.get_doc("Vehicle Log", docname)
exp_claim = frappe.new_doc("Expense Claim")
exp_claim.employee=vehicle_log.employee
@@ -52,6 +52,6 @@
exp_claim.append("expenses",{
"expense_date":vehicle_log.date,
"description":_("Vehicle Expenses"),
- "claim_amount":total_claim_amt
+ "amount":total_claim_amt
})
return exp_claim.as_dict()