Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: release v15 #1347

Merged
merged 7 commits into from
Jan 24, 2024
Merged
2 changes: 1 addition & 1 deletion .github/workflows/on_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: 18
node-version: 20
- name: Setup dependencies
run: |
npm install @semantic-release/git @semantic-release/exec --no-save
Expand Down
8 changes: 8 additions & 0 deletions frontend/src/views/Profile.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,19 @@
</header>

<div class="flex flex-col items-center mt-5 p-4">
<!-- Profile Image -->
<img
v-if="user.data.user_image"
class="h-24 w-24 rounded-full object-cover"
:src="user.data.user_image"
:alt="user.data.first_name"
/>
<div
v-else
class="flex items-center justify-center bg-gray-200 uppercase text-gray-600 h-24 w-24 rounded-full object-cover"
>
{{ user.data.first_name[0] }}
</div>

<div class="flex flex-col gap-1.5 items-center mt-2 mb-5">
<span v-if="employee" class="text-lg font-bold text-gray-900">{{
Expand Down
9 changes: 7 additions & 2 deletions hrms/hr/doctype/employee_advance/employee_advance.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,18 @@ def set_total_advance_paid(self):
if return_amount != 0:
return_amount = flt(return_amount) / flt(self.exchange_rate)

if flt(paid_amount) > self.advance_amount:
precision = self.precision("paid_amount")
paid_amount = flt(paid_amount, precision)
if paid_amount > flt(self.advance_amount, precision):
frappe.throw(
_("Row {0}# Paid Amount cannot be greater than requested advance amount"),
EmployeeAdvanceOverPayment,
)

if flt(return_amount) > 0 and flt(return_amount) > (self.paid_amount - self.claimed_amount):
precision = self.precision("return_amount")
return_amount = flt(return_amount, precision)

if return_amount > 0 and return_amount > flt(self.paid_amount - self.claimed_amount, precision):
frappe.throw(_("Return amount cannot be greater than unclaimed amount"))

self.db_set("paid_amount", paid_amount)
Expand Down
39 changes: 39 additions & 0 deletions hrms/hr/doctype/employee_advance/test_employee_advance.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,45 @@ def test_payment_entry_against_advance(self):
self.assertEqual(advance.status, "Unpaid")
self.assertEqual(advance.paid_amount, 700)

def test_precision(self):
employee_name = make_employee("[email protected]")
advance = make_employee_advance(employee_name)
journal_entry = make_journal_entry_for_advance(advance)
journal_entry.submit()

# PARTLY CLAIMED AND RETURNED
payable_account = get_payable_account("_Test Company")
claim = make_expense_claim(
payable_account, 650.35, 619.34, "_Test Company", "Travel Expenses - _TC", do_not_submit=True
)

claim = get_advances_for_claim(claim, advance.name, amount=619.34)
claim.save()
claim.submit()

advance.reload()
self.assertEqual(advance.status, "Paid")

entry = make_return_entry(
employee=advance.employee,
company=advance.company,
employee_advance_name=advance.name,
return_amount=advance.paid_amount - advance.claimed_amount,
advance_account=advance.advance_account,
mode_of_payment=advance.mode_of_payment,
currency=advance.currency,
exchange_rate=advance.exchange_rate,
)

entry = frappe.get_doc(entry)
entry.insert()
entry.submit()

advance.reload()
# precision is respected
self.assertEqual(advance.return_amount, 380.66)
self.assertEqual(advance.status, "Partly Claimed and Returned")


def make_journal_entry_for_advance(advance):
journal_entry = frappe.get_doc(make_bank_entry("Employee Advance", advance.name))
Expand Down
3 changes: 3 additions & 0 deletions hrms/hr/doctype/expense_claim/expense_claim_list.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
frappe.listview_settings["Expense Claim"] = {
add_fields: ["company"]
}
2 changes: 2 additions & 0 deletions hrms/payroll/doctype/payroll_entry/payroll_entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ frappe.ui.form.on('Payroll Entry', {
},

refresh: function (frm) {
if (frm.doc.status === "Queued") frm.page.btn_secondary.hide()

if (frm.doc.docstatus === 0 && !frm.is_new()) {
frm.page.clear_primary_action();
frm.add_custom_button(__("Get Employees"),
Expand Down
Loading