Skip to Content
Menu
This question has been flagged
1 Reply
1295 Views

good afternoon,

these referring to a model, but it indicates that the id does not exist in the system, I verify and it exists. (name shown in description) which may be wrong, please restart services several times.

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/odoo/tools/cache.py", line 84, in lookup
    r = d[key]
  File "/usr/lib/python3/dist-packages/odoo/tools/func.py", line 68, in wrapper
    return func(self, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/odoo/tools/lru.py", line 44, in __getitem__
    a = self.d[obj].me
KeyError: ('ir.model.data', <function IrModelData.xmlid_lookup at 0x7f2841d4d378>, 'report_comprobantes_efact.wizard.comprobantes.detalle')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 651, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 310, in _handle_exception
    raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])
  File "/usr/lib/python3/dist-packages/odoo/tools/pycompat.py", line 87, in reraise
    raise value
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 693, in dispatch
    result = self._call_function(**self.params)
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 342, in _call_function
    return checked_call(self.db, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/odoo/service/model.py", line 97, in wrapper
    return f(dbname, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 335, in checked_call
    result = self.endpoint(*a, **kw)
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 937, in __call__
    return self.method(*args, **kw)
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 515, in response_wrap
    response = f(*args, **kw)
  File "/usr/lib/python3/dist-packages/odoo/addons/web/controllers/main.py", line 938, in call_button
    action = self._call_kw(model, method, args, {})
  File "/usr/lib/python3/dist-packages/odoo/addons/web/controllers/main.py", line 926, in _call_kw
    return call_kw(request.env[model], method, args, kwargs)
  File "/usr/lib/python3/dist-packages/odoo/api.py", line 689, in call_kw
    return call_kw_multi(method, model, args, kwargs)
  File "/usr/lib/python3/dist-packages/odoo/api.py", line 680, in call_kw_multi
    result = method(recs, *args, **kwargs)
  File "/mnt/extra-addons/report_comprobantes_efact/models/invoice_line_con_formato.py", line 34, in imprimir
    self.env.ref('report_comprobantes_efact.wizard.comprobantes.detalle')._sql_get_line_for_report(self.fecha_inicio,self.fecha_fin)
  File "/usr/lib/python3/dist-packages/odoo/api.py", line 794, in ref
    return self['ir.model.data'].xmlid_to_object(xml_id, raise_if_not_found=raise_if_not_found)
  File "/usr/lib/python3/dist-packages/odoo/addons/base/ir/ir_model.py", line 1359, in xmlid_to_object
    t = self.xmlid_to_res_model_res_id(xmlid, raise_if_not_found)
  File "/usr/lib/python3/dist-packages/odoo/addons/base/ir/ir_model.py", line 1343, in xmlid_to_res_model_res_id
    return self.xmlid_lookup(xmlid)[1:3]
  File "<decorator-gen-21>", line 2, in xmlid_lookup
  File "/usr/lib/python3/dist-packages/odoo/tools/cache.py", line 89, in lookup
    value = d[key] = self.method(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/odoo/addons/base/ir/ir_model.py", line 1332, in xmlid_lookup
    raise ValueError('External ID not found in the system: %s' % xmlid)
ValueError: External ID not found in the system: report_comprobantes_efact.wizard.comprobantes.detalle

class WizardInvoiceLineReport(models.TransientModel):

    _name = 'wizard.comprobantes.detalle.formato'


    fecha_inicio = fields.Date("Fecha de Inicio")

    fecha_fin = fields.Date("Fecha Fin")

    report_object_ids =fields.One2many('report_comprobantes_efact.wizard.comprobantes.detalle','report_id')


    def imprimir(self):   self.env.ref('report_comprobantes_efact.wizard.comprobantes.detalle')._get_line(self.fecha_inicio,self.fecha_fin)       


class WizardInvoiceDetalleReport(models.TransientModel):

    _name = 'report_comprobantes_efact.wizard.comprobantes.detalle'


    report_id=fields.Many2one('wizard.comprobantes.detalle.formato')

    number=fields.Char("Numero")

    

    def _get_line(self,fecha_inicio,fecha_fin):

        return True

Avatar
Discard
Best Answer

Hi,

Inside the ref you can call only the records defined in the XML , if you are looking to call a function inside the model, call it like this,

 self.env['report_comprobantes_efact.wizard.comprobantes.detalle']._get_line(self.fecha_inicio,self.fecha_fin)  

Try the above instead of self.env.ref and see,


Thanks

Avatar
Discard