You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

74 lines
2.4 KiB

  1. # -*- coding: utf-8 -*-
  2. ##############################################################################
  3. #
  4. # Odoo, Open Source Management Solution
  5. #
  6. # Copyright (c) All rights reserved:
  7. # (c) 2012 Agile Business Group sagl (<http://www.agilebg.com>)
  8. # (c) 2012 Domsense srl (<http://www.domsense.com>)
  9. # (c) 2015 Anubía, soluciones en la nube,SL (http://www.anubia.es)
  10. # Alejandro Santana <alejandrosantana@anubia.es>
  11. # (c) 2015 Savoir-faire Linux <http://www.savoirfairelinux.com>)
  12. # Agathe Mollé <agathe.molle@savoirfairelinux.com>
  13. #
  14. # This program is free software: you can redistribute it and/or modify
  15. # it under the terms of the GNU Affero General Public License as
  16. # published by the Free Software Foundation, either version 3 of the
  17. # License, or (at your option) any later version.
  18. #
  19. # This program is distributed in the hope that it will be useful,
  20. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  21. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  22. # GNU Affero General Public License for more details.
  23. #
  24. # You should have received a copy of the GNU Affero General Public License
  25. # along with this program. If not, see http://www.gnu.org/licenses
  26. #
  27. ##############################################################################
  28. from openerp import fields, models
  29. def _models_get(self):
  30. model_obj = self.env['ir.model']
  31. model_list = model_obj.search([])
  32. return [(model.model, model.name) for model in model_list]
  33. class SuperCalendar(models.Model):
  34. _name = 'super.calendar'
  35. name = fields.Char(
  36. string='Description',
  37. required=True,
  38. readonly=True,
  39. )
  40. date_start = fields.Datetime(
  41. string='Start date',
  42. required=True,
  43. readonly=True,
  44. )
  45. duration = fields.Float(
  46. string='Duration',
  47. readonly=True,
  48. )
  49. user_id = fields.Many2one(
  50. comodel_name='res.users',
  51. string='User',
  52. readonly=True,
  53. )
  54. configurator_id = fields.Many2one(
  55. comodel_name='super.calendar.configurator',
  56. string='Configurator',
  57. readonly=True,
  58. )
  59. res_id = fields.Reference(
  60. selection=_models_get,
  61. string='Resource',
  62. readonly=True,
  63. )
  64. model_id = fields.Many2one(
  65. comodel_name='ir.model',
  66. string='Model',
  67. readonly=True,
  68. )