mirror of
https://github.com/frappe/erpnext.git
synced 2026-02-12 17:23:38 +00:00
fix: add validation for direct return
This commit is contained in:
@@ -341,6 +341,9 @@ class SalesInvoice(SellingController):
|
||||
|
||||
self.set_against_income_account()
|
||||
|
||||
if self.is_return and not self.return_against and self.timesheets:
|
||||
frappe.throw(_("Direct return is not allowed for Timesheet."))
|
||||
|
||||
if not self.is_return:
|
||||
self.validate_time_sheets_are_submitted()
|
||||
|
||||
@@ -348,10 +351,10 @@ class SalesInvoice(SellingController):
|
||||
|
||||
if self.is_return and self.return_against:
|
||||
for row in self.timesheets:
|
||||
if row.billing_hours > 0:
|
||||
row.billing_hours *= -1
|
||||
if row.billing_amount > 0:
|
||||
row.billing_amount *= -1
|
||||
if row.billing_hours:
|
||||
row.billing_hours = -abs(row.billing_hours)
|
||||
if row.billing_amount:
|
||||
row.billing_amount = -abs(row.billing_amount)
|
||||
|
||||
self.update_packing_list()
|
||||
self.set_billing_hours_and_amount()
|
||||
|
||||
Reference in New Issue
Block a user