Skip to Content
Menu
This question has been flagged
4 Replies
3698 Views

Receiving an Odoo error on a block of XML that has been commented out.

Avatar
Discard
Author

Thanks Ashish,

I did figure out my mistakes (multiple). The error message was throwing me off where the real problem was.

Best Answer

Hi, Jeff


Regarding above issue there can have two reasons,
    CASE 1: If both views (Action and Form view) are present inside the same extension

If this view is present inside the same extension ("szm_motraveler") then you need to check the sequence of views which are listed inside __manifest__.py. It seems view file which include that action is defined next to the above view file.

  • For example, I have two files,
    • abc_view.xml

    • abc_action_view.xml

  • So if first view file use action which is defined inside the "abc_action_view.xml" then sequence of files inside the __manifest__.py will be like,

    • 'data' : [
      'views/abc_action_view.xml',
      'views/abc_view.xml',
      ],


CASE 2: If both views (Action and Form view) are present inside the different extension
  • In that case dependency should be present inside the __manifest__.py file like below,

    • 'depends' : [
      'szm_motraveler',
      ],


Feel free to ask in case you have any confusion related to the above points.

Thanks,
Ashish Singh (Team Lead)
Webkul Software Private Limited
Avatar
Discard
Author Best Answer

I'm still a noob, but have a situation where upon installation of a new module, I am receiving the following error. 

What is perplexing is that the error is referencing a block of XML that is commented out. What I have done is basically take an exact copy of  mrp.production.form (albeit renamed) and with sections removed. Obviously, not everything is quite to where I need it, but for the life of me, I cannot determine why this error is being presented.

Error:

Odoo Server Error


Traceback (most recent call last):

  File "/home/odoo/src/odoo/odoo/tools/cache.py", line 85, in lookup

    r = d[key]

  File "/home/odoo/src/odoo/odoo/tools/func.py", line 69, in wrapper

    return func(self, *args, **kwargs)

  File "/home/odoo/src/odoo/odoo/tools/lru.py", line 44, in __getitem__

    a = self.d[obj].me

KeyError: ('ir.model.data', <function IrModelData.xmlid_lookup at 0x7f703f51b268>, 'szm_motraveler.action_mrp_workorder_production_specific')


During handling of the above exception, another exception occurred:


Traceback (most recent call last):

  File "/home/odoo/src/odoo/odoo/tools/convert.py", line 712, in parse

    self._tag_root(de)

  File "/home/odoo/src/odoo/odoo/tools/convert.py", line 674, in _tag_root

    f(rec)

  File "/home/odoo/src/odoo/odoo/tools/convert.py", line 674, in _tag_root

    f(rec)

  File "/home/odoo/src/odoo/odoo/tools/convert.py", line 563, in _tag_record

    f_val = _eval_xml(self, field, env)

  File "/home/odoo/src/odoo/odoo/tools/convert.py", line 143, in _eval_xml

    +_process("".join(etree.tostring(n, encoding='unicode') for n in node))

  File "/home/odoo/src/odoo/odoo/tools/convert.py", line 132, in _process

    self.idref[id] = self.id_get(id)

  File "/home/odoo/src/odoo/odoo/tools/convert.py", line 657, in id_get

    res = self.model_id_get(id_str, raise_if_not_found)

  File "/home/odoo/src/odoo/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 "/home/odoo/src/odoo/odoo/addons/base/models/ir_model.py", line 1666, in xmlid_to_res_model_res_id

    return self.xmlid_lookup(xmlid)[1:3]

  File "<decorator-gen-24>", line 2, in xmlid_lookup

  File "/home/odoo/src/odoo/odoo/tools/cache.py", line 90, in lookup

    value = d[key] = self.method(*args, **kwargs)

  File "/home/odoo/src/odoo/odoo/addons/base/models/ir_model.py", line 1655, in xmlid_lookup

    raise ValueError('External ID not found in the system: %s' % xmlid)

ValueError: External ID not found in the system: szm_motraveler.action_mrp_workorder_production_specific


During handling of the above exception, another exception occurred:


