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.

107 lines
3.7 KiB

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