[fix] Not able to cancel the invoice if it's linked with the timesheet (#9157)

This commit is contained in:
rohitwaghchaure 2017-06-07 11:52:04 +05:30 committed by Nabin Hait
parent 2a0d650735
commit ce6e621c18

View File

@ -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: