Cannot cancel Sales Invoice (linked with Timesheet)


I cannot cancel a Sales invoice because it is linked with timesheet.

I tried cancelling timesheet. I could not delete it as well, since it is linked with sales invoice. I tried replicating this errors on other projects and invoices… It works fine… only on this project i get this message.

what could be wrong? I am using erpnext version 7.

Hi @Noushad_Moidunny can you consider upgrading/updating ERPNext? It might have been a bug and may be solved in an update.


Updated to the latest version. Still problem exists.

Hi have you tried cancelling the timesheets mentioned above?

Hi again,

Am not sure, but is MyApp a custom app you have made?

Some unwell written apps (sorry for saying it) may effect other modules.

I think you need to test your app and installation to make sure of it.

Before you do anything, if you need the db please make a backup to ensure nothing wrong happens.

From what I remember, bench run-tests (or something like this, plz check bench --help) would give you any errors, but still am not sure.

I experienced this with old sales invoices that were done using the time log batch method, that were then changed to time sheets via patch when v7 came along. They are linked to each other and disallow cancellation of either

Dear All,

Please be so kind to let me know if finally someone could solve this problem. Now a days I have the same problem!

Do you need the timesheet linked with sales invoices?.
If you don’t you can avoid the action by commenting the lines self.update_timesheet_billing_for_project() AND self.update_time_sheet( in

Regarding the canceling of this especific invoice you need to ignore_links adding (self.flags.ignore_links = True) On def before_cancel(self) AND def on_cancel(self) in . This will ignore ALL links so I recommend to remove it after canceling the invoice

1 Like