fix(l10n.mx.facturae): se agrega un punto de guardado

se agrega un punto de guardado, en caso de que alguna de las facturas presente un error de
cancelación las anteriores se cancelen excepto el del error y los iguientes a ello
parent b344876d
Pipeline #20142 passed with stage
in 34 seconds
......@@ -361,17 +361,34 @@ class AccountInvoice(models.Model):
"""Verify cancellation status"""
# TODO: Is this really needed? Maybe we can reuse the action_cancel
for account_invoice in self:
status_cancelacion = account_invoice.consult_cfdi_cancellation_status()
if status_cancelacion is None:
continue
elif status_cancelacion is False:
self.undo_waiting_state()
else:
try:
account_invoice.action_cancel()
except Exception as e:
_logger.info(e)
continue
try:
with self.env.cr.savepoint():
status_cancelacion = \
account_invoice.consult_cfdi_cancellation_status()
if status_cancelacion is None:
account_invoice.message_post(
body=_(
"No status update found on SAT"
)
)
elif status_cancelacion is False:
self.undo_waiting_state()
else:
try:
account_invoice.action_cancel()
except Exception as e:
account_invoice.message_post(
body=_(
"The invoice could not be canceled"
)
)
except Exception as e:
account_invoice.message_post(
body=_(
"Could not check SAT invoice status "
"due to the following error: %s."
) % (e)
)
@api.multi
def _validate_cfdi_data(self):
......
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