This question has been flagged
1 Reply
2242 Views

Hi team! 


I ran to the following error when trying to install the "Fleet Rental Management"

KeyError: ('ir.model.data', <function IrModelData.xmlid_lookup at 0x7f65bfa251e0>, 'fleet_rental.model_car_rental_contract')

I believe this should be part of the "Fleet Rental Management" addon? 

Would love to hear from someone that have successfully install this module. :) 


Installing with V13 and running in docker btw.. :) 


Below is the full snippet of the error message

Error:
Odoo Server Error

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/odoo/tools/cache.py", line 85, in lookup
    r = d[key]
  File "/usr/lib/python3/dist-packages/odoo/tools/func.py", line 69, 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 0x7f65bfa251e0>, 'fleet_rental.model_car_rental_contract')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/odoo/tools/convert.py", line 712, in parse
    self._tag_root(de)
  File "/usr/lib/python3/dist-packages/odoo/tools/convert.py", line 674, in _tag_root
    f(rec)
  File "/usr/lib/python3/dist-packages/odoo/tools/convert.py", line 674, in _tag_root
    f(rec)
  File "/usr/lib/python3/dist-packages/odoo/tools/convert.py", line 561, in _tag_record
    f_val = self.id_get(f_ref)
  File "/usr/lib/python3/dist-packages/odoo/tools/convert.py", line 657, in id_get
    res = self.model_id_get(id_str, raise_if_not_found)
  File "/usr/lib/python3/dist-packages/odoo/tools/convert.py", line 663, in model_id_get
    return self.env['ir.model.data'].xmlid_to_res_model_res_id(id_str, raise_if_not_found=raise_if_not_found)
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_model.py", line 1671, in xmlid_to_res_model_res_id
    return self.xmlid_lookup(xmlid)[1:3]
  File "<decorator-gen-24>", line 2, in xmlid_lookup
  File "/usr/lib/python3/dist-packages/odoo/tools/cache.py", line 90, in lookup
    value = d[key] = self.method(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_model.py", line 1660, in xmlid_lookup
    raise ValueError('External ID not found in the system: %s' % xmlid)
ValueError: External ID not found in the system: fleet_rental.model_car_rental_contract

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 624, 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 14, in reraise
    raise value
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 669, in dispatch
    result = self._call_function(**self.params)
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 350, in _call_function
    return checked_call(self.db, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/odoo/service/model.py", line 94, in wrapper
    return f(dbname, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 339, in checked_call
    result = self.endpoint(*a, **kw)
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 915, 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 1326, in call_button
    action = self._call_kw(model, method, args, kwargs)
  File "/usr/lib/python3/dist-packages/odoo/addons/web/controllers/main.py", line 1314, in _call_kw
    return call_kw(request.env[model], method, args, kwargs)
  File "/usr/lib/python3/dist-packages/odoo/api.py", line 387, in call_kw
    result = _call_kw_multi(method, model, args, kwargs)
  File "/usr/lib/python3/dist-packages/odoo/api.py", line 374, in _call_kw_multi
    result = method(recs, *args, **kwargs)
  File "<decorator-gen-59>", line 2, in button_immediate_install
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_module.py", line 72, in check_and_log
    return method(self, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_module.py", line 463, in button_immediate_install
    return self._button_immediate_function(type(self).button_install)
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_module.py", line 573, in _button_immediate_function
    modules.registry.Registry.new(self._cr.dbname, update_module=True)
  File "/usr/lib/python3/dist-packages/odoo/modules/registry.py", line 86, in new
    odoo.modules.load_modules(registry._db, force_demo, status, update_module)
  File "/usr/lib/python3/dist-packages/odoo/modules/loading.py", line 423, in load_modules
    loaded_modules, update_module, models_to_check)
  File "/usr/lib/python3/dist-packages/odoo/modules/loading.py", line 315, in load_marked_modules
    perform_checks=perform_checks, models_to_check=models_to_check
  File "/usr/lib/python3/dist-packages/odoo/modules/loading.py", line 225, in load_module_graph
    load_data(cr, idref, mode, kind='data', package=package, report=report)
  File "/usr/lib/python3/dist-packages/odoo/modules/loading.py", line 68, in load_data
    tools.convert_file(cr, package.name, filename, idref, mode, noupdate, kind, report)
  File "/usr/lib/python3/dist-packages/odoo/tools/convert.py", line 736, in convert_file
    convert_xml_import(cr, module, fp, idref, mode, noupdate, report)
  File "/usr/lib/python3/dist-packages/odoo/tools/convert.py", line 803, in convert_xml_import
    obj.parse(doc.getroot())
  File "/usr/lib/python3/dist-packages/odoo/tools/convert.py", line 721, in parse
    exc_info[2]
  File "/usr/lib/python3/dist-packages/odoo/tools/pycompat.py", line 13, in reraise
    raise value.with_traceback(tb)
  File "/usr/lib/python3/dist-packages/odoo/tools/convert.py", line 712, in parse
    self._tag_root(de)
  File "/usr/lib/python3/dist-packages/odoo/tools/convert.py", line 674, in _tag_root
    f(rec)
  File "/usr/lib/python3/dist-packages/odoo/tools/convert.py", line 674, in _tag_root
    f(rec)
  File "/usr/lib/python3/dist-packages/odoo/tools/convert.py", line 561, in _tag_record
    f_val = self.id_get(f_ref)
  File "/usr/lib/python3/dist-packages/odoo/tools/convert.py", line 657, in id_get
    res = self.model_id_get(id_str, raise_if_not_found)
  File "/usr/lib/python3/dist-packages/odoo/tools/convert.py", line 663, in model_id_get
    return self.env['ir.model.data'].xmlid_to_res_model_res_id(id_str, raise_if_not_found=raise_if_not_found)
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_model.py", line 1671, in xmlid_to_res_model_res_id
    return self.xmlid_lookup(xmlid)[1:3]
  File "<decorator-gen-24>", line 2, in xmlid_lookup
  File "/usr/lib/python3/dist-packages/odoo/tools/cache.py", line 90, in lookup
    value = d[key] = self.method(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_model.py", line 1660, in xmlid_lookup
    raise ValueError('External ID not found in the system: %s' % xmlid)
odoo.tools.convert.ParseError: "External ID not found in the system: fleet_rental.model_car_rental_contract" while parsing /mnt/extra-addons/fleet-rental-management/views/car_rental_view.xml:2, near
<odoo>
    <data noupdate="1">
        <record id="sequence_car_rental" model="ir.sequence">
            <field name="name">Car Rental Sequence</field>
            <field name="code">car.rental.sequence</field>
            <field name="prefix">RENT/%(range_year)s/</field>
            <field eval="1" name="number_next"/>
            <field eval="1" name="number_increment"/>
            <field eval="True" name="use_date_range"/>
            <field name="padding">4</field>
        </record>
    </data>

    <data>
        <record id="cron_scheduler_for_fleet" model="ir.cron">
          <field name="name">Fleet scheduler</field>
          <field name="model_id" ref="fleet_rental.model_car_rental_contract"/>
          <field name="state">code</field>
          <field name="code">model.fleet_scheduler()</field>
          <field name="active" eval="True"/>
          <field name="user_id" ref="base.user_root"/>
          <field name="interval_number">1</field>
          <field name="interval_type">days</field>
          <field name="numbercall">-1</field>
          <field name="doall" eval="False"/>
        </record>

        <record model="ir.ui.view" id="rental_fleet_vehicle_inherit_form_view">
            <field name="name">fleet.vehicle.form.inherit.view</field>
            <field name="model">fleet.vehicle</field>
            <field name="inherit_id" ref="fleet.fleet_vehicle_view_form"/>
            <field name="arch" type="xml">
                <field name="car_value" position="after">
                    <field name="rental_check_availability" invisible="1"/>
                    <field name="rental_reserved_time" invisible="1"/>
                </field>
                <field name="color" position="replace">
                    <field name="color"/>
                </field>
            </field>
        </record>

        <record id="car_rental_contract_form_view" model="ir.ui.view">
            <field name="name">car.contract.result.form</field>
            <field name="model">car.rental.contract</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="car_result">
                    <header>
                        <button name="action_confirm" string="Confirm" type="object" attrs="{'invisible': [('state', '!=', 'draft')]}" class="oe_highlight"/>
                        <button name="action_run" string="Run" type="object" attrs="{'invisible': [('state', '!=', 'reserved')]}" class="oe_highlight"/>
                        <button name="action_cancel" string="Cancel" type="object" attrs="{'invisible': [('state', 'not in', ('draft', 'reserved'))]}" class="oe_highlight"/>
                        <button name="action_invoice_create" string="Create Invoice" attrs="{'invisible': ['|',('state', '!=', 'running'),                                 ('first_invoice_created','=',True)]}" type="object" class="oe_highlight"/>
                        <button name="force_checking" string="Force Checking" attrs="{'invisible': ['|',('state','!=','running'),                                 ('first_invoice_created','=',False)]}" type="object" class="oe_highlight"/>
                        <button name="set_to_done" string="Set to Done" states="invoice" type="object" class="oe_highlight"/>
                        <field name="state" widget="statusbar" statusbar_visible="draft,running,done"/>
                    </header>
                    <sheet>
                        <div class="oe_button_box" name="buttons">
                            <button name="action_view_invoice" class="oe_stat_button" type="object" icon="fa-money">
                                <field string="Invoice" name="invoice_count" widget="statinfo"/>
                            </button>
                        </div>
                        <field name="image" widget="image" class="oe_avatar"/>
                        <div class="oe_title">
                            <h1>
                                <field name="name"/>
                            </h1>
                        </div>
                        <group>
                            <separator string="Contract Details " colspan="4"/>
                            <group>
                                <field name="customer_id" string="Customer" attrs="{'readonly': [('state','!=','draft')]}"/>
                                <field name="rent_start_date" attrs="{'readonly': [('state','!=','draft')]}"/>
                                <field name="rent_end_date" attrs="{'readonly': [('state','!=','draft')]}"/>
                                <field name="vehicle_id" domain="[('rental_check_availability','=',True),                                 ('state_id.name','!=','Inactive')]" options="{'no_create': True}"/>
                                <field name="journal_type" invisible="1"/>
                                <field name="check_verify" invisible="1"/>
                                <field name="sales_person" attrs="{'readonly': [('state','!=','draft')]}"/>
                            </group>
                            <group>
                                <field name="car_brand"/>
                                <field name="car_color"/>
                                <field name="first_invoice_created" invisible="1"/>
                                <label for="first_payment"/>
                                <div>
                                    <field name="first_payment" class="oe_inline" attrs="{'readonly': ['|', ('state','not in',('draft', 'running')),                                                 ('first_invoice_created','=',True)]}"/>
                                    <field name="first_payment_inv" style="width:142px;" readonly="1"/>
                                </div>
                                <field name="account_type" invisible="1"/>
                                <field name="cost" invisible="1"/>
                                <label for="cost_generated"/>
                                    <div>
                                        <field name="cost_frequency" class="oe_inline" attrs="{'readonly': [('state','!=','draft')]}"/>
                                        <field name="cost_generated" style="width:142px;" attrs="{'invisible': [('cost_frequency','=','no')],                                                        'readonly': [('state','!=','draft')],                                                        'required': [('cost_frequency','not in',[None,False,'no'])]}"/>
                                    </div>
                            </group>
                        </group>
                        <notebook>
                            <page string="Recurring Invoices" attrs="{'invisible': [('cost_frequency','in',[None,False,'no'])]}">
                                <field name="recurring_line" mode="tree">
                                    <tree string="Fleet Reccurring Lines" colors="#0b7a35:payment_info=='paid';#f20b07:payment_info!='paid'">
                                        <field name="date_today"/>
                                        <field name="date_due"/>
                                        <field name="name"/>
                                        <field name="account_info"/>
                                        <field name="recurring_amount"/>
                                        <field name="payment_info"/>
                                        <field name="invoice_ref"/>
                                    </tree>
                                </field>
                            </page>
                            <page string="Checklist">
                                <group>
                                    <group>
                                        <field name="attachment_ids" widget="many2many_binary" class="oe_inline"/>
                                    </group>
                                    <group>
                                        <field name="damage_cost" attrs="{'invisible': [('state','!=','checking')]}"/>
                                    </group>
                                </group>
                                <field name="checklist_line">
                                    <tree string="Fleet Checklist Lines" editable="bottom">
                                        <field name="name"/>
                                        <field name="checklist_active"/>
                                        <field name="checklist_number" invisible="True"/>
                                        <field name="price"/>
                                    </tree>
                                    <form>
                                        <sheet>
                                            <group>
                                                <field name="name"/>
                                                <field name="checklist_active" invisible="1"/>
                                                <field name="checklist_number" invisible="1"/>
                                            </group>
                                        </sheet>
                                    </form>
                                </field>
                                <div>
                                    <group class="oe_subtotal_footer oe_right">
                                        <field name="total"/>
                                        <field name="tools_missing_cost"/>
                                        <field name="damage_cost_sub"/>
                                        <field name="total_cost" class="oe_subtotal_footer_separator"/>
                                    </group>
                                </div>
                                <div style="float: right;margin-left: 78%;margin-bottom: 36px;">
                                    <button name="action_verify" string="Verify" type="object" style="width: 100px !important;height: 40px;" attrs="{'invisible': [('state', '!=', 'checking')]}" class="oe_subtotal_footer oe_right oe_highlight"/>
                                </div>
                            </page>
                        </notebook>
                        <group>
                          <field name="notes"/>
                        </group>
                    </sheet>
                    <div class="oe_chatter">
                        <field name="message_follower_ids" widget="mail_followers"/>
                        <field name="message_ids" widget="mail_thread"/>
                    </div>
                </form>
            </field>
        </record>

        <record model="ir.ui.view" id="car_contract_tree_view">
            <field name="name">car_contract_tree_view.tree</field>
            <field name="model">car.rental.contract</field>
            <field name="type">tree</field>
            <field name="arch" type="xml">
                <tree string="car_contract_result" decoration-info="state == 'draft'">
                    <field name="name"/>
                    <field name="customer_id" string="Customer"/>
			        <field name="vehicle_id"/>
                    <field name="cost"/>
                    <field name="car_brand"/>
					<field name="car_color"/>
                    <field name="rent_start_date"/>
                    <field name="rent_end_date"/>
                    <field name="state"/>
                </tree>
            </field>
        </record>

        <record id="action_car_rental_contract" model="ir.actions.act_window">
            <field name="name">Rental Contract</field>
            <field name="res_model">car.rental.contract</field>
            <field name="view_mode">tree,form</field>
        </record>

        <menuitem name="Fleet Rental" id="fleet.menu_root" sequence="115" groups="fleet.fleet_group_user" web_icon="fleet,static/description/icon.png"/>
        <menuitem id="menu_car_parent" sequence="1" name="Rental Management" parent="fleet.menu_root"/>
        <menuitem id="menu_car_rental_contract" parent="menu_car_parent" name="Rental Contract" action="action_car_rental_contract" sequence="1"/>
    </data>
</odoo>
Avatar
Discard
Author Best Answer

ups.. i figured this out.


It was because the folder name was incorrect.

Corrected the folder name and now all is well.! :) 

The folder name needs to be 

fleet_rental
Avatar
Discard