Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

Equivalent javascript onLoad() - it is possible when form is loaded?

By
zbik
on 2/9/15, 4:11 PM 1,557 views

This question is related to my previous question: conditional, dynamic field domain.

Example:

<field name="xxx"/>
<field name="yyy_ids" widget="many2many" domain="....DOMAIN......">

I know how to change the domain for yyy_ids when signal change is generated 

@api.onchange('xxx')
def do_xxx(self):

.... here code to change DOMAIN...

return {'domain': {'yyy_ids': ....DOMAIN_VALUE....}}

but how generate onchange signal, at the start, when form will be loaded?

Thanks, I will check soon.

zbik
on 2/11/15, 3:25 PM
1

zbik

--zbik--
5941
| 6 4 7
Lodz, Poland
--zbik--


zbik
On 2/12/15, 4:44 AM

@Mariusz, PARTLY SOLVED :(. Yes, we now have a new system behavior. Method onchage is fired when a record is created, but if record already exist onchange is not fired, regardless of the default and the new contents of the field xxx.

Any workaround on that? I have the same challenge and I don't know what to do yet :(

Mathieu Laflamme
on 2/26/16, 3:55 PM

I have no new messages. See: https://github.com/odoo/odoo/issues/5199

zbik
on 2/27/16, 7:18 AM
0
Mariusz Mizgier
On 2/12/15, 4:43 AM

Did you try: 1. apply this patch - https://github.com/odoo/odoo/commit/2067a206ecba9a8dbf7f76a55926be964e580e7e 2. move your xxx before yyy_ids in form view 3. set _defaults for xxx to False Didn't check that, but that should work - if not, maybe change in logic (defaults = True) so that this field does change it's value.

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 2/9/15, 4:11 PM
Seen: 1557 times
Last updated: 3/16/15, 8:10 AM