Skip to Content
Menu
This question has been flagged
2 Replies
2513 Views

Hi,

I am trying to print a report.I have created a button by extending a field and defined it under models, and written the report xml.

I am getting this error while installing.


Odoo Server Error
Traceback (most recent call last):
  File "/home/viscar/odoo12/odoo/tools/convert.py", line 758, in parse
    self._tags[rec.tag](rec, de, mode=mode)
  File "/home/viscar/odoo12/odoo/tools/convert.py", line 736, in _tag_template
    return self._tag_record(record, data_node)
  File "/home/viscar/odoo12/odoo/tools/convert.py", line 584, in _tag_record
    self._test_xml_id(rec_id)
  File "/home/viscar/odoo12/odoo/tools/convert.py", line 259, in _test_xml_id
    assert modcnt == 1, """The ID "%s" refers to an uninstalled module""" % (xml_id,)
AssertionError: The ID "print_leaves.leave_template" refers to an uninstalled module

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/viscar/odoo12/odoo/http.py", line 656, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
  File "/home/viscar/odoo12/odoo/http.py", line 314, in _handle_exception
    raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])
  File "/home/viscar/odoo12/odoo/tools/pycompat.py", line 87, in reraise
    raise value
  File "/home/viscar/odoo12/odoo/http.py", line 698, in dispatch
    result = self._call_function(**self.params)
  File "/home/viscar/odoo12/odoo/http.py", line 346, in _call_function
    return checked_call(self.db, *args, **kwargs)
  File "/home/viscar/odoo12/odoo/service/model.py", line 97, in wrapper
    return f(dbname, *args, **kwargs)
  File "/home/viscar/odoo12/odoo/http.py", line 339, in checked_call
    result = self.endpoint(*a, **kw)
  File "/home/viscar/odoo12/odoo/http.py", line 941, in __call__
    return self.method(*args, **kw)
  File "/home/viscar/odoo12/odoo/http.py", line 519, in response_wrap
    response = f(*args, **kw)
  File "/home/viscar/odoo12/addons/web/controllers/main.py", line 966, in call_button
    action = self._call_kw(model, method, args, {})
  File "/home/viscar/odoo12/addons/web/controllers/main.py", line 954, in _call_kw
    return call_kw(request.env[model], method, args, kwargs)
  File "/home/viscar/odoo12/odoo/api.py", line 749, in call_kw
    return _call_kw_multi(method, model, args, kwargs)
  File "/home/viscar/odoo12/odoo/api.py", line 736, in _call_kw_multi
    result = method(recs, *args, **kwargs)
  File "<decorator-gen-67>", line 2, in button_immediate_upgrade
  File "/home/viscar/odoo12/odoo/addons/base/models/ir_module.py", line 74, in check_and_log
    return method(self, *args, **kwargs)
  File "/home/viscar/odoo12/odoo/addons/base/models/ir_module.py", line 622, in button_immediate_upgrade
    return self._button_immediate_function(type(self).button_upgrade)
  File "/home/viscar/odoo12/odoo/addons/base/models/ir_module.py", line 561, in _button_immediate_function
    modules.registry.Registry.new(self._cr.dbname, update_module=True)
  File "/home/viscar/odoo12/odoo/modules/registry.py", line 86, in new
    odoo.modules.load_modules(registry._db, force_demo, status, update_module)
  File "/home/viscar/odoo12/odoo/modules/loading.py", line 417, in load_modules
    force, status, report, loaded_modules, update_module, models_to_check)
  File "/home/viscar/odoo12/odoo/modules/loading.py", line 313, in load_marked_modules
    perform_checks=perform_checks, models_to_check=models_to_check
  File "/home/viscar/odoo12/odoo/modules/loading.py", line 222, in load_module_graph
    load_data(cr, idref, mode, kind='data', package=package, report=report)
  File "/home/viscar/odoo12/odoo/modules/loading.py", line 68, in load_data
    tools.convert_file(cr, package.name, filename, idref, mode, noupdate, kind, report)
  File "/home/viscar/odoo12/odoo/tools/convert.py", line 802, in convert_file
    convert_xml_import(cr, module, fp, idref, mode, noupdate, report)
  File "/home/viscar/odoo12/odoo/tools/convert.py", line 865, in convert_xml_import
    obj.parse(doc.getroot(), mode=mode)
  File "/home/viscar/odoo12/odoo/tools/convert.py", line 764, in parse
    exc_info[2]
  File "/home/viscar/odoo12/odoo/tools/pycompat.py", line 86, in reraise
    raise value.with_traceback(tb)
  File "/home/viscar/odoo12/odoo/tools/convert.py", line 758, in parse
    self._tags[rec.tag](rec, de, mode=mode)
  File "/home/viscar/odoo12/odoo/tools/convert.py", line 736, in _tag_template
    return self._tag_record(record, data_node)
  File "/home/viscar/odoo12/odoo/tools/convert.py", line 584, in _tag_record
    self._test_xml_id(rec_id)
  File "/home/viscar/odoo12/odoo/tools/convert.py", line 259, in _test_xml_id
    assert modcnt == 1, """The ID "%s" refers to an uninstalled module""" % (xml_id,)
odoo.tools.convert.ParseError: "The ID "print_leaves.leave_template" refers to an uninstalled module" while parsing None:11, near
<t t-name="print_leaves.leave_template">
            <t t-call="web.html_container">
                <t t-foreach="docs" t-as="o">
                    <t t-call="web.external_layout">
                        <div class="page">
                            <h2>Leave Report</h2>
                            <h3>Name:<span t-field="o.name"/></h3>
                        </div>
                    </t>
                </t>
            </t>
        </t>

Here is my button:

<?xml version="1.0" encoding="utf-8" ?><odoo>    <record id="hr_holidays.print_leaves_btn" model="ir.ui.view" inherit_id="hr_holidays.hr_leave_view_form_manager"/>        <xpath expr="//button[@string='Reset to Draft']" position="after">        <header>            <button name="print_leave" string="Print Leave" states="confirm" type="object">        </header>    </xpath></odoo>

Here is my button method:

@api.multidef print_leave(self):    return self.env.ref(print_leaves.print_leaves_report).report_action(self)

Here is my report. Where the error is occurring.

<?xml version="1.0"?>    <odoo>        <report            id="print_leaves_report"            model="print_leaves.moduletoprintfrom"            string="Leave Form"            report_type="qweb-html"            name="print_leaves.leave_template"            file = "file.nametoprint"        />        <template id="print_leaves.leave_template">            <t t-call="web.html_container">                <t t-foreach="docs" t-as="o">                    <t t-call="web.external_layout">                        <div class="page">                            <h2>Leave Report</h2>                            <h3>Name:<span t-field="o.name"/></h3>                        </div>                    </t>                </t>            </t>        </template></odoo>

Please help I am on odoo12.

Avatar
Discard
Best Answer

You are using "leave_template"  which is define in module print_leaves. Please install that module and add in depends as well in current module __manifest__.py file. Then it will work fine.


Avatar
Discard
Best Answer

Hi,

You have to make sure that the External ID you have given is correct. The error message says that in the code, somewhere you have referred an external ID "print_leaves.leave_template" in the code, the external id is module_name.id_of_record , so in your system/database odoo cant see a installed module with the print_leaves , so  make sure that if there is a module with this name has installed or ID's are given correctly.

Thanks

Avatar
Discard
Related Posts Replies Views Activity
2
Dec 23
12007
0
Oct 23
33
3
Oct 23
787
1
Oct 23
569
1
Aug 23
980