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.

104 lines
3.6 KiB

  1. ###################################################################################
  2. #
  3. # Copyright (C) 2017 MuK IT GmbH
  4. #
  5. # This program is free software: you can redistribute it and/or modify
  6. # it under the terms of the GNU Affero General Public License as
  7. # published by the Free Software Foundation, either version 3 of the
  8. # License, or (at your option) any later version.
  9. #
  10. # This program is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. # GNU Affero General Public License for more details.
  14. #
  15. # You should have received a copy of the GNU Affero General Public License
  16. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. #
  18. ###################################################################################
  19. from odoo import api, fields, models
  20. class ResConfigSettings(models.TransientModel):
  21. _inherit = 'res.config.settings'
  22. #----------------------------------------------------------
  23. # Database
  24. #----------------------------------------------------------
  25. module_muk_web_branding = fields.Boolean(
  26. string="Web Branding",
  27. help="Customize the backend according to your needs.")
  28. module_muk_mail_branding = fields.Boolean(
  29. string="Mail Branding",
  30. help="Brand your outgoing mails with your own style.")
  31. module_muk_website_branding = fields.Boolean(
  32. string="Website Branding",
  33. help="Brand the website according to your needs.")
  34. module_muk_pos_branding = fields.Boolean(
  35. string="PoS Branding",
  36. help="Brand the PoS panel according to your needs.")
  37. branding_system_name = fields.Char(
  38. string='System Name')
  39. branding_publisher = fields.Char(
  40. string='Publisher')
  41. branding_website = fields.Char(
  42. string='Website URL')
  43. branding_documentation = fields.Char(
  44. string='Documentation URL')
  45. branding_support = fields.Char(
  46. string='Support URL')
  47. branding_store = fields.Char(
  48. string='Store URL')
  49. branding_share = fields.Char(
  50. string='Share URL')
  51. branding_company_name = fields.Char(
  52. string='Company Name',
  53. related='company_id.name',
  54. readonly=False)
  55. branding_company_logo = fields.Binary(
  56. string='Company Logo',
  57. related='company_id.logo',
  58. readonly=False)
  59. branding_company_favicon = fields.Binary(
  60. string='Company Favicon',
  61. related='company_id.favicon',
  62. readonly=False)
  63. #----------------------------------------------------------
  64. # Functions
  65. #----------------------------------------------------------
  66. @api.model
  67. def get_values(self):
  68. res = super(ResConfigSettings, self).get_values()
  69. params = self.env['ir.config_parameter'].sudo()
  70. res.update(params.get_branding_settings_params())
  71. return res
  72. @api.multi
  73. def set_values(self):
  74. res = super(ResConfigSettings, self).set_values()
  75. self.env['ir.config_parameter'].set_params({
  76. 'muk_branding.system_name': self.branding_system_name or '',
  77. 'muk_branding.publisher': self.branding_publisher or '',
  78. 'muk_branding.website': self.branding_website or '',
  79. 'muk_branding.documentation': self.branding_documentation or '',
  80. 'muk_branding.support': self.branding_support or '',
  81. 'muk_branding.store': self.branding_store or '',
  82. 'muk_branding.share': self.branding_share or '',
  83. })
  84. return res