From dd70fb5f7e4e430d8cb2e1cf610d119e77611551 Mon Sep 17 00:00:00 2001 From: Nihantra Patel Date: Thu, 29 Feb 2024 15:31:53 +0530 Subject: [PATCH] fix: skip timesheet link on return time --- erpnext/accounts/doctype/sales_invoice/sales_invoice.js | 2 +- erpnext/accounts/doctype/sales_invoice/sales_invoice.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js index ef1f6bd8d82..e03ed866478 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js @@ -486,7 +486,7 @@ erpnext.accounts.SalesInvoiceController = class SalesInvoiceController extends e currency() { var me = this; super.currency(); - if (this.frm.doc.timesheets) { + if (!this.frm.doc.is_return && this.frm.doc.timesheets) { this.frm.doc.timesheets.forEach((d) => { let row = frappe.get_doc(d.doctype, d.name) set_timesheet_detail_rate(row.doctype, row.name, me.frm.doc.currency, row.timesheet_detail) diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py index 3352e0d90ad..572a9f94493 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py @@ -757,6 +757,8 @@ class SalesInvoice(SellingController): def validate_time_sheets_are_submitted(self): for data in self.timesheets: if data.time_sheet: + if self.is_return: + continue status = frappe.db.get_value("Timesheet", data.time_sheet, "status") if status not in ["Submitted", "Payslip"]: frappe.throw(_("Timesheet {0} is already completed or cancelled").format(data.time_sheet))