To limit the available options based on other field values, you can use domain
. For example, this is used in the standard project_issue
module:
Quoting the corresponding lines:
class project_issue(crm.crm_case, osv.osv): _columns = { 'project_id':fields.many2one('project.project', 'Project'), 'type_id': fields.many2one ('project.task.type', 'Stages', domain="[('project_ids', '=', project_id)]"), }
In this example, the available type_id
parameters type_id
selected from the project.task.type
table depending on the value of the project_id
field.
source share