fix: skip timesheet on return time and revert code

This commit is contained in:
Nihantra Patel
2024-03-01 09:26:49 +05:30
parent a8eb5e5c85
commit 79c492cc4b
3 changed files with 3 additions and 4 deletions

View File

@@ -486,7 +486,7 @@ erpnext.accounts.SalesInvoiceController = class SalesInvoiceController extends e
currency() { currency() {
var me = this; var me = this;
super.currency(); super.currency();
if (!this.frm.doc.is_return && this.frm.doc.timesheets) { if (this.frm.doc.timesheets) {
this.frm.doc.timesheets.forEach((d) => { this.frm.doc.timesheets.forEach((d) => {
let row = frappe.get_doc(d.doctype, d.name) let row = frappe.get_doc(d.doctype, d.name)
set_timesheet_detail_rate(row.doctype, row.name, me.frm.doc.currency, row.timesheet_detail) set_timesheet_detail_rate(row.doctype, row.name, me.frm.doc.currency, row.timesheet_detail)

View File

@@ -785,6 +785,7 @@
"hide_days": 1, "hide_days": 1,
"hide_seconds": 1, "hide_seconds": 1,
"label": "Time Sheets", "label": "Time Sheets",
"no_copy": 1,
"options": "Sales Invoice Timesheet", "options": "Sales Invoice Timesheet",
"print_hide": 1 "print_hide": 1
}, },
@@ -2182,7 +2183,7 @@
"link_fieldname": "consolidated_invoice" "link_fieldname": "consolidated_invoice"
} }
], ],
"modified": "2024-01-02 17:25:46.027523", "modified": "2024-03-01 09:21:54.201289",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Sales Invoice", "name": "Sales Invoice",

View File

@@ -757,8 +757,6 @@ class SalesInvoice(SellingController):
def validate_time_sheets_are_submitted(self): def validate_time_sheets_are_submitted(self):
for data in self.timesheets: for data in self.timesheets:
if data.time_sheet: if data.time_sheet:
if self.is_return:
continue
status = frappe.db.get_value("Timesheet", data.time_sheet, "status") status = frappe.db.get_value("Timesheet", data.time_sheet, "status")
if status not in ["Submitted", "Payslip"]: if status not in ["Submitted", "Payslip"]:
frappe.throw(_("Timesheet {0} is already completed or cancelled").format(data.time_sheet)) frappe.throw(_("Timesheet {0} is already completed or cancelled").format(data.time_sheet))