# -*- coding: utf-8 -*- from openerp import models, fields, api class DashboardObjective(models.Model): _name = 'salesman.objective' user_id = fields.Many2one('res.users', string='Vendedor') store_id = fields.Many2one('res.store', string='Sucursal') date = fields.Date("Fecha") sale_objective = fields.Float(string="Objetivo de Ventas") @api.onchange('user_id') def onchange_user_id(self): res = {} user = self.env['res.users'].search([('id','=', self.user_id.id)]) self.store_id = user.store_id.id res = {'value' :{'store_id': self.store_id}} return res