diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py index 4b1837d4d73..ab49fc084b3 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py @@ -243,7 +243,6 @@ class SalesInvoice(SellingController): (not self.project and not data.sales_invoice) or \ (not sales_invoice and data.sales_invoice == self.name): data.sales_invoice = sales_invoice - if self.project: return def on_update(self): self.set_paid_amount() @@ -483,13 +482,14 @@ class SalesInvoice(SellingController): self.set('packed_items', []) def set_billing_hours_and_amount(self): - for timesheet in self.timesheets: - ts_doc = frappe.get_doc('Timesheet', timesheet.time_sheet) - if not timesheet.billing_hours and ts_doc.total_billable_hours: - timesheet.billing_hours = ts_doc.total_billable_hours + if not self.project: + for timesheet in self.timesheets: + ts_doc = frappe.get_doc('Timesheet', timesheet.time_sheet) + if not timesheet.billing_hours and ts_doc.total_billable_hours: + timesheet.billing_hours = ts_doc.total_billable_hours - if not timesheet.billing_amount and ts_doc.total_billable_amount: - timesheet.billing_amount = ts_doc.total_billable_amount + if not timesheet.billing_amount and ts_doc.total_billable_amount: + timesheet.billing_amount = ts_doc.total_billable_amount def update_timesheet_billing_for_project(self): if not self.timesheets and self.project: