[FIX] account_asset_management: Display significant information about the error
As it was, the information put was like: ``` Error mientras se procesa el activo '....': <class 'odoo.exceptions.UserError'> ``` Now, it is: ``` Error mientras se procesa el activo '....': UserError("No puedes usar esta cuenta (...) en este diario, consulta la sección 'Control-Acceso' en la pestaña 'Configuración avanzada' en el diario relacionado.") ``` TT46362
This commit is contained in:
parent
73c8574227
commit
3221745c32
@ -1235,15 +1235,14 @@ class AccountAsset(models.Model):
|
|||||||
try:
|
try:
|
||||||
with self.env.cr.savepoint():
|
with self.env.cr.savepoint():
|
||||||
result += depreciation.create_move()
|
result += depreciation.create_move()
|
||||||
except Exception:
|
except Exception as e:
|
||||||
e = exc_info()[0]
|
|
||||||
tb = "".join(format_exception(*exc_info()))
|
tb = "".join(format_exception(*exc_info()))
|
||||||
asset_ref = depreciation.asset_id.name
|
asset_ref = depreciation.asset_id.name
|
||||||
if depreciation.asset_id.code:
|
if depreciation.asset_id.code:
|
||||||
asset_ref = "[{}] {}".format(depreciation.asset_id.code, asset_ref)
|
asset_ref = "[{}] {}".format(depreciation.asset_id.code, asset_ref)
|
||||||
error_log += _(
|
error_log += _(
|
||||||
"\nError while processing asset '{ref}': {exception}"
|
"\nError while processing asset '{ref}': {exception}"
|
||||||
).format(ref=asset_ref, exception=str(e))
|
).format(ref=asset_ref, exception=repr(e))
|
||||||
error_msg = _("Error while processing asset '{ref}': \n\n{tb}").format(
|
error_msg = _("Error while processing asset '{ref}': \n\n{tb}").format(
|
||||||
ref=asset_ref, tb=tb
|
ref=asset_ref, tb=tb
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user