Update project_invoice.py
This commit is contained in:
parent
e3d5645b6b
commit
421aad80b4
|
|
@ -233,14 +233,14 @@ class ProjectInvoice(models.Model):
|
||||||
|
|
||||||
def action_set_to_draft(self):
|
def action_set_to_draft(self):
|
||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
if self.invoice_id and self.invoice_id.state=='draft':
|
if self.invoice_id and self.invoice_id.state!='draft':
|
||||||
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."))
|
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'
|
||||||
|
|
||||||
def action_get_invoice(self):
|
def action_get_invoice(self):
|
||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
view_id = False
|
view_id = False
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue