mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-26 16:34:46 +00:00
feat: add bank account in payroll entry (#19021)
* fix(journal-entry): change fieldname from bank account no to bank account * fix: add payroll entry in bank dashboard * fix: fetch account from bank account * fix: minor changes * patch: check for bank account no column before updating * fix: use rename field function
This commit is contained in:
committed by
Nabin Hait
parent
5888efbb4e
commit
a44e8afe71
@@ -9,12 +9,11 @@ def get_data():
|
|||||||
'non_standard_fieldnames': {
|
'non_standard_fieldnames': {
|
||||||
'Customer': 'default_bank_account',
|
'Customer': 'default_bank_account',
|
||||||
'Supplier': 'default_bank_account',
|
'Supplier': 'default_bank_account',
|
||||||
'Journal Entry': 'bank_account_no'
|
|
||||||
},
|
},
|
||||||
'transactions': [
|
'transactions': [
|
||||||
{
|
{
|
||||||
'label': _('Payments'),
|
'label': _('Payments'),
|
||||||
'items': ['Payment Entry', 'Payment Request', 'Payment Order']
|
'items': ['Payment Entry', 'Payment Request', 'Payment Order', 'Payroll Entry']
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'label': _('Party'),
|
'label': _('Party'),
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ frappe.provide("erpnext.journal_entry");
|
|||||||
|
|
||||||
frappe.ui.form.on("Journal Entry", {
|
frappe.ui.form.on("Journal Entry", {
|
||||||
setup: function(frm) {
|
setup: function(frm) {
|
||||||
frm.add_fetch("bank_account_no", "account", "account");
|
frm.add_fetch("bank_account", "account", "account");
|
||||||
},
|
},
|
||||||
|
|
||||||
refresh: function(frm) {
|
refresh: function(frm) {
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
"account_type",
|
"account_type",
|
||||||
"balance",
|
"balance",
|
||||||
"col_break1",
|
"col_break1",
|
||||||
"bank_account_no",
|
"bank_account",
|
||||||
"party_type",
|
"party_type",
|
||||||
"party",
|
"party",
|
||||||
"party_balance",
|
"party_balance",
|
||||||
@@ -89,12 +89,6 @@
|
|||||||
"fieldname": "col_break1",
|
"fieldname": "col_break1",
|
||||||
"fieldtype": "Column Break"
|
"fieldtype": "Column Break"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"fieldname": "bank_account_no",
|
|
||||||
"fieldtype": "Link",
|
|
||||||
"label": "Bank Account No",
|
|
||||||
"options": "Bank Account"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"fieldname": "party_type",
|
"fieldname": "party_type",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
@@ -266,11 +260,17 @@
|
|||||||
{
|
{
|
||||||
"fieldname": "dimension_col_break",
|
"fieldname": "dimension_col_break",
|
||||||
"fieldtype": "Column Break"
|
"fieldtype": "Column Break"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "bank_account",
|
||||||
|
"fieldtype": "Link",
|
||||||
|
"label": "Bank Account",
|
||||||
|
"options": "Bank Account"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"idx": 1,
|
"idx": 1,
|
||||||
"istable": 1,
|
"istable": 1,
|
||||||
"modified": "2019-07-16 17:12:08.238334",
|
"modified": "2019-09-12 12:16:17.588399",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Accounts",
|
"module": "Accounts",
|
||||||
"name": "Journal Entry Account",
|
"name": "Journal Entry Account",
|
||||||
|
|||||||
@@ -37,8 +37,9 @@
|
|||||||
"cost_center",
|
"cost_center",
|
||||||
"account",
|
"account",
|
||||||
"payment_account",
|
"payment_account",
|
||||||
"section_break2",
|
|
||||||
"amended_from",
|
"amended_from",
|
||||||
|
"column_break_33",
|
||||||
|
"bank_account",
|
||||||
"salary_slips_created",
|
"salary_slips_created",
|
||||||
"salary_slips_submitted"
|
"salary_slips_submitted"
|
||||||
],
|
],
|
||||||
@@ -206,15 +207,12 @@
|
|||||||
{
|
{
|
||||||
"allow_on_submit": 1,
|
"allow_on_submit": 1,
|
||||||
"description": "Select Payment Account to make Bank Entry",
|
"description": "Select Payment Account to make Bank Entry",
|
||||||
|
"fetch_from": "bank_account.account",
|
||||||
"fieldname": "payment_account",
|
"fieldname": "payment_account",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"label": "Payment Account",
|
"label": "Payment Account",
|
||||||
"options": "Account"
|
"options": "Account"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"fieldname": "section_break2",
|
|
||||||
"fieldtype": "Section Break"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"fieldname": "amended_from",
|
"fieldname": "amended_from",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
@@ -248,11 +246,21 @@
|
|||||||
{
|
{
|
||||||
"fieldname": "dimension_col_break",
|
"fieldname": "dimension_col_break",
|
||||||
"fieldtype": "Column Break"
|
"fieldtype": "Column Break"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "bank_account",
|
||||||
|
"fieldtype": "Link",
|
||||||
|
"label": "Bank Account",
|
||||||
|
"options": "Bank Account"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "column_break_33",
|
||||||
|
"fieldtype": "Column Break"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"icon": "fa fa-cog",
|
"icon": "fa fa-cog",
|
||||||
"is_submittable": 1,
|
"is_submittable": 1,
|
||||||
"modified": "2019-05-25 22:47:49.977955",
|
"modified": "2019-09-12 15:46:31.436381",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "HR",
|
"module": "HR",
|
||||||
"name": "Payroll Entry",
|
"name": "Payroll Entry",
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ class PayrollEntry(Document):
|
|||||||
and for which salary structure exists
|
and for which salary structure exists
|
||||||
"""
|
"""
|
||||||
cond = self.get_filter_condition()
|
cond = self.get_filter_condition()
|
||||||
cond += self.get_joining_releiving_condition()
|
cond += self.get_joining_relieving_condition()
|
||||||
|
|
||||||
condition = ''
|
condition = ''
|
||||||
if self.payroll_frequency:
|
if self.payroll_frequency:
|
||||||
@@ -93,7 +93,7 @@ class PayrollEntry(Document):
|
|||||||
|
|
||||||
return cond
|
return cond
|
||||||
|
|
||||||
def get_joining_releiving_condition(self):
|
def get_joining_relieving_condition(self):
|
||||||
cond = """
|
cond = """
|
||||||
and ifnull(t1.date_of_joining, '0000-00-00') <= '%(end_date)s'
|
and ifnull(t1.date_of_joining, '0000-00-00') <= '%(end_date)s'
|
||||||
and ifnull(t1.relieving_date, '2199-12-31') >= '%(start_date)s'
|
and ifnull(t1.relieving_date, '2199-12-31') >= '%(start_date)s'
|
||||||
@@ -341,6 +341,7 @@ class PayrollEntry(Document):
|
|||||||
journal_entry.set("accounts", [
|
journal_entry.set("accounts", [
|
||||||
{
|
{
|
||||||
"account": self.payment_account,
|
"account": self.payment_account,
|
||||||
|
"bank_account": self.bank_account,
|
||||||
"credit_in_account_currency": payment_amount
|
"credit_in_account_currency": payment_amount
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -635,4 +635,5 @@ erpnext.patches.v12_0.remove_bank_remittance_custom_fields
|
|||||||
erpnext.patches.v12_0.generate_leave_ledger_entries
|
erpnext.patches.v12_0.generate_leave_ledger_entries
|
||||||
erpnext.patches.v12_0.move_credit_limit_to_customer_credit_limit
|
erpnext.patches.v12_0.move_credit_limit_to_customer_credit_limit
|
||||||
erpnext.patches.v12_0.add_variant_of_in_item_attribute_table
|
erpnext.patches.v12_0.add_variant_of_in_item_attribute_table
|
||||||
erpnext.patches.v12_0.create_default_energy_point_rules
|
erpnext.patches.v12_0.rename_bank_account_field_in_journal_entry_account
|
||||||
|
erpnext.patches.v12_0.create_default_energy_point_rules
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
# Copyright (c) 2019, Frappe and Contributors
|
||||||
|
# License: GNU General Public License v3. See license.txt
|
||||||
|
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
import frappe
|
||||||
|
from frappe.model.utils.rename_field import rename_field
|
||||||
|
|
||||||
|
def execute():
|
||||||
|
''' Change the fieldname from bank_account_no to bank_account '''
|
||||||
|
if not frappe.get_meta("Journal Entry Account").has_field("bank_account"):
|
||||||
|
frappe.reload_doc("Accounts", "doctype", "Journal Entry Account")
|
||||||
|
update_journal_entry_account_fieldname()
|
||||||
|
|
||||||
|
def update_journal_entry_account_fieldname():
|
||||||
|
''' maps data from old field to the new field '''
|
||||||
|
if frappe.db.has_column('Journal Entry Account', 'bank_account_no'):
|
||||||
|
rename_field("Journal Entry Account", "bank_account_no", "bank_account")
|
||||||
Reference in New Issue
Block a user