ingadhoc / odoo-argentina

Una Localización Argentina de Odoo amigable
http://www.odooargentina.com
GNU Affero General Public License v3.0
106 stars 192 forks source link

Error al validar una factura de un cliente con pasaporte #303

Closed regaby closed 5 years ago

regaby commented 5 years ago

Versión afectada: 9.0 Tengo una implementación hecha en un hotel , donde a los clientes extranjeros se le ingresa el número de pasaporte en lugar del cuit. Al validar la factura (factura B para consumidor final o cliente del exterior) ocurre el siguiente error:

Odoo Server Error

Traceback (most recent call last):
  File "/home/odoo/odoo-dev/odoo/openerp/http.py", line 650, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
  File "/home/odoo/odoo-dev/odoo/openerp/http.py", line 687, in dispatch
    result = self._call_function(**self.params)
  File "/home/odoo/odoo-dev/odoo/openerp/http.py", line 323, in _call_function
    return checked_call(self.db, *args, **kwargs)
  File "/home/odoo/odoo-dev/odoo/openerp/service/model.py", line 118, in wrapper
    return f(dbname, *args, **kwargs)
  File "/home/odoo/odoo-dev/odoo/openerp/http.py", line 316, in checked_call
    result = self.endpoint(*a, **kw)
  File "/home/odoo/odoo-dev/odoo/openerp/http.py", line 966, in __call__
    return self.method(*args, **kw)
  File "/home/odoo/odoo-dev/odoo/openerp/http.py", line 516, in response_wrap
    response = f(*args, **kw)
  File "/home/odoo/odoo-dev/odoo/addons/web/controllers/main.py", line 906, in exec_workflow
    return request.session.exec_workflow(model, id, signal)
  File "/home/odoo/odoo-dev/odoo/openerp/http.py", line 1274, in exec_workflow
    r = self.proxy('object').exec_workflow(self.db, self.uid, self.password, model, signal, id)
  File "/home/odoo/odoo-dev/odoo/openerp/http.py", line 1042, in proxy_method
    result = dispatch_rpc(self.service_name, method, args)
  File "/home/odoo/odoo-dev/odoo/openerp/http.py", line 115, in dispatch_rpc
    result = dispatch(method, params)
  File "/home/odoo/odoo-dev/odoo/openerp/service/model.py", line 37, in dispatch
    res = fn(db, uid, *params)
  File "/home/odoo/odoo-dev/odoo/openerp/service/model.py", line 118, in wrapper
    return f(dbname, *args, **kwargs)
  File "/home/odoo/odoo-dev/odoo/openerp/service/model.py", line 194, in exec_workflow
    return exec_workflow_cr(cr, uid, obj, signal, *args)
  File "/home/odoo/odoo-dev/odoo/openerp/service/model.py", line 188, in exec_workflow_cr
    return execute_cr(cr, uid, obj, 'signal_workflow', [res_id], signal)[res_id]
  File "/home/odoo/odoo-dev/odoo/openerp/service/model.py", line 170, in execute_cr
    return getattr(object, method)(cr, uid, *args, **kw)
  File "/home/odoo/odoo-dev/odoo/openerp/api.py", line 250, in wrapper
    return old_api(self, *args, **kwargs)
  File "/home/odoo/odoo-dev/odoo/openerp/models.py", line 3632, in signal_workflow
    result[res_id] = workflow.trg_validate(uid, self._name, res_id, signal, cr)
  File "/home/odoo/odoo-dev/odoo/openerp/workflow/__init__.py", line 67, in trg_validate
    return WorkflowService.new(cr, uid, res_type, res_id).validate(signal)
  File "/home/odoo/odoo-dev/odoo/openerp/workflow/service.py", line 73, in validate
    res2 = wi.validate(signal)
  File "/home/odoo/odoo-dev/odoo/openerp/workflow/instance.py", line 62, in validate
    wi.process(signal=signal, force_running=force_running, stack=stack)
  File "/home/odoo/odoo-dev/odoo/openerp/workflow/workitem.py", line 102, in process
    ok = self._split_test(activity['split_mode'], signal, stack)
  File "/home/odoo/odoo-dev/odoo/openerp/workflow/workitem.py", line 230, in _split_test
    self._join_test(t[0], t[1], stack)
  File "/home/odoo/odoo-dev/odoo/openerp/workflow/workitem.py", line 239, in _join_test
    WorkflowItem.create(self.session, self.record, activity, inst_id, stack=stack)
  File "/home/odoo/odoo-dev/odoo/openerp/workflow/workitem.py", line 77, in create
    workflow_item.process(stack=stack)
  File "/home/odoo/odoo-dev/odoo/openerp/workflow/workitem.py", line 98, in process
    if not self._execute(activity, stack):
  File "/home/odoo/odoo-dev/odoo/openerp/workflow/workitem.py", line 144, in _execute
    returned_action = self.wkf_expr_execute(activity)
  File "/home/odoo/odoo-dev/odoo/openerp/workflow/workitem.py", line 295, in wkf_expr_execute
    return self.wkf_expr_eval_expr(activity['action'])
  File "/home/odoo/odoo-dev/odoo/openerp/workflow/workitem.py", line 273, in wkf_expr_eval_expr
    result = eval(line, env, nocopy=True)
  File "/home/odoo/odoo-dev/odoo/openerp/tools/safe_eval.py", line 298, in safe_eval
    return eval(c, globals_dict, locals_dict)
  File "", line 1, in <module>
  File "/home/odoo/odoo-dev/odoo/openerp/api.py", line 248, in wrapper
    return new_api(self, *args, **kwargs)
  File "/home/odoo/odoo-dev/galup-addons/galup_hotel/model/res_partner.py", line 424, in invoice_validate
    return super(AccountInvoice, self).invoice_validate()
  File "/home/odoo/odoo-dev/odoo/openerp/api.py", line 248, in wrapper
    return new_api(self, *args, **kwargs)
  File "/home/odoo/odoo-dev/localizacion/ingadhoc-odoo-argentina/l10n_ar_afipws_fe/models/invoice.py", line 208, in invoice_validate
    self.do_pyafipws_request_cae()
  File "/home/odoo/odoo-dev/odoo/openerp/api.py", line 248, in wrapper
    return new_api(self, *args, **kwargs)
  File "/home/odoo/odoo-dev/localizacion/ingadhoc-odoo-argentina/l10n_ar_afipws_fe/models/invoice.py", line 427, in do_pyafipws_request_cae
    commercial_partner.main_id_number) or "0"
ValueError: "invalid literal for int() with base 10: 'FQ100087'" while evaluating
u'invoice_validate()'

Esto se debe a que el pasaporte contiene letras. Supongo que se puede solucionar si se quita el int() a main_id_number. En las facturas que realizan mediante la página de la afip pueden ingresar el número de pasaporte con letras sin problemas.

jjscarafia commented 5 years ago

Buenas @regaby . Gracias por reportar. Ya no estamos trabajando sobre v9 pero si aceptamos un PR para arreglarlo. Igualmente vamos a ver si podemos arreglarlo en v11 y hacer el backport facilmente a v9. @nicomacr podrás ver esto?

nicomacr commented 5 years ago

@jjscarafia aca hice el PR de #304

jjscarafia commented 5 years ago

Cerrado en https://github.com/ingadhoc/odoo-argentina/pull/304