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

Onchange field give different selection options?

By
DM
on 2/26/16, 11:48 AM 574 views

Hello Odoo community,

I was wondering is it possible that let say i have 2 fields res_partner_id which is many2one and phone_numbers which is selection.

so if i change res_partner_id it will populate my phone_numbers list. OR onchange phone_numbers selection but selection will be populated based on res_partner_id. On Openerp version 7

On version 8 it looks something like this but how do i the same on version 7?

 name = fields.Selection(selection='_get_selection' string='name')

@api.onchange('name')
def _get_selection(self):
     choise = []
     ret_ids = self.env['env'].search([])
     for amen_id in ret_ids:
         choise.append((str(amend_id.name),str(amen_id.name)))
     return choise

Any examples and Ideas would be appreciated

Thank you,

0

Axel Mendoza

--Axel Mendoza--
10205
| 7 7 8
Camaguey, Cuba
--Axel Mendoza--

DevOps - Full stack - Software Architect - Developer - Technology Integrator

I could help you to develop anything and solve complex problems based on technologies, integrations and tricky stuffs mostly in Python with OpenERP/Odoo, Zato, Django and many others frameworks programming languages and technologies.

I offers consulting services to anyone with an unanswered questions or needs for customizations. Think about it, maybe it's better to have an expert to solve your issues and projects than having a full time employee trying to understand what to do an how

Reach me at aekroft@gmail.com

Axel Mendoza
On 2/26/16, 12:22 PM

Selection fields won't be able to change it's value using onchange, switch to a many2one if you wanna do it where you could apply a domain to the field restricting the values to select. With selection fields you can't do that

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/26/16, 11:48 AM
Seen: 574 times
Last updated: 2/26/16, 12:22 PM