feat(account.invoice): se agrega el estado waiting

se extiende el campo state y se agrega ('waiting', 'To cancel')
parent 5d563d7b
......@@ -195,6 +195,8 @@ class AccountInvoice(models.Model):
'cfdi.relation.type', 'CFDI Relation type',
)
state = fields.Selection(selection_add=[('waiting', _('To cancel'))])
@api.one
@api.depends('state')
def _compute_datetime(self):
......@@ -214,7 +216,7 @@ class AccountInvoice(models.Model):
date_invoice=False, payment_term=False, partner_bank_id=False,
company_id=False, context=None,
):
# pylint: disable=too-many-arguments
# pylint: disable=too-many-arguments, redefined-builtin
"""Copy fields cfdi_use, payment_method_id and cfdi_adenda_id
from selected partner
"""
......@@ -278,13 +280,13 @@ class AccountInvoice(models.Model):
account_invoice.cfdi_folio_fiscal
):
cancelacion = account_invoice.cancel_cfdi()[0]
account_invoice.write({
'state': account_invoice.cfdi_state,
})
if cancelacion:
super(AccountInvoice, self).action_cancel()
res = super(AccountInvoice, self).action_cancel()
account_invoice.unlink_cfdi()
return
account_invoice.write({
'state':account_invoice.cfdi_state,
})
return res
@staticmethod
def _sanitize(text):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment