Skip to content

Commit

Permalink
[IMP] l10n_ar_account_withholding: when to show help padron
Browse files Browse the repository at this point in the history
Si no pudimos obtener la informacion del padron arba mostramos el
error avisando que es un error de dicho padron y damos la opcion
al cliente de cargarlo manualmente

closes #665

Signed-off-by: Ignacio Cainelli <ica@adhoc.com.ar>
  • Loading branch information
zaoral committed Jan 17, 2023
1 parent a21cc2a commit b1996a3
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions l10n_ar_account_withholding/models/res_company.py
Expand Up @@ -146,23 +146,34 @@ def get_arba_data(self, partner, from_date, to_date):
to_date.strftime('%Y%m%d'),
cuit)

error = False
msg = False
if ws.Excepcion:
action = self.env.ref('l10n_ar_account_withholding.act_company_jurisdiction_padron')
raise RedirectWarning(_(
"Obtuvimos un error de conexión con ARBA y no encontramos padrón almacenado para las fechas dadas.\n"
"Puede intentar nuevamente más tarde, cargar la alícuota manualmente en el partner o subir el archivo del padrón en: "),
action.id, _('Ir a Carga de Padrones'))
# raise UserError("%s\nExcepcion: %s" % (ws.Traceback, ws.Excepcion))
error = True
msg = str((ws.Traceback, ws.Excepcion))
_logger.error('Padron ARBA: Excepcion %s' % msg)

# ' Hubo error general de ARBA?
if ws.CodigoError:
if ws.CodigoError == '11':
# we still create the record so we don need to check it again
# on same period
_logger.info('CUIT %s not present on padron ARBA' % cuit)
if ws.CodigoError == '6':
error = True
msg = "%s\n Error %s: %s" % (ws.MensajeError, ws.TipoError, ws.CodigoError)
_logger.error('Padron ARBA: %s' % msg)
else:
raise UserError("%s\nError %s: %s" % (
ws.MensajeError, ws.TipoError, ws.CodigoError))
raise UserError("Padron ARBA: %s\nError %s: %s" % (ws.MensajeError, ws.TipoError, ws.CodigoError))

if error:
action = self.env.ref('l10n_ar_account_withholding.act_company_jurisdiction_padron')
raise RedirectWarning(_(
"Obtuvimos un error al consultar el Padron ARBA.\n %s\n\n"
"Tiene las siguientes opciones:\n 1) Intentar nuevamente más tarde\n"
" 2) Cargar la alícuota manualmente en el partner en cuestión\n"
" 3) Subir el archivo del padrón utilizando el asistente de Carga de Padrones") % msg,
action.id, _('Ir a Carga de Padrones'))

# no ponemos esto, si no viene alicuota es porque es cero entonces
# if not ws.AlicuotaRetencion or not ws.AlicuotaPercepcion:
Expand Down

0 comments on commit b1996a3

Please sign in to comment.