diff --git a/erpnext/non_profit/doctype/member/member.js b/erpnext/non_profit/doctype/member/member.js index 6462939ead2..f72d4d958b9 100644 --- a/erpnext/non_profit/doctype/member/member.js +++ b/erpnext/non_profit/doctype/member/member.js @@ -27,7 +27,7 @@ frappe.ui.form.on('Member', { frappe.set_route('query-report', 'General Ledger', {party_type: 'Member', party: frm.doc.name}); } }); - + if (frm.doc.customer) { frm.add_custom_button(__('Accounts Receivable'), function() { frappe.set_route('query-report', 'Accounts Receivable', {customer: frm.doc.customer}); diff --git a/erpnext/payroll/doctype/salary_slip/salary_slip.py b/erpnext/payroll/doctype/salary_slip/salary_slip.py index f652125337b..dedc880da60 100644 --- a/erpnext/payroll/doctype/salary_slip/salary_slip.py +++ b/erpnext/payroll/doctype/salary_slip/salary_slip.py @@ -623,7 +623,14 @@ class SalarySlip(TransactionBase): def add_structure_components(self, component_type): data = self.get_data_for_eval() + timesheet_component = frappe.db.get_value( + "Salary Structure", self.salary_structure, "salary_component" + ) + for struct_row in self._salary_structure_doc.get(component_type): + if self.salary_slip_based_on_timesheet and struct_row.salary_component == timesheet_component: + continue + amount = self.eval_condition_and_formula(struct_row, data) if amount is not None and struct_row.statistical_component == 0: self.update_component_row(struct_row, amount, component_type, data=data) diff --git a/erpnext/payroll/doctype/salary_structure/salary_structure.py b/erpnext/payroll/doctype/salary_structure/salary_structure.py index bebf0303798..caf9d9bb7c8 100644 --- a/erpnext/payroll/doctype/salary_structure/salary_structure.py +++ b/erpnext/payroll/doctype/salary_structure/salary_structure.py @@ -20,6 +20,7 @@ class SalaryStructure(Document): self.validate_max_benefits_with_flexi() self.validate_component_based_on_tax_slab() self.validate_payment_days_based_dependent_component() + self.validate_timesheet_component() def set_missing_values(self): overwritten_fields = [ @@ -89,6 +90,21 @@ class SalaryStructure(Document): return abbr + def validate_timesheet_component(self): + if not self.salary_slip_based_on_timesheet: + return + + for component in self.earnings: + if component.salary_component == self.salary_component: + frappe.msgprint( + _( + "Row #{0}: Timesheet amount will overwrite the Earning component amount for the Salary Component {1}" + ).format(self.idx, frappe.bold(self.salary_component)), + title=_("Warning"), + indicator="orange", + ) + break + def strip_condition_and_formula_fields(self): # remove whitespaces from condition and formula fields for row in self.earnings: