Update project_invoice.py

This commit is contained in:
zainab2097 2024-09-03 14:04:43 +03:00 committed by GitHub
parent c81dedd5b2
commit e3d5645b6b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 1 deletions

View File

@ -238,7 +238,8 @@ class ProjectInvoice(models.Model):
self.invoice_id.sudo().unlink()
self.state = 'draft'
else:
raise UserError(_("Kindly The invoice is not in draft state, so it cannot be unlinked."))
if self.invoice_id:
raise UserError(_("Kindly The invoice is not in draft state, so it cannot be unlinked."))
def action_get_invoice(self):
self.ensure_one()