KbiR
KbiR

Reputation: 4174

How to solve Uncaught Promise > An error occured in the owl lifecycle (see this Error's "cause" property) in Odoo 16?

I am trying to disable the create,edit in sale.order form view by inheriting the form view. Here is the code.

sale.order_view.xml

<record id="view_order_form_inherit_custom" model="ir.ui.view">
    <field name="name">sale.order.inherit</field>
    <field name="model">sale.order</field>
    <field name="inherit_id" ref="sale.view_order_form"/>
    <field name="arch" type="xml">
                <form position="attributes">
                        <attribute name="edit">false</attribute>
                        <attribute name="create">false</attribute>
                </form>
           </field>
       </record>

Actually this code working fine, it disabled the create and edit function in the sales order view. But I am getting the below mentioned error when I cleck on the tab 'Other Info'. I don't know why and how this strange behaviour happening? When I comment the above code thee error gone.

How can I resolve this?

Here is the error:

                UncaughtPromiseError > OwlError
            Uncaught Promise > An error occured in the owl lifecycle (see this Error's "cause" property)
            OwlError: An error occured in the owl lifecycle (see this Error's "cause" property)
                OwlError@http://localhost:5014/web/assets/debug/web.assets_common.js:16481:5 (/web/static/lib/owl/owl.js:87)
                handleError@http://localhost:5014/web/assets/debug/web.assets_common.js:16518:35 (/web/static/lib/owl/owl.js:124)
                handleError@http://localhost:5014/web/assets/debug/web.assets_common.js:22093:20 (/web/static/lib/owl/owl.js:5699)
                _render@http://localhost:5014/web/assets/debug/web.assets_common.js:18013:30 (/web/static/lib/owl/owl.js:1619)
                render@http://localhost:5014/web/assets/debug/web.assets_common.js:18002:18 (/web/static/lib/owl/owl.js:1608)
                initiateRender@http://localhost:5014/web/assets/debug/web.assets_common.js:18741:23 (/web/static/lib/owl/owl.js:2347)

            Caused by: TypeError: this.options.find(...) is undefined
                get string@http://localhost:5014/web/assets/debug/web.assets_backend.js:37198:36 (/web/static/src/views/fields/selection/selection_field.js:28)
                template@http://localhost:5014/web/assets/debug/web.assets_common.js line 21874 > Function:15:18 (/web/static/lib/owl/owl.js:5480)
                _render@http://localhost:5014/web/assets/debug/web.assets_common.js:18010:38 (/web/static/lib/owl/owl.js:1616)
                render@http://localhost:5014/web/assets/debug/web.assets_common.js:18002:18 (/web/static/lib/owl/owl.js:1608)
                initiateRender@http://localhost:5014/web/assets/debug/web.assets_common.js:18741:23 (/web/static/lib/owl/owl.js:2347)

Upvotes: 0

Views: 1165

Answers (1)

Ahrimann Steiner
Ahrimann Steiner

Reputation: 1314

Could you please provide the content of the links provided in the error message: especially Line 37198 of: http://localhost:5014/web/assets/debug/web.assets_backend.js ...and have a look to your local direcory to the line 28 of /web/static/src/views/fields/selection/selection_field.js:

enter image description here

The error tells us that a js script does not find something like the option of a Fields.selection (/web/static/src/views/fields/selection/selection_field.js)... But because you say that the error is due to the create button: you could use another approach by keeping the button but making it invisible by inheriting the view sale.view_order_form:

    <record id="sale_order_view_form_btncreate_inv" model="ir.ui.view">
        <field name="name">sale.order.form.btncreateinv</field>
        <field name="model">sale.order</field>
        <field name="inherit_id" ref="sale.view_order_form"/>
        <field name="arch" type="xml">
           <xpath expr="//button[@id='create_invoice']" position="attributes">
             <attribute name="attrs">{'invisible': True}</attribute> 
           </xpath>
        </field>
    </record>

Upvotes: 0

Related Questions