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 #669

X-original-commit: 98cdc52
Signed-off-by: Ignacio Cainelli <ica@adhoc.com.ar>
Signed-off-by: Katherine Zaoral <kz@adhoc.com.ar>
  • Loading branch information
zaoral committed Jan 17, 2023
1 parent 37fef50 commit 5485c73
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions l10n_ar_account_withholding/models/res_company.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,23 +148,35 @@ 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:
self._process_message_error(ws)

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:
# raise UserError('No pudimos obtener la AlicuotaRetencion')
Expand All @@ -184,7 +196,6 @@ def get_arba_data(self, partner, from_date, to_date):
_logger.info('We get the following data: \n%s' % data)
return data


def get_cordoba_data(self, partner, date):
""" Obtener alícuotas desde app.rentascordoba.gob.ar
:param partner: El partner sobre el cual trabajamos
Expand Down Expand Up @@ -248,4 +259,4 @@ def get_cordoba_data(self, partner, date):
def _process_message_error(self, ws):
message = ws.MensajeError
message = message.replace('<![CDATA[', '').replace(']]/>','')
raise UserError(_('No se pudo conectar a ARBA: %s - %s') % (ws.CodigoError, message))
raise UserError(_('Padron ARBA: %s - %s (%s)') % (ws.CodigoError, message, ws.TipoError))

0 comments on commit 5485c73

Please sign in to comment.