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


Hi Friends!


I got an Invalid view "error linked" to a tree view.
Any help please?

Thank you !!!



Odoo Server Error
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 577, in _tag_record
    record = model._load_records([data], self.mode == 'update')
  File "/home/odoo/src/odoo/odoo/models.py", line 4104, in _load_records
    records = self._load_records_create([data['values'] for data in to_create])
  File "/home/odoo/src/odoo/odoo/models.py", line 4018, in _load_records_create
    return self.create(values)
  File "<decorator-gen-31>", line 2, in create
  File "/home/odoo/src/odoo/odoo/api.py", line 336, in _model_create_multi
    return create(self, arg)
  File "/home/odoo/src/odoo/odoo/addons/base/models/ir_ui_view.py", line 475, in create
    return super(View, self).create(vals_list)
  File "<decorator-gen-3>", line 2, in create
  File "/home/odoo/src/odoo/odoo/api.py", line 336, in _model_create_multi
    return create(self, arg)
  File "/home/odoo/src/odoo/odoo/models.py", line 3779, in create
    fields[0].determine_inverse(batch_recs)
  File "/home/odoo/src/odoo/odoo/fields.py", line 1120, in determine_inverse
    getattr(records, self.inverse)()
  File "/home/odoo/src/odoo/odoo/addons/base/models/ir_ui_view.py", line 299, in _inverse_arch
    view.write(data)
  File "/home/odoo/src/odoo/addons/website_theme_install/models/theme_models.py", line 226, in write
    res = super(IrUiView, other_views).write(vals)
  File "/home/odoo/src/odoo/addons/website/models/ir_ui_view.py", line 51, in write
    return super(View, self).write(vals)
  File "/home/odoo/src/odoo/odoo/addons/base/models/ir_ui_view.py", line 493, in write
    res = super(View, self).write(self._compute_defaults(vals))
  File "/home/odoo/src/odoo/odoo/models.py", line 3568, in write
    real_recs._validate_fields(set(vals) - set(inverse_fields))
  File "/home/odoo/src/odoo/odoo/models.py", line 1176, in _validate_fields
    check(self)
  File "/home/odoo/src/odoo/odoo/addons/base/models/ir_ui_view.py", line 406, in _check_xml
    raise ValidationError(_('Invalid view %s definition in %s') % (view_name, view.arch_fs))
odoo.exceptions.ValidationError: ('Invalid view stock.reservation.tree definition in stock_reserve/view/stock_reserve.xml', None)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/odoo/src/odoo/odoo/http.py", line 624, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
  File "/home/odoo/src/odoo/odoo/http.py", line 310, 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 669, in dispatch
    result = self._call_function(**self.params)
  File "/home/odoo/src/odoo/odoo/http.py", line 350, in _call_function
    return checked_call(self.db, *args, **kwargs)
  File "/home/odoo/src/odoo/odoo/service/model.py", line 94, in wrapper
    return f(dbname, *args, **kwargs)
  File "/home/odoo/src/odoo/odoo/http.py", line 339, in checked_call
    result = self.endpoint(*a, **kw)
  File "/home/odoo/src/odoo/odoo/http.py", line 915, in __call__
    return self.method(*args, **kw)
  File "/home/odoo/src/odoo/odoo/http.py", line 515, in response_wrap
    response = f(*args, **kw)
  File "/home/odoo/src/odoo/addons/web/controllers/main.py", line 1326, in call_button
    action = self._call_kw(model, method, args, kwargs)
  File "/home/odoo/src/odoo/addons/web/controllers/main.py", line 1314, 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-59>", 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 577, in _tag_record
    record = model._load_records([data], self.mode == 'update')
  File "/home/odoo/src/odoo/odoo/models.py", line 4104, in _load_records
    records = self._load_records_create([data['values'] for data in to_create])
  File "/home/odoo/src/odoo/odoo/models.py", line 4018, in _load_records_create
    return self.create(values)
  File "<decorator-gen-31>", line 2, in create
  File "/home/odoo/src/odoo/odoo/api.py", line 336, in _model_create_multi
    return create(self, arg)
  File "/home/odoo/src/odoo/odoo/addons/base/models/ir_ui_view.py", line 475, in create
    return super(View, self).create(vals_list)
  File "<decorator-gen-3>", line 2, in create
  File "/home/odoo/src/odoo/odoo/api.py", line 336, in _model_create_multi
    return create(self, arg)
  File "/home/odoo/src/odoo/odoo/models.py", line 3779, in create
    fields[0].determine_inverse(batch_recs)
  File "/home/odoo/src/odoo/odoo/fields.py", line 1120, in determine_inverse
    getattr(records, self.inverse)()
  File "/home/odoo/src/odoo/odoo/addons/base/models/ir_ui_view.py", line 299, in _inverse_arch
    view.write(data)
  File "/home/odoo/src/odoo/addons/website_theme_install/models/theme_models.py", line 226, in write
    res = super(IrUiView, other_views).write(vals)
  File "/home/odoo/src/odoo/addons/website/models/ir_ui_view.py", line 51, in write
    return super(View, self).write(vals)
  File "/home/odoo/src/odoo/odoo/addons/base/models/ir_ui_view.py", line 493, in write
    res = super(View, self).write(self._compute_defaults(vals))
  File "/home/odoo/src/odoo/odoo/models.py", line 3568, in write
    real_recs._validate_fields(set(vals) - set(inverse_fields))
  File "/home/odoo/src/odoo/odoo/models.py", line 1176, in _validate_fields
    check(self)
  File "/home/odoo/src/odoo/odoo/addons/base/models/ir_ui_view.py", line 406, in _check_xml
    raise ValidationError(_('Invalid view %s definition in %s') % (view_name, view.arch_fs))
odoo.tools.convert.ParseError: "Invalid view stock.reservation.tree definition in stock_reserve/view/stock_reserve.xml
None" while parsing /home/odoo/src/user/stock_reserve/view/stock_reserve.xml:1, near
<odoo>
<record id="view_stock_reservation_form" model="ir.ui.view">
    <field name="name">stock.reservation.form</field>
    <field name="model">stock.reservation</field>
    <field name="arch" type="xml">
        <form string="Stock Reservations" version="13.0">
            <header>
                <button name="reserve" type="object" string="Reserve" class="oe_highlight" states="draft"/>
                <button name="release" type="object" string="Release" class="oe_highlight" states="assigned,confirmed,done"/>
                <button name="open_move" type="object" string="View Reservation Move"/>
                <field name="state" widget="statusbar" statusbar_visible="draft,assigned"/>
            </header>
            <sheet>
                <group>
                    <group name="main_grp" string="Details">
                        <field name="product_uom_category_id" invisible="1"/>
                        <field name="product_id"/>
                        <label for="product_uom_qty"/>
                        <div>
                            <field name="product_uom_qty" class="oe_inline"/>
                            <field name="product_uom" groups="product.group_uom" class="oe_inline"/>
                        </div>
                        <field name="name"/>
                        <field name="date_validity"/>
                        <field name="create_date" groups="base.group_no_one"/>
                        <field name="company_id" groups="base.group_multi_company" widget="selection"/>
                        <field name="restrict_partner_id" groups="stock.group_tracking_owner"/>
                    </group>
                    <group name="location" string="Locations" groups="stock.group_locations">
                        <field name="location_id"/>
                        <field name="location_dest_id"/>
                    </group>
                    <group name="note" string="Notes">
                        <field name="note" nolabel="1"/>
                    </group>
                </group>
            </sheet>
        </form>
    </field>
</record>