Traceback (most recent call last):

  File "/home/odoo/src/odoo/odoo/http.py", line 619, in _handle_exception

    return super(JsonRequest, self)._handle_exception(exception)

  File "/home/odoo/src/odoo/odoo/http.py", line 309, in _handle_exception

    raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])

  File "/home/odoo/src/odoo/odoo/tools/pycompat.py", line 14, in reraise

    raise value

  File "/home/odoo/src/odoo/odoo/http.py", line 664, in dispatch

    result = self._call_function(**self.params)

  File "/home/odoo/src/odoo/odoo/http.py", line 345, in _call_function

    return checked_call(self.db, *args, **kwargs)

  File "/home/odoo/src/odoo/odoo/service/model.py", line 93, in wrapper

    return f(dbname, *args, **kwargs)

  File "/home/odoo/src/odoo/odoo/http.py", line 338, in checked_call

    result = self.endpoint(*a, **kw)

  File "/home/odoo/src/odoo/odoo/http.py", line 910, in __call__

    return self.method(*args, **kw)

  File "/home/odoo/src/odoo/odoo/http.py", line 510, in response_wrap

    response = f(*args, **kw)

  File "/home/odoo/src/odoo/addons/web/controllers/main.py", line 1324, in call_button

    action = self._call_kw(model, method, args, kwargs)

  File "/home/odoo/src/odoo/addons/web/controllers/main.py", line 1312, in _call_kw

    return call_kw(request.env[model], method, args, kwargs)

  File "/home/odoo/src/odoo/odoo/api.py", line 387, in call_kw

    result = _call_kw_multi(method, model, args, kwargs)

  File "/home/odoo/src/odoo/odoo/api.py", line 374, in _call_kw_multi

    result = method(recs, *args, **kwargs)

  File "<decorator-gen-58>", line 2, in button_immediate_install

  File "/home/odoo/src/odoo/odoo/addons/base/models/ir_module.py", line 72, in check_and_log

    return method(self, *args, **kwargs)

  File "/home/odoo/src/odoo/odoo/addons/base/models/ir_module.py", line 463, in button_immediate_install

    return self._button_immediate_function(type(self).button_install)

  File "/home/odoo/src/odoo/odoo/addons/base/models/ir_module.py", line 573, in _button_immediate_function

    modules.registry.Registry.new(self._cr.dbname, update_module=True)

  File "/home/odoo/src/odoo/odoo/modules/registry.py", line 86, in new

    odoo.modules.load_modules(registry._db, force_demo, status, update_module)

  File "/home/odoo/src/odoo/odoo/modules/loading.py", line 423, in load_modules

    loaded_modules, update_module, models_to_check)

  File "/home/odoo/src/odoo/odoo/modules/loading.py", line 315, in load_marked_modules

    perform_checks=perform_checks, models_to_check=models_to_check

  File "/home/odoo/src/odoo/odoo/modules/loading.py", line 225, in load_module_graph

    load_data(cr, idref, mode, kind='data', package=package, report=report)

  File "/home/odoo/src/odoo/odoo/modules/loading.py", line 68, in load_data

    tools.convert_file(cr, package.name, filename, idref, mode, noupdate, kind, report)

  File "/home/odoo/src/odoo/odoo/tools/convert.py", line 736, in convert_file

    convert_xml_import(cr, module, fp, idref, mode, noupdate, report)

  File "/home/odoo/src/odoo/odoo/tools/convert.py", line 803, in convert_xml_import

    obj.parse(doc.getroot())

  File "/home/odoo/src/odoo/odoo/tools/convert.py", line 721, in parse

    exc_info[2]

  File "/home/odoo/src/odoo/odoo/tools/pycompat.py", line 13, in reraise

    raise value.with_traceback(tb)

  File "/home/odoo/src/odoo/odoo/tools/convert.py", line 712, in parse

    self._tag_root(de)

  File "/home/odoo/src/odoo/odoo/tools/convert.py", line 674, in _tag_root

    f(rec)

  File "/home/odoo/src/odoo/odoo/tools/convert.py", line 674, in _tag_root

    f(rec)

  File "/home/odoo/src/odoo/odoo/tools/convert.py", line 563, in _tag_record

    f_val = _eval_xml(self, field, env)

  File "/home/odoo/src/odoo/odoo/tools/convert.py", line 143, in _eval_xml

    +_process("".join(etree.tostring(n, encoding='unicode') for n in node))

  File "/home/odoo/src/odoo/odoo/tools/convert.py", line 132, in _process

    self.idref[id] = self.id_get(id)

  File "/home/odoo/src/odoo/odoo/tools/convert.py", line 657, in id_get

    res = self.model_id_get(id_str, raise_if_not_found)

  File "/home/odoo/src/odoo/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 "/home/odoo/src/odoo/odoo/addons/base/models/ir_model.py", line 1666, in xmlid_to_res_model_res_id

    return self.xmlid_lookup(xmlid)[1:3]

  File "<decorator-gen-24>", line 2, in xmlid_lookup

  File "/home/odoo/src/odoo/odoo/tools/cache.py", line 90, in lookup

    value = d[key] = self.method(*args, **kwargs)

  File "/home/odoo/src/odoo/odoo/addons/base/models/ir_model.py", line 1655, 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: szm_motraveler.action_mrp_workorder_production_specific" while parsing /home/odoo/src/user/szm_motraveler/views/mrp_production_views.xml:2, near

