Update project_invoice.py
This commit is contained in:
parent
e3d5645b6b
commit
421aad80b4
|
|
@ -233,13 +233,13 @@ class ProjectInvoice(models.Model):
|
|||
|
||||
def action_set_to_draft(self):
|
||||
self.ensure_one()
|
||||
if self.invoice_id and self.invoice_id.state=='draft':
|
||||
if self.invoice_id and self.invoice_id.state!='draft':
|
||||
raise UserError(_("Kindly The invoice is not in draft state, so it cannot be unlinked."))
|
||||
|
||||
if self.invoice_id:
|
||||
self.invoice_id.sudo().write({'posted_before':False})
|
||||
self.invoice_id.sudo().unlink()
|
||||
self.state = 'draft'
|
||||
else:
|
||||
if self.invoice_id:
|
||||
raise UserError(_("Kindly The invoice is not in draft state, so it cannot be unlinked."))
|
||||
self.state = 'draft'
|
||||
|
||||
def action_get_invoice(self):
|
||||
self.ensure_one()
|
||||
|
|
|
|||
Loading…
Reference in New Issue