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.

33 lines
1022 B

  1. # -*- coding: utf-8 -*-
  2. # Copyright 2017 ACSONE SA/NV
  3. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
  4. from openerp import api, models
  5. class WebEnvironmentRibbonBackend(models.Model):
  6. _name = 'web.environment.ribbon.backend'
  7. _description = 'Web Environment Ribbon Backend'
  8. @api.model
  9. def _prepare_ribbon_name(self):
  10. db_name = self.env.cr.dbname
  11. name = self.env['ir.config_parameter'].get_param('ribbon.name')
  12. name = name.format(db_name=db_name)
  13. return name
  14. @api.model
  15. def get_environment_ribbon(self):
  16. """
  17. This method returns the ribbon data from ir config parameters
  18. :return: dictionary
  19. """
  20. ir_config_model = self.env['ir.config_parameter']
  21. name = self._prepare_ribbon_name()
  22. return {
  23. 'name': name,
  24. 'color': ir_config_model.get_param('ribbon.color'),
  25. 'background_color': ir_config_model.get_param(
  26. 'ribbon.background.color'),
  27. }