İçereği Atla
Menü
Bu soru işaretlendi
1 Cevapla
4772 Görünümler

My question is: What is the correct way to debug forms and wizards in custom module development when using owl?

I was updating a custom module from Odoo 14 to Odoo 16.  My module has a wizard.  

The wizard failed to display and instead showed a series of generic owl error stack traces.  The error indicated `Type Error domain.map is not a function`.

It was not obvious at all how to see what was causing this error.

In Odoo 14, if I had something wrong in the xml for the view, I would get a more meaningful stack trace that would indicate the thing that was illegal syntax or whatnot.  I still get that if I have an actual syntax error.  But in this case, it is probably "legal" syntax, but caused the rendering of the form to fail in owl.

I found the problem through trial and error, by commenting out almost the entirety of the xml for the wizard view, until the wizard displayed without errors.  Then I gradually put back in one element or field at a time on the wizard until I got the error.

The problem, for the record, was use of `attrs="{'readonly': 1}"` which worked correctly in Odoo 14.  

In Odoo 16 this caused the owl error and prevented the wizard from displaying at all.  Once I changed it to just `readonly="1"` then it displayed correctly without error.

Any pointers as to the correct way to debug such errors would be appreciated!

Thank you!

Avatar
Vazgeç
Üretici

For what it is worth, several months later, I ran into this same problem on debugging an owl error (`domain.map is not a function`) again on a different module today. After attempting to step through the js code in chrome debug tools and not getting anywhere, I searched google and ran across my own post.

And the same fault I had encountered before was the same problem this time and once I fixed it, the error went away:

`attrs="{readonly': 1}"` fails and must be written as:

`readonly="1"` in the field definition in the xml view definition.

It is unfortunate that it is seemingly so difficult to track and debug these errors. Hopefully somebody does have an answer to that! And hopefully this is helpful to others that may have run into it.

En İyi Yanıt

Hello,

Same thing if you have an attrs="{'invisible': True}" you have to remplace it by invisible="1"

Avatar
Vazgeç
İlgili Gönderiler Cevaplar Görünümler Aktivite
2
Tem 24
5292
0
Oca 24
2034
1
Eki 23
2409
0
Eyl 23
1792
1
Oca 25
3982