salesman_objective.py 627 B

12345678910111213141516171819
  1. # -*- coding: utf-8 -*-
  2. from openerp import models, fields, api
  3. class DashboardObjective(models.Model):
  4. _name = 'salesman.objective'
  5. user_id = fields.Many2one('res.users', string='Vendedor')
  6. store_id = fields.Many2one('res.store', string='Sucursal')
  7. date = fields.Date("Fecha")
  8. sale_objective = fields.Float(string="Objetivo de Ventas")
  9. @api.onchange('user_id')
  10. def onchange_user_id(self):
  11. res = {}
  12. user = self.env['res.users'].search([('id','=', self.user_id.id)])
  13. self.store_id = user.store_id.id
  14. res = {'value' :{'store_id': self.store_id}}
  15. return res