<odoo>

    <data>

        <record id="mrp_production_form_szm_view" model="ir.ui.view">

            <field name="name">mrp.production.szm.form</field>

            <field name="model">mrp.production</field>

            <field name="arch" type="xml">

                <form string="Manufacturing Orders SZM">

                <header>

                    <field name="confirm_cancel" invisible="1"/>

                    <button name="button_mark_done" attrs="{'invisible': [('state', '!=', 'to_close')]}" string="Mark as Done" type="object" class="oe_highlight"/>

                    <button name="action_confirm" attrs="{'invisible': ['|', ('state', '!=', 'draft'), ('is_locked', '=', False)]}" string="Mark as Todo" type="object" class="oe_highlight"/>

                    <button name="action_assign" attrs="{'invisible': ['|', '|', ('is_locked', '=', False), ('state', 'in', ('draft', 'done', 'cancel')), ('reservation_state', '=', 'assigned')]}" string="Check availability" type="object" class="oe_highlight"/>

                    <button name="button_plan" attrs="{'invisible': ['|', ('state', '!=', 'confirmed'), ('routing_id', '=', False)]}" type="object" string="Plan" class="oe_highlight"/>

                    <button name="button_unplan" type="object" string="Unplan" attrs="{'invisible': ['|', '|', ('state', '!=', 'planned'), ('date_planned_start', '=', False), ('date_planned_finished', '=', False)]}"/>

                    <button name="open_produce_product" attrs="{'invisible': ['|', '|', '|', ('state', '=', 'to_close'), ('is_locked', '=', False), ('reservation_state', '!=', 'assigned'), ('routing_id', '!=', False)]}" string="Produce" type="object" class="oe_highlight"/>

                    <button name="open_produce_product" attrs="{'invisible': ['|', '|', '|', ('state', '=', 'to_close'), ('is_locked', '=', False), ('reservation_state', 'not in', ('confirmed', 'waiting')), ('routing_id', '!=', False)]}" string="Produce" type="object"/>

                    <button name="post_inventory" string="Post Inventory" type="object" attrs="{'invisible': [('post_visible', '=', False)]}" groups="base.group_no_one"/>

                    <button name="button_scrap" type="object" string="Scrap" attrs="{'invisible': ['|', ('state', 'in', ('cancel', 'draft')), ('is_locked', '=', False)]}"/>

                    <button name="button_unreserve" type="object" string="Unreserve" attrs="{'invisible': [('unreserve_visible', '=', False)]}"/>

                    <field name="state" widget="statusbar" statusbar_visible="draft,confirmed,assigned,done"/>

                    <button name="action_toggle_is_locked" attrs="{'invisible': ['|', '|', ('state', 'in', ('cancel', 'draft')), ('id', '=', False), ('is_locked', '=', False)]}" string="Unlock" groups="mrp.group_mrp_manager" type="object" help="Unlock the manufacturing order to correct what has been consumed or produced."/>

                    <button name="action_toggle_is_locked" attrs="{'invisible': [('is_locked', '=', True)]}" string="Lock" class="oe_highlight" groups="mrp.group_mrp_manager" type="object"/>

                    <button name="action_cancel" type="object" string="Cancel" attrs="{'invisible': ['|', '|', '|', ('id', '=', False), ('is_locked', '=', False), ('state', 'in', ('done','cancel')), ('confirm_cancel', '=', True)]}"/>

                    <button name="action_cancel" type="object" string="Cancel" attrs="{'invisible': ['|', '|', '|', ('id', '=', False), ('is_locked', '=', False), ('state', 'in', ('done','cancel')), ('confirm_cancel', '=', False)]}" confirm="Some product moves have already been confirmed, this manufacturing order can't be completely cancelled. Are you still sure you want to process ?"/>

                </header>

                <sheet>

                    <field name="reservation_state" invisible="1"/>

                    <field name="is_locked" invisible="1"/>

                    <field name="post_visible" invisible="1"/>

                    <field name="unreserve_visible" invisible="1"/>

                    <div class="oe_button_box" name="button_box">

                        <button name="%(stock.action_stock_report)d" icon="fa-arrow-up" class="oe_stat_button" string="Traceability" type="action" states="done" groups="stock.group_production_lot"/>

                        <!-- <button name="%(action_mrp_workorder_production_specific)d" type="action" attrs="{'invisible': [('workorder_count', '=', 0)]}" class="oe_stat_button" icon="fa-play-circle-o">

                            <div class="o_field_widget o_stat_info">

                                <span class="o_stat_value"><field name="workorder_done_count" widget="statinfo" nolabel="1"/> / <field name="workorder_count" widget="statinfo" nolabel="1"/></span>

                                <span class="o_stat_text">Work Orders</span>

                            </div>

                        </button>  -->

                        <button name="%(action_mrp_production_moves)d" type="action" string="Product Moves" class="oe_stat_button" icon="fa-exchange" attrs="{'invisible': [('state', 'not in', ('progress', 'done'))]}"/>

                        <button type="object" name="action_view_mo_delivery" class="oe_stat_button" icon="fa-truck" groups="base.group_user" attrs="{'invisible': [('delivery_count', '=', 0)]}">

                            <field name="delivery_count" widget="statinfo" string="Transfers"/>

                        </button>

                        <button class="oe_stat_button" name="action_see_move_scrap" type="object" icon="fa-arrows-v" attrs="{'invisible': [('scrap_count', '=', 0)]}">

                            <div class="o_field_widget o_stat_info">

                                <span class="o_stat_value"><field name="scrap_count"/></span>

                                <span class="o_stat_text">Scraps</span>

                            </div>

                        </button>

                        <field name="workorder_ids" invisible="1"/>

                    </div>

                    <div class="oe_title">

                        <h1><field name="name" placeholder="Manufacturing Reference" nolabel="1"/></h1>

                    </div>

                    <group>

                        <group>

                            <field name="id" invisible="1"/>

                            <field name="product_id" attrs="{'readonly': [('state', '!=', 'draft')]}"/>

                            <field name="product_tmpl_id" invisible="1"/>

                            <label for="product_qty"/>

                            <div class="o_row no-gutters d-flex">

                                <div class="col">

                                    <field name="product_qty" class="mr-1" attrs="{'readonly': [('state', '!=', 'draft')]}"/>

                                    <field name="product_uom_id" options="{'no_open':True,'no_create':True}" force_save="1" groups="uom.group_uom" attrs="{'readonly': [('state', '!=', 'draft')]}"/>

                                    <button type="action" name="%(mrp.action_change_production_qty)d" context="{'default_mo_id': id}" string="Update" class="oe_link" attrs="{'invisible': ['|', ('state', 'in', ('draft', 'done','cancel')), ('id', '=', False)]}"/>

                                </div>

                            </div>

                            <field name="bom_id" context="{'default_product_tmpl_id': product_tmpl_id}" required="1" attrs="{'readonly': [('state', '!=', 'draft')]}"/>

                            <field name="routing_id" groups="mrp.group_mrp_routings"/>

                        </group>

                        <group>

                            <field name="date_deadline" attrs="{'readonly': [('state', 'in', ['done', 'cancel'])]}"/>

                            <field name="date_start_wo" attrs="{'invisible': [                                 '|',                                     '&amp;',                                         ('routing_id', '!=', False),                                         ('state', 'not in', ['draft', 'confirmed']),                                     ('routing_id', '=', False),                                 ], 'readonly': [                                     ('routing_id', '!=', False),                                     ('state', 'not in', ['draft', 'confirmed']),                                 ]}"/>

                            <div class="o_row o_td_label">

                                <label for="date_planned_start" string="Planned Date" attrs="{'invisible': [                                                 ('routing_id', '!=', False),                                                 ('state', 'in', ['draft', 'confirmed'])                                         ]}"/>

                            </div>

                            <div class="o_row">

                                <field name="date_planned_start" attrs="{'invisible': [                                             ('routing_id', '!=', False),                                             ('state', 'in', ['draft', 'confirmed']),                                         ], 'readonly': [                                        '|',                                         '&amp;',                                             ('routing_id', '=', False),                                             ('state', 'in', ['done', 'cancel']),                                         '&amp;',                                             ('routing_id', '!=', False),                                             ('state', 'not in', ['draft', 'confirmed'])]}"/>

                                <label for="date_planned_finished" string="to" attrs="{'invisible': [                                     '|',                                         ('id', '=', False),                                         '&amp;',                                             ('routing_id', '!=', False),                                             ('state', 'in', ['draft', 'confirmed'])                                 ]}"/>

                                <field name="date_planned_finished" required="1" attrs="{'readonly': [                                     '|',                                         '&amp;',                                             ('routing_id', '=', False),                                             ('state', 'in', ['done', 'cancel']),                                         ('routing_id', '!=', False)                                 ], 'invisible': [                                     ('routing_id', '!=', False),                                     ('state', 'in', ['draft', 'confirmed'])                                 ]}"/>

                            </div>

                            <field name="user_id"/>

                        </group>

                    </group>

                    <notebook>

                        <page string="Components">

                            <field name="move_raw_ids" context="{'final_lots': show_final_lots, 'tree_view_ref': 'mrp.view_stock_move_raw_tree', 'form_view_ref': 'mrp.view_stock_move_lots', 'default_location_id': location_src_id, 'default_location_dest_id': production_location_id, 'default_state': 'draft', 'default_raw_material_production_id': id, 'default_picking_type_id': picking_type_id}" attrs="{'readonly': ['&amp;', ('state', '!=', 'draft'), ('is_locked', '=', True)]}"/>

                        </page>

                        <page string="Finished Products">

                            <field name="finished_move_line_ids" context="{'form_view_ref': 'mrp.view_finisehd_move_line'}" attrs="{'readonly': [('is_locked', '=', True)], 'invisible': [('finished_move_line_ids', '=', [])]}">

                                 <tree default_order="done_move" editable="bottom" create="0" delete="0" decoration-muted="state in ('done', 'cancel')">

                                    <field name="product_id" readonly="1"/>

                                    <field name="company_id" invisible="1"/>

                                    <field name="lot_id" groups="stock.group_production_lot" context="{'default_product_id': product_id}" attrs="{'invisible': [('lots_visible', '=', False)]}"/>

                                    <field name="product_uom_id" groups="uom.group_uom"/>

                                    <field name="qty_done" string="Produced"/>

                                    <field name="lots_visible" invisible="1"/>

                                    <field name="done_move" invisible="1"/>

                                    <field name="state" invisible="1"/>

                                </tree>

                            </field>

                            <p attrs="{'invisible': [('finished_move_line_ids', '!=', [])]}">

                                Use the Produce button or process the work orders to create some finished products.

                            </p>

                        </page>

                    </notebook>

                </sheet>

                <div class="oe_chatter">

                    <field name="message_follower_ids" widget="mail_followers"/>

                    <field name="activity_ids" widget="mail_activity"/>

                    <field name="message_ids" widget="mail_thread"/>

                </div>

                </form>

            </field>

        </record>

        <!-- Action Window definition-->

        <record model="ir.actions.act_window" id="action_mrp_production_form_szm">

            <field name="name">SZM Production Entry</field>

            <field name="res_model">mrp.production</field>

            <field name="view_type">form</field>

            <field name="view_mode">form</field>

        </record>

        <!-- Action Menu Item -->

        <menuitem action="action_mrp_production_form_szm" id="action_menu_mrp_production_form_szm" name="Product Entry SZM" sequence="20"/>

    </data>

</odoo>



Avatar
Discard

if you have commented out, it doesn't have to work, as a cross checking rather than commenting, can you try deleting that button line from the code and see whether you are getting same error or not

Related Posts Replies Views Activity
0
Nov 24
132
0
Jun 24
267
1
Jun 24
701
0
Oct 23
952
2
Mar 23
1488