mirror of
https://github.com/frappe/erpnext.git
synced 2026-03-15 00:06:22 +00:00
fix: merge conflict
This commit is contained in:
@@ -278,6 +278,7 @@
|
||||
"label": "More Details"
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 1,
|
||||
"default": "Draft",
|
||||
"fieldname": "status",
|
||||
"fieldtype": "Select",
|
||||
@@ -366,7 +367,8 @@
|
||||
"icon": "fa fa-money",
|
||||
"idx": 1,
|
||||
"is_submittable": 1,
|
||||
"modified": "2019-11-08 14:13:08.964547",
|
||||
"links": [],
|
||||
"modified": "2020-03-16 18:11:07.861985",
|
||||
"modified_by": "Administrator",
|
||||
"module": "HR",
|
||||
"name": "Expense Claim",
|
||||
|
||||
@@ -45,10 +45,10 @@ class ExpenseClaim(AccountsController):
|
||||
paid_amount = flt(self.total_amount_reimbursed) + flt(self.total_advance_amount)
|
||||
precision = self.precision("grand_total")
|
||||
if (self.is_paid or (flt(self.total_sanctioned_amount) > 0
|
||||
and flt(self.grand_total, precision) == flt(paid_amount, precision))) \
|
||||
and flt(flt(self.total_sanctioned_amount) + flt(self.total_taxes_and_charges), precision) == flt(paid_amount, precision))) \
|
||||
and self.docstatus == 1 and self.approval_status == 'Approved':
|
||||
self.status = "Paid"
|
||||
elif flt(self.total_sanctioned_amount) > 0 and self.docstatus == 1 and self.approval_status == 'Approved':
|
||||
elif flt(self.grand_total) > 0 and self.docstatus == 1 and self.approval_status == 'Approved':
|
||||
self.status = "Unpaid"
|
||||
elif self.docstatus == 1 and self.approval_status == 'Rejected':
|
||||
self.status = 'Rejected'
|
||||
|
||||
@@ -34,12 +34,14 @@ class TestExpenseClaim(unittest.TestCase):
|
||||
task_name = task.name
|
||||
payable_account = get_payable_account(company_name)
|
||||
|
||||
make_expense_claim(payable_account, 300, 200, company_name, "Travel Expenses - _TC4", "_Test Project 1", task_name)
|
||||
make_expense_claim(payable_account, 300, 200, company_name,
|
||||
"Travel Expenses - _TC4", "_Test Project 1", task_name, cost_center="Main - _TC4")
|
||||
|
||||
self.assertEqual(frappe.db.get_value("Task", task_name, "total_expense_claim"), 200)
|
||||
self.assertEqual(frappe.db.get_value("Project", "_Test Project 1", "total_expense_claim"), 200)
|
||||
|
||||
expense_claim2 = make_expense_claim(payable_account, 600, 500, company_name, "Travel Expenses - _TC4","_Test Project 1", task_name)
|
||||
expense_claim2 = make_expense_claim(payable_account, 600, 500, company_name,
|
||||
"Travel Expenses - _TC4","_Test Project 1", task_name, cost_center="Main - _TC4")
|
||||
|
||||
self.assertEqual(frappe.db.get_value("Task", task_name, "total_expense_claim"), 700)
|
||||
self.assertEqual(frappe.db.get_value("Project", "_Test Project 1", "total_expense_claim"), 700)
|
||||
@@ -51,7 +53,8 @@ class TestExpenseClaim(unittest.TestCase):
|
||||
|
||||
def test_expense_claim_status(self):
|
||||
payable_account = get_payable_account(company_name)
|
||||
expense_claim = make_expense_claim(payable_account, 300, 200, company_name, "Travel Expenses - _TC4")
|
||||
expense_claim = make_expense_claim(payable_account, 300, 200, company_name,
|
||||
"Travel Expenses - _TC4", cost_center="Main - _TC4")
|
||||
|
||||
je_dict = make_bank_entry("Expense Claim", expense_claim.name)
|
||||
je = frappe.get_doc(je_dict)
|
||||
@@ -70,7 +73,8 @@ class TestExpenseClaim(unittest.TestCase):
|
||||
def test_expense_claim_gl_entry(self):
|
||||
payable_account = get_payable_account(company_name)
|
||||
taxes = generate_taxes()
|
||||
expense_claim = make_expense_claim(payable_account, 300, 200, company_name, "Travel Expenses - _TC4", do_not_submit=True, taxes=taxes)
|
||||
expense_claim = make_expense_claim(payable_account, 300, 200, company_name,
|
||||
"Travel Expenses - _TC4", do_not_submit=True, taxes=taxes, cost_center="Main - _TC4")
|
||||
expense_claim.submit()
|
||||
|
||||
gl_entries = frappe.db.sql("""select account, debit, credit
|
||||
@@ -124,9 +128,10 @@ def generate_taxes():
|
||||
"total": 210
|
||||
}]}
|
||||
|
||||
def make_expense_claim(payable_account, amount, sanctioned_amount, company, account, project=None, task_name=None, do_not_submit=False, taxes=None):
|
||||
def make_expense_claim(payable_account, amount, sanctioned_amount, company, account,
|
||||
project=None, task_name=None, do_not_submit=False, taxes=None, cost_center=None):
|
||||
employee = frappe.db.get_value("Employee", {"status": "Active"})
|
||||
currency = frappe.db.get_value('Company', company, 'default_currency')
|
||||
currency, company_cost_center = frappe.db.get_value('Company', company, ['default_currency', 'cost_center'])
|
||||
expense_claim = {
|
||||
"doctype": "Expense Claim",
|
||||
"employee": employee,
|
||||
@@ -134,12 +139,15 @@ def make_expense_claim(payable_account, amount, sanctioned_amount, company, acco
|
||||
"approval_status": "Approved",
|
||||
"company": company,
|
||||
'currency': currency,
|
||||
"expenses":
|
||||
[{"expense_type": "Travel",
|
||||
"expenses": [{
|
||||
"expense_type": "Travel",
|
||||
"default_account": account,
|
||||
'currency': currency,
|
||||
"amount": amount,
|
||||
"sanctioned_amount": sanctioned_amount}]}
|
||||
"sanctioned_amount": sanctioned_amount,
|
||||
"cost_center": cost_center or company_cost_center
|
||||
}]
|
||||
}
|
||||
if taxes:
|
||||
expense_claim.update(taxes)
|
||||
|
||||
|
||||
@@ -655,3 +655,4 @@ erpnext.patches.v12_0.set_permission_einvoicing
|
||||
erpnext.patches.v12_0.set_received_qty_in_material_request_as_per_stock_uom
|
||||
erpnext.patches.v12_0.recalculate_requested_qty_in_bin
|
||||
erpnext.patches.v12_0.rename_mws_settings_fields
|
||||
erpnext.patches.v12_0.set_correct_status_for_expense_claim
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
# Copyright (c) 2020, Frappe and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
frappe.db.sql("""
|
||||
update `tabExpense Claim`
|
||||
set status = 'Paid'
|
||||
where total_advance_amount + total_amount_reimbursed = total_sanctioned_amount + total_taxes_and_charges
|
||||
""")
|
||||
Reference in New Issue
Block a user