Skip to content
Snippets Groups Projects
Commit 8be4567a authored by Rohan Patel's avatar Rohan Patel Committed by Romain Derie
Browse files

[IMP] website: allow to set independent website and company logos

task-1968099

closes odoo/odoo#32716

Signed-off-by: default avatarJérémy Kersten (jke) <jke@openerp.com>
parent cc87d6d4
No related branches found
No related tags found
No related merge requests found
......@@ -18,6 +18,7 @@ class ResConfigSettings(models.TransientModel):
website_domain = fields.Char('Website Domain', related='website_id.domain', readonly=False)
website_country_group_ids = fields.Many2many(related='website_id.country_group_ids', readonly=False)
website_company_id = fields.Many2one(related='website_id.company_id', string='Website Company', readonly=False)
website_logo = fields.Binary(related='website_id.logo', readonly=False)
language_ids = fields.Many2many(related='website_id.language_ids', relation='res.lang',
readonly=False)
language_count = fields.Integer(string='Number of languages', compute='_compute_language_count', readonly=True)
......
......@@ -80,6 +80,12 @@ class Website(models.Model):
def _default_social_twitter(self):
return self.env.ref('base.main_company').social_twitter
def _default_logo(self):
image_path = get_resource_path('website', 'static/src/img', 'website_logo.png')
with tools.file_open(image_path, 'rb') as f:
return base64.b64encode(f.read())
logo = fields.Binary('Website Logo', default=_default_logo, help="Display this logo on the website.")
social_twitter = fields.Char('Twitter Account', default=_default_social_twitter)
social_facebook = fields.Char('Facebook Account', default=_default_social_facebook)
social_github = fields.Char('GitHub Account', default=_default_social_github)
......
addons/website/static/src/img/website_logo.png

11.1 KiB

......@@ -130,6 +130,16 @@
</div>
</div>
</div>
<div class="col-12 col-lg-6 o_setting_box" id="website_logo_setting">
<div class="o_setting_right_pane">
<label for="website_logo"/>
<span class="fa fa-lg fa-globe" title="Values set here are website-specific." groups="website.group_multi_website"/>
<div class="text-muted">
Display this logo on the website.
</div>
<field name="website_logo" widget="image" class="w-25 mt-2"/>
</div>
</div>
<div class="col-12 col-lg-offset-6 col-lg-6 o_setting_box" id="google_analytics_setting">
<div class="o_setting_left_pane">
<field name="has_google_analytics"/>
......
......@@ -302,7 +302,7 @@
<template id="layout_logo_show" inherit_id="website.layout" name="Show Logo">
<xpath expr="//header//a[hasclass('navbar-brand')]" position="replace">
<a href="/" class="navbar-brand logo">
<span t-field="res_company.logo" t-options="{'widget': 'image'}" role="img" t-att-aria-label="'Logo of %s' % res_company.name" t-att-title="res_company.name" />
<span t-field="website.logo" t-options="{'widget': 'image'}" role="img" t-att-aria-label="'Logo of %s' % website.name" t-att-title="website.name" />
</a>
</xpath>
</template>
......
......@@ -31,6 +31,11 @@
<field name="domain"/>
</group>
</div>
<div name="logo">
<group name="logo">
<field name="logo" widget="image" class="oe_avatar float-left"/>
</group>
</div>
<div name="other">
<group name="other">
<field name="company_id" widget="selection" groups="base.group_multi_company"/>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment