[ADD] web_unsplash: Find free high-resolution images from Unsplash
This commit: 1. Adds settings to install the new `web_unsplash` enterprise module. See counterpart commit on enterprise for details. 2. Export `ImageWidget` and `update_control_panel` to be able to override them. 3. Add the unsplash access key rights to website designer. (see related OE commit) task-35060 Closes #25825, closes #25637
This commit is contained in:
@@ -30,6 +30,7 @@ class ResConfigSettings(models.TransientModel):
|
|||||||
module_inter_company_rules = fields.Boolean("Manage Inter Company")
|
module_inter_company_rules = fields.Boolean("Manage Inter Company")
|
||||||
module_pad = fields.Boolean("Collaborative Pads")
|
module_pad = fields.Boolean("Collaborative Pads")
|
||||||
module_voip = fields.Boolean("Asterisk (VoIP)")
|
module_voip = fields.Boolean("Asterisk (VoIP)")
|
||||||
|
module_web_unsplash = fields.Boolean("Unsplash Image Library")
|
||||||
company_share_partner = fields.Boolean(string='Share partners to all companies',
|
company_share_partner = fields.Boolean(string='Share partners to all companies',
|
||||||
help="Share your partners to all companies defined in your instance.\n"
|
help="Share your partners to all companies defined in your instance.\n"
|
||||||
" * Checked : Partners are visible for every companies, even if a company is defined on the partner.\n"
|
" * Checked : Partners are visible for every companies, even if a company is defined on the partner.\n"
|
||||||
|
|||||||
@@ -233,6 +233,17 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col-xs-12 col-md-6 o_setting_box">
|
||||||
|
<div class="o_setting_left_pane">
|
||||||
|
<field name="module_web_unsplash" widget="upgrade_boolean"/>
|
||||||
|
</div>
|
||||||
|
<div class="o_setting_right_pane" id="web_unsplash_settings">
|
||||||
|
<label for="module_web_unsplash"/>
|
||||||
|
<div class="text-muted">
|
||||||
|
Find free high-resolution images from Unsplash
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</xpath>
|
</xpath>
|
||||||
|
|||||||
@@ -1103,6 +1103,7 @@ var MediaDialog = Dialog.extend({
|
|||||||
}),
|
}),
|
||||||
custom_events: _.extend({}, Dialog.prototype.custom_events || {}, {
|
custom_events: _.extend({}, Dialog.prototype.custom_events || {}, {
|
||||||
save_request: '_onSaveRequest',
|
save_request: '_onSaveRequest',
|
||||||
|
update_control_panel: '_updateControlPanel',
|
||||||
}),
|
}),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1768,5 +1769,6 @@ return {
|
|||||||
MediaDialog: MediaDialog,
|
MediaDialog: MediaDialog,
|
||||||
LinkDialog: LinkDialog,
|
LinkDialog: LinkDialog,
|
||||||
CropImageDialog: CropImageDialog,
|
CropImageDialog: CropImageDialog,
|
||||||
|
ImageWidget: ImageWidget,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -109,7 +109,7 @@
|
|||||||
<span class="text-muted">— or —</span>
|
<span class="text-muted">— or —</span>
|
||||||
<label for="imageurl">Add an image URL</label>
|
<label for="imageurl">Add an image URL</label>
|
||||||
<div class="form-group btn-group">
|
<div class="form-group btn-group">
|
||||||
<input type="text" class="form-control url pull-left" id="imageurl" name="url" placeholder="https://www.odoo.com/logo.png" style="width: 320px;"/>
|
<input type="text" class="form-control url pull-left" id="imageurl" name="url" placeholder="https://www.odoo.com/logo.png" style="width: 250px;"/>
|
||||||
<button type="button" class="btn btn-default o_upload_image_url_button" disabled="disabled">Add</button>
|
<button type="button" class="btn btn-default o_upload_image_url_button" disabled="disabled">Add</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||||
|
|
||||||
from odoo import fields, models
|
from odoo import api, fields, models
|
||||||
|
|
||||||
|
|
||||||
class ResUsers(models.Model):
|
class ResUsers(models.Model):
|
||||||
@@ -11,3 +11,10 @@ class ResUsers(models.Model):
|
|||||||
selection=lambda self: self._get_group_selection('base.module_category_website'),
|
selection=lambda self: self._get_group_selection('base.module_category_website'),
|
||||||
string='Website Editor', compute='_compute_groups_id', inverse='_inverse_groups_id',
|
string='Website Editor', compute='_compute_groups_id', inverse='_inverse_groups_id',
|
||||||
category_xml_id='base.module_category_website')
|
category_xml_id='base.module_category_website')
|
||||||
|
|
||||||
|
@api.multi
|
||||||
|
def _has_unsplash_key_rights(self):
|
||||||
|
self.ensure_one()
|
||||||
|
if self.has_group('website.group_website_designer'):
|
||||||
|
return True
|
||||||
|
return super(ResUsers, self)._has_unsplash_key_rights()
|
||||||
|
|||||||
Reference in New Issue
Block a user