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 change view dynamically on user click?

By
Lucio
on 5/20/13, 6:04 PM 976 views

Hi, I have create a form view for some model meta_products. In there I have a one2many field products_ids.

class meta_product:
    ...
    _columns = {
        'product_ids': fields.one2many('product.product', 'meta_product_id'...),
        'rep_prod_id': fields.many2one('product_product', 'Product ID'),
        ...
    }

I am showing product_ids as a tree in the form view of meta_products and I would like a sort-of on_change on the elements of this tree in order to set dynamically the rep_prod_id depending on the last click of the user.

I hope I am being clear enough and that someone knows how is this possible.

If you're not making any changes to the record it's going to be difficult to call an on_change function. Rather than focusing on the simple act of clicking a record, would clicking a button in the tree view of product_ids be an acceptable alternative? Because then you could create a function in an inherited product.product model that just writes its current id to the rep_prod_id field.

Brett Lehrer
on 5/20/13, 11:40 PM

Yeah, I was afraid that I would have to do that...It is not really elegant but anyway, thank you!

Lucio
on 5/21/13, 9:27 AM

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: 5/20/13, 6:04 PM
Seen: 976 times
Last updated: 3/16/15, 8:10 AM