Server IP : 127.0.0.2 / Your IP : 3.19.237.16 Web Server : Apache/2.4.18 (Ubuntu) System : User : www-data ( ) PHP Version : 7.0.33-0ubuntu0.16.04.16 Disable Function : disk_free_space,disk_total_space,diskfreespace,dl,exec,fpaththru,getmyuid,getmypid,highlight_file,ignore_user_abord,leak,listen,link,opcache_get_configuration,opcache_get_status,passthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,php_uname,phpinfo,posix_ctermid,posix_getcwd,posix_getegid,posix_geteuid,posix_getgid,posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid,posix,_getppid,posix_getpwnam,posix_getpwuid,posix_getrlimit,posix_getsid,posix_getuid,posix_isatty,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_times,posix_ttyname,posix_uname,pclose,popen,proc_open,proc_close,proc_get_status,proc_nice,proc_terminate,shell_exec,source,show_source,system,virtual MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /opt/odoo/addons/website/models/ |
Upload File : |
# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. from odoo import fields, models class WebsiteConfigSettings(models.TransientModel): _name = 'website.config.settings' _inherit = 'res.config.settings' def _default_website(self): return self.env['website'].search([], limit=1) website_id = fields.Many2one('website', string="website", default=_default_website, required=True) website_name = fields.Char('Website Name', related='website_id.name') language_ids = fields.Many2many(related='website_id.language_ids', relation='res.lang') default_lang_id = fields.Many2one(related='website_id.default_lang_id', relation='res.lang', required=True) default_lang_code = fields.Char('Default language code', related='website_id.default_lang_code') google_analytics_key = fields.Char('Google Analytics Key', related='website_id.google_analytics_key') social_twitter = fields.Char(related='website_id.social_twitter') social_facebook = fields.Char(related='website_id.social_facebook') social_github = fields.Char(related='website_id.social_github') social_linkedin = fields.Char(related='website_id.social_linkedin') social_youtube = fields.Char(related='website_id.social_youtube') social_googleplus = fields.Char(related='website_id.social_googleplus') cdn_activated = fields.Boolean('Use a Content Delivery Network (CDN)', related='website_id.cdn_activated') cdn_url = fields.Char(related='website_id.cdn_url') cdn_filters = fields.Text(related='website_id.cdn_filters') module_website_form_editor = fields.Selection([ (0, 'Use standard forms'), (1, 'Create and customize forms to generate emails, leads, issues and extra information in the checkout process (new snippet available)') ], "Form Builder") module_website_version = fields.Selection([ (0, 'No version management and A/B testing (easy)'), (1, 'Allow multiple versions of the same page (advanced)') ], "A/B Testing") favicon = fields.Binary('Favicon', related='website_id.favicon') # Set as global config parameter since methods using it are not website-aware. To be changed # when multi-website is implemented google_maps_api_key = fields.Char(string='Google Maps API Key') # TODO: remove me in master / saas-14 compress_html = fields.Boolean('Compress rendered HTML', related='website_id.compress_html') def set_google_maps_api_key(self): self.env['ir.config_parameter'].set_param( 'google_maps_api_key', (self.google_maps_api_key or '').strip(), groups=['base.group_system']) def get_default_google_maps_api_key(self, fields): google_maps_api_key = self.env['ir.config_parameter'].get_param('google_maps_api_key', default='') return dict(google_maps_api_key=google_maps_api_key)