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

How to identify the click in a one2many field in wizard

By
Fabio Negrini
on 2/22/13, 10:29 AM 1,434 views

I have a wizard which, after a process, returns a list of one2many objects. I would like to identify when the user clicks into one of the items in the list and trigger a method in the class to identify which item the user has selected.

1

Vasiliy Birukov

--Vasiliy Birukov--
3446
| 6 6 8
Russian Federation
--Vasiliy Birukov--

Help develop and implement any project on base Odoo.

Vasiliy Birukov
On 2/26/13, 1:32 AM

You can use onchange event. Define onchange function in object(like in account):

def onchange_journal_id(self, cr, uid, ids, journal_id, context=None): company_id = False if journal_id: journal = self.pool.get('account.journal').browse(cr, uid, journal_id, context=context) if journal.company_id.id: company_id = journal.company_id.id return {'value': {'company_id': company_id}}

And define call of function in form view XML definition:

<field name="journal_id" domain="[('type', '=', 'bank')]" on_change="onchange_journal_id(journal_id)" widget="selection"/>

0

Yannick Vaucher

--Yannick Vaucher--
1699
| 5 7 9
Lausanne, Switzerland
--Yannick Vaucher--
Yannick Vaucher
On 2/22/13, 10:51 AM

I assume you are searching about which action is launched.

A button is defined in xml like this:

<button name="reconcile" string="Reconcile" type="object" class="oe_highlight"/>

The name specifies which action will be triggered.

In that exemple from account_automatic_reconcile wizard it will trigger the wizard account_automatic_reconcile.reconcile() method.

You could wrap this method call by adding a counter in python.

Otherwise, you can perhaps use some javascript.

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

0 follower(s)

Stats

Asked: 2/22/13, 10:29 AM
Seen: 1434 times
Last updated: 3/16/15, 8:10 AM