Merge pull request #967 from expsa/project_test
Update project_invoice.py
This commit is contained in:
commit
918668246b
|
|
@ -233,8 +233,9 @@ class ProjectInvoice(models.Model):
|
|||
|
||||
def action_set_to_draft(self):
|
||||
self.ensure_one()
|
||||
if self.invoice_id.state=='draft':
|
||||
self.invoice_id.unlink()
|
||||
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:
|
||||
raise UserError(_("Kindly The invoice is not in draft state, so it cannot be unlinked."))
|
||||
|
|
|
|||
Loading…
Reference in New Issue