<record id="view_stock_reservation_tree" model="ir.ui.view">
    <field name="name">stock.reservation.tree</field>
    <field name="model">stock.reservation</field>
    <field name="arch" type="xml">
        <tree editable="top" string="Stock Reservations" version="13.0" colors="blue:state == 'draft';grey:state == 'cancel'">
            <field name="product_uom_category_id" invisible="1"/>
            <field name="name"/>
            <field name="product_id"/>
            <field name="move_id"/>
            <field name="product_uom_qty" sum="Total"/>
            <field name="product_uom"/>
            <field name="date_validity"/>
            <field name="restrict_partner_id" groups="stock.group_tracking_owner"/>
            <field name="location_id"/>
            <field name="company_id"/>
            <field name="state"/>
            <button name="reserve" type="object" string="Reserve" icon="terp-locked" states="draft"/>
            <button name="release" type="object" string="Release" icon="gtk-undo" states="assigned,confirmed,done"/>
        </tree>
    </field>
</record>

<record id="view_stock_reservation_search" model="ir.ui.view">
    <field name="name">stock.reservation.search</field>
    <field name="model">stock.reservation</field>
    <field name="arch" type="xml">
        <search string="Stock Reservations" version="13.0">
            <filter name="draft" string="Draft" domain="[('state', '=', 'draft')]" help="Not already reserved"/>
            <filter name="reserved" string="Reserved" domain="[('state', '=', 'assigned')]" help="Moves are reserved."/>
            <filter name="cancel" string="Released" domain="[('state', '=', 'cancel')]" help="Reservations have been released."/>
            <field name="name"/>
            <field name="product_id"/>
            <field name="move_id"/>
            <field name="restrict_partner_id" groups="stock.group_tracking_owner"/>
            <group expand="0" string="Group By...">
                <filter string="Status" name="groupby_state" domain="[]" context="{'group_by': 'state'}"/>
                <filter string="Product" domain="[]" name="groupby_product" context="{'group_by': 'product_id'}"/>
                <filter string="Product UoM" domain="[]" name="groupby_product_uom" context="{'group_by': 'product_uom'}"/>
                <filter string="Source Location" domain="[]" name="groupby_location" context="{'group_by': 'location_id'}"/>
            </group>
        </search>
    </field>
</record>

<record id="action_stock_reservation_tree" model="ir.actions.act_window">
    <field name="name">Stock Reservations</field>
    <field name="res_model">stock.reservation</field>
    <field name="type">ir.actions.act_window</field>
    <field name="view_id" ref="view_stock_reservation_tree"/>
    <field name="search_view_id" ref="view_stock_reservation_search"/>
    <field name="context">{'search_default_draft': 1,
                           'search_default_reserved': 1,
                           'search_default_groupby_product': 1}</field>
    <field name="help" type="html">
        <p class="oe_view_nocontent_create">
            Click to create a stock reservation.
            </p><p>
            This menu allow you to prepare and reserve some quantities
            of products.
        </p>
    </field>
</record>

<menuitem action="action_stock_reservation_tree" id="menu_action_stock_reservation" parent="stock.menu_stock_inventory_control" sequence="30"/>
</odoo>
Avatar
Discard
Author Best Answer

Thank you Ravi for your help!

But I still have the same error message.

I'm wondring if it's not linked to the "location_id" field I added before: <field name="location_id"/>

Because when I remove this field, I have an other error message:


Field 'company_id' used in attributes must be present in view but is missing:
 - 'company_id' in domain="[('type', 'in', ['product', 'consu']), '|', ('company_id', '=', False), ('company_id', '=', company_id)]"

Error context:
View `stock.reservation.tree`
[view_id: 2281, xml_id: n/a, model: stock.reservation, parent_id: n/a] 

None" while parsing /home/odoo/src/user/stock_reserve/view/stock_reserve.xml:1, near 

Thank you again!

Avatar
Discard

add company_id in stock.reservation.tree model and add compnay_id in view as invisible field

Best Answer

<tree editable="top" string="Stock Reservations" version="13.0" colors="blue:state == 'draft';grey:state == 'cancel'">

version is not supported attribute in list/tree view remove it 


Avatar
Discard