From 43d1d685c63ec8129fe02133cc2f19821f4cd093 Mon Sep 17 00:00:00 2001 From: Logesh Periyasamy Date: Fri, 9 Jan 2026 18:11:42 +0530 Subject: [PATCH] fix: add validation for amount and hours Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --- erpnext/accounts/doctype/sales_invoice/sales_invoice.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py index 2e292fc79d7..a61717040a7 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py @@ -348,8 +348,10 @@ class SalesInvoice(SellingController): if self.is_return and self.return_against: for row in self.timesheets: - row.billing_hours *= -1 - row.billing_amount *= -1 + if row.billing_hours > 0: + row.billing_hours *= -1 + if row.billing_amount > 0: + row.billing_amount *= -1 self.update_packing_list() self.set_billing_hours_and_amount()