fix: add validation for duplication

This commit is contained in:
l0gesh29
2026-01-09 17:43:55 +05:30
parent 50f73a5072
commit cda8a97f4a

View File

@@ -885,6 +885,16 @@ class SalesInvoice(SellingController):
if status not in ["Submitted", "Payslip", "Partially Billed"]:
frappe.throw(_("Timesheet {0} is already completed or cancelled").format(data.time_sheet))
if data.time_sheet and data.timesheet_detail:
if sales_invoice := frappe.db.get_value(
"Timesheet Detail", data.timesheet_detail, "sales_invoice"
):
frappe.throw(
_("Row {0}: Sales Invoice {1} is already created for {2}").format(
data.idx, frappe.bold(sales_invoice), frappe.bold(data.time_sheet)
)
)
def set_pos_fields(self, for_validate=False):
"""Set retail related fields from POS Profiles"""
if cint(self.is_pos) != 1: