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

Odoo version: 10, but may affect others

I'm having an issue with a custom module that given a sufficiently long form, pressing Create and Edit to create an object pops up a modal dialog, but it shows the middle of the form first (i.e. the scrollbar is about half way down) by default.

In case it has any bearing, the many2one field is embedded in a custom one2many list within the Sale Order Line form (which itself pops up from the one2many order_line field on sale.order).

Does anyone know how to make sure it shows the top of the form first?

Avatar
Discard
Author Best Answer

I found out what was causing the issue - an HTML widget on the form was stealing focus.

I had tried default_focus="1" and that didn't make any difference (but thanks "Ramsad pv" for your suggestion).

I've filed a bug against core Odoo:  https://github.com/odoo/odoo/issues/24756

In the meantime it's possible to prevent this happening by burying any HTML widgets in a notebook page (but not the first one - it has to be a notebook page that isn't shown initially).

Sorry for the delay posting this.

Avatar
Discard
Best Answer

You need to add this to your XML codes .

<field name="name" default_focus=”1”/>


to the top most field of your form view ,

Thank you 

regards :-

https://www.odoo.com/forum/help-1/question/how-to-direct-a-cursor-to-a-specific-field-when-user-opens-and-edits-a-form-of-picking-list-e-g-odoo-8-92968





Avatar
Discard