From ce421bb1d47628c202879341a4e2288c9c10e96b 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> (cherry picked from commit 43d1d685c63ec8129fe02133cc2f19821f4cd093) --- 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 6f6fd853375..45791a66083 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py @@ -360,8 +360,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()