diff --git a/base_conditional_image/README.rst b/base_conditional_image/README.rst index 1e7ecba13..068edb9ea 100644 --- a/base_conditional_image/README.rst +++ b/base_conditional_image/README.rst @@ -14,16 +14,16 @@ Conditional Images :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fserver--tools-lightgray.png?logo=github - :target: https://github.com/OCA/server-tools/tree/14.0/base_conditional_image + :target: https://github.com/OCA/server-tools/tree/15.0/base_conditional_image :alt: OCA/server-tools .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/server-tools-14-0/server-tools-14-0-base_conditional_image + :target: https://translation.odoo-community.org/projects/server-tools-15-0/server-tools-15-0-base_conditional_image :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png - :target: https://runbot.odoo-community.org/runbot/149/14.0 + :target: https://runbot.odoo-community.org/runbot/149/15.0 :alt: Try me on Runbot -|badge1| |badge2| |badge3| |badge4| |badge5| +|badge1| |badge2| |badge3| |badge4| |badge5| This module extends the functionality of any model to support conditional images (based on the record attributes) and to manage them either globally or by company. @@ -45,11 +45,11 @@ Installation The sole purpose of this module is to add an abstract model to be inherited. So, you will not notice any changes on install. -To develop using this module, you have to inherit the abstract model `abstract.conditional.image` +To develop using this module, you have to inherit the abstract model `conditional.image.consumer.mixin` to the model that needs the conditional images:: class ResPartner(models.Model): - _inherit = ['res.partner', 'abstract.conditional.image'] + _inherit = ['res.partner', 'conditional.image.consumer.mixin'] _name = 'res.partner' Then, configure how the images will be selected for each record. @@ -71,7 +71,7 @@ Bug Tracker Bugs are tracked on `GitHub Issues `_. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -88,6 +88,7 @@ Contributors * `Camptocamp `_: * Patrick Tombez + * Denis Leemann * `Trobz `_: * Son Ho @@ -109,6 +110,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use. -This module is part of the `OCA/server-tools `_ project on GitHub. +This module is part of the `OCA/server-tools `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/base_conditional_image/__manifest__.py b/base_conditional_image/__manifest__.py index acaa3b7d9..200eed7b1 100644 --- a/base_conditional_image/__manifest__.py +++ b/base_conditional_image/__manifest__.py @@ -1,10 +1,10 @@ -# Copyright 2019 Camptocamp SA +# Copyright 2019-2022 Camptocamp SA # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) { "name": "Conditional Images", "summary": "This module extends the functionality to support conditional images", - "version": "14.0.1.0.0", + "version": "15.0.1.0.0", "author": "Camptocamp, Odoo Community Association (OCA)", "license": "AGPL-3", "category": "Misc", diff --git a/base_conditional_image/i18n/base_conditional_image.pot b/base_conditional_image/i18n/base_conditional_image.pot index 2311eac12..a095c2e6c 100644 --- a/base_conditional_image/i18n/base_conditional_image.pot +++ b/base_conditional_image/i18n/base_conditional_image.pot @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 14.0\n" +"Project-Id-Version: Odoo Server 15.0\n" "Report-Msgid-Bugs-To: \n" "Last-Translator: \n" "Language-Team: \n" @@ -19,18 +19,12 @@ msgid "Abstract image" msgstr "" #. module: base_conditional_image -#: code:addons/base_conditional_image/models/image.py:0 -#, python-format -msgid "At least one image type must be specified" -msgstr "" - -#. module: base_conditional_image -#: model:ir.model.fields,field_description:base_conditional_image.field_image__company_id +#: model:ir.model.fields,field_description:base_conditional_image.field_conditional_image__company_id msgid "Company" msgstr "" #. module: base_conditional_image -#: model:ir.model.fields,help:base_conditional_image.field_image__company_id +#: model:ir.model.fields,help:base_conditional_image.field_conditional_image__company_id msgid "" "Company related check. If inherited object does not have a `company_id` " "field, it will be ignored. The check will first take the records with a " @@ -38,107 +32,103 @@ msgid "" msgstr "" #. module: base_conditional_image -#: model:ir.model.fields,field_description:base_conditional_image.field_image__create_uid +#: model:ir.model,name:base_conditional_image.model_conditional_image +#: model_terms:ir.ui.view,arch_db:base_conditional_image.view_conditional_image_form +msgid "Conditional Image" +msgstr "" + +#. module: base_conditional_image +#: model:ir.actions.act_window,name:base_conditional_image.conditional_image_action +#: model:ir.ui.menu,name:base_conditional_image.conditional_image_menu +#: model_terms:ir.ui.view,arch_db:base_conditional_image.view_conditional_image_tree +msgid "Conditional Images" +msgstr "" + +#. module: base_conditional_image +#: model:ir.model.fields,field_description:base_conditional_image.field_conditional_image__create_uid msgid "Created by" msgstr "" #. module: base_conditional_image -#: model:ir.model.fields,field_description:base_conditional_image.field_image__create_date +#: model:ir.model.fields,field_description:base_conditional_image.field_conditional_image__create_date msgid "Created on" msgstr "" #. module: base_conditional_image -#: model:ir.model.fields,field_description:base_conditional_image.field_abstract_conditional_image__display_name -#: model:ir.model.fields,field_description:base_conditional_image.field_image__display_name +#: model:ir.model.fields,field_description:base_conditional_image.field_conditional_image__display_name msgid "Display Name" msgstr "" #. module: base_conditional_image -#: model:ir.model.fields,field_description:base_conditional_image.field_abstract_conditional_image__id -#: model:ir.model.fields,field_description:base_conditional_image.field_image__id +#: model:ir.model.fields,field_description:base_conditional_image.field_conditional_image__id msgid "ID" msgstr "" #. module: base_conditional_image -#: model:ir.model,name:base_conditional_image.model_image -#: model:ir.model.fields,field_description:base_conditional_image.field_abstract_conditional_image__image -#: model:ir.model.fields,field_description:base_conditional_image.field_image__image +#: model:ir.model.fields,field_description:base_conditional_image.field_abstract_conditional_image__image_1920 +#: model:ir.model.fields,field_description:base_conditional_image.field_conditional_image__image_1920 msgid "Image" msgstr "" #. module: base_conditional_image -#: model:ir.actions.act_window,name:base_conditional_image.image_action -#: model:ir.ui.menu,name:base_conditional_image.image_menu -msgid "Images" +#: model:ir.model.fields,field_description:base_conditional_image.field_abstract_conditional_image__image_1024 +#: model:ir.model.fields,field_description:base_conditional_image.field_conditional_image__image_1024 +msgid "Image 1024" msgstr "" #. module: base_conditional_image -#: model:ir.model.fields,field_description:base_conditional_image.field_abstract_conditional_image____last_update -#: model:ir.model.fields,field_description:base_conditional_image.field_image____last_update +#: model:ir.model.fields,field_description:base_conditional_image.field_abstract_conditional_image__image_128 +#: model:ir.model.fields,field_description:base_conditional_image.field_conditional_image__image_128 +msgid "Image 128" +msgstr "" + +#. module: base_conditional_image +#: model:ir.model.fields,field_description:base_conditional_image.field_abstract_conditional_image__image_256 +#: model:ir.model.fields,field_description:base_conditional_image.field_conditional_image__image_256 +msgid "Image 256" +msgstr "" + +#. module: base_conditional_image +#: model:ir.model.fields,field_description:base_conditional_image.field_abstract_conditional_image__image_512 +#: model:ir.model.fields,field_description:base_conditional_image.field_conditional_image__image_512 +msgid "Image 512" +msgstr "" + +#. module: base_conditional_image +#: model:ir.model.fields,field_description:base_conditional_image.field_conditional_image____last_update msgid "Last Modified on" msgstr "" #. module: base_conditional_image -#: model:ir.model.fields,field_description:base_conditional_image.field_image__write_uid +#: model:ir.model.fields,field_description:base_conditional_image.field_conditional_image__write_uid msgid "Last Updated by" msgstr "" #. module: base_conditional_image -#: model:ir.model.fields,field_description:base_conditional_image.field_image__write_date +#: model:ir.model.fields,field_description:base_conditional_image.field_conditional_image__write_date msgid "Last Updated on" msgstr "" #. module: base_conditional_image -#: model:ir.model.fields,field_description:base_conditional_image.field_abstract_conditional_image__image_medium -#: model:ir.model.fields,field_description:base_conditional_image.field_image__image_medium -msgid "Medium-sized image" -msgstr "" - -#. module: base_conditional_image -#: model:ir.model.fields,help:base_conditional_image.field_image__image_medium -msgid "" -"Medium-sized image. It is automatically resized as a 128x128px image, with " -"aspect ratio preserved. Use this field in form views or some kanban views." -msgstr "" - -#. module: base_conditional_image -#: model:ir.model.fields,field_description:base_conditional_image.field_image__model_name +#: model:ir.model.fields,field_description:base_conditional_image.field_conditional_image__model_name msgid "Model Name" msgstr "" #. module: base_conditional_image -#: model:ir.model.fields,field_description:base_conditional_image.field_image__name +#: model:ir.model.fields,field_description:base_conditional_image.field_conditional_image__name msgid "Name" msgstr "" #. module: base_conditional_image -#: model:ir.model.fields,help:base_conditional_image.field_image__selector +#: model:ir.model.fields,help:base_conditional_image.field_conditional_image__selector msgid "" -"Python expression used as selector when multiple images are usedfor the same" -" object. The variable `object` refers to the actual record on which the " +"Python expression used as selector when multiple images are usedfor the " +"same object. The variable `object` refers to the actual record on which the " "expression will be executed. An empty expression will always return `True`." msgstr "" #. module: base_conditional_image -#: model:ir.model.fields,field_description:base_conditional_image.field_image__selector -#: model_terms:ir.ui.view,arch_db:base_conditional_image.view_image_form +#: model:ir.model.fields,field_description:base_conditional_image.field_conditional_image__selector +#: model_terms:ir.ui.view,arch_db:base_conditional_image.view_conditional_image_form msgid "Selector" msgstr "" - -#. module: base_conditional_image -#: model:ir.model.fields,field_description:base_conditional_image.field_abstract_conditional_image__image_small -#: model:ir.model.fields,field_description:base_conditional_image.field_image__image_small -msgid "Small-sized image" -msgstr "" - -#. module: base_conditional_image -#: model:ir.model.fields,help:base_conditional_image.field_image__image_small -msgid "" -"Small-sized image. It is automatically resized as a 64x64px image, with " -"aspect ratio preserved. Use this field anywhere a small image is required." -msgstr "" - -#. module: base_conditional_image -#: model:ir.model.fields,help:base_conditional_image.field_image__image -msgid "This field holds the standard image, limited to 1024x1024px" -msgstr "" diff --git a/base_conditional_image/i18n/custom_image.pot b/base_conditional_image/i18n/custom_image.pot deleted file mode 100644 index bf3f96c91..000000000 --- a/base_conditional_image/i18n/custom_image.pot +++ /dev/null @@ -1,141 +0,0 @@ -# Translation of Odoo Server. -# This file contains the translation of the following modules: -# * custom_image -# -msgid "" -msgstr "" -"Project-Id-Version: Odoo Server 9.0e\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-10-02 08:36+0000\n" -"PO-Revision-Date: 2018-10-02 08:36+0000\n" -"Last-Translator: <>\n" -"Language-Team: \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: \n" -"Plural-Forms: \n" - -#. module: custom_image -#: code:addons/custom_image/models/image.py:47 -#, python-format -msgid "At least one image type must be specified" -msgstr "" - -#. module: custom_image -#: model:ir.model.fields,field_description:custom_image.field_image_company_id -msgid "Company" -msgstr "" - -#. module: custom_image -#: model:ir.model.fields,help:custom_image.field_image_company_id -msgid "Company related check. If inherited object does not have a `company_id` field, it will be ignored. The check will first take the records with a company then, if not match is found, the ones without a company." -msgstr "" - -#. module: custom_image -#: model:ir.model.fields,field_description:custom_image.field_image_create_uid -msgid "Created by" -msgstr "" - -#. module: custom_image -#: model:ir.model.fields,field_description:custom_image.field_image_create_date -msgid "Created on" -msgstr "" - -#. module: custom_image -#: model:ir.model.fields,field_description:custom_image.field_abstract_custom_image_display_name -#: model:ir.model.fields,field_description:custom_image.field_image_display_name -msgid "Display Name" -msgstr "" - -#. module: custom_image -#: model:ir.model.fields,field_description:custom_image.field_abstract_custom_image_id -#: model:ir.model.fields,field_description:custom_image.field_image_id -msgid "ID" -msgstr "" - -#. module: custom_image -#: model:ir.model.fields,field_description:custom_image.field_abstract_custom_image_image -#: model:ir.model.fields,field_description:custom_image.field_abstract_custom_image_image_medium -#: model:ir.model.fields,field_description:custom_image.field_abstract_custom_image_image_small -#: model:ir.model.fields,field_description:custom_image.field_image_image -msgid "Image" -msgstr "" - -#. module: custom_image -#: model:ir.actions.act_window,name:custom_image.image_action -#: model:ir.ui.menu,name:custom_image.image_menu -msgid "Images" -msgstr "" - -#. module: custom_image -#: model:ir.model.fields,field_description:custom_image.field_abstract_custom_image___last_update -#: model:ir.model.fields,field_description:custom_image.field_image___last_update -msgid "Last Modified on" -msgstr "" - -#. module: custom_image -#: model:ir.model.fields,field_description:custom_image.field_image_write_uid -msgid "Last Updated by" -msgstr "" - -#. module: custom_image -#: model:ir.model.fields,field_description:custom_image.field_image_write_date -msgid "Last Updated on" -msgstr "" - -#. module: custom_image -#: model:ir.model.fields,field_description:custom_image.field_image_image_medium -msgid "Medium-sized image" -msgstr "" - -#. module: custom_image -#: model:ir.model.fields,help:custom_image.field_image_image_medium -msgid "Medium-sized image. It is automatically resized as a 128x128px image, with aspect ratio preserved. Use this field in form views or some kanban views." -msgstr "" - -#. module: custom_image -#: model:ir.model.fields,field_description:custom_image.field_image_model_name -msgid "Model Name" -msgstr "" - -#. module: custom_image -#: model:ir.model.fields,field_description:custom_image.field_image_name -msgid "Name" -msgstr "" - -#. module: custom_image -#: model:ir.model.fields,help:custom_image.field_image_selector -msgid "Python expression used to distinguish the images for the same object. The variable `object` refer to the actual record on which the expression will be executed. An empty expression will always return `True`." -msgstr "" - -#. module: custom_image -#: model:ir.model.fields,field_description:custom_image.field_image_selector -#: model:ir.ui.view,arch_db:custom_image.view_image_form -msgid "Selector" -msgstr "" - -#. module: custom_image -#: model:ir.model.fields,field_description:custom_image.field_image_image_small -msgid "Small-sized image" -msgstr "" - -#. module: custom_image -#: model:ir.model.fields,help:custom_image.field_image_image_small -msgid "Small-sized image. It is automatically resized as a 64x64px image, with aspect ratio preserved. Use this field anywhere a small image is required." -msgstr "" - -#. module: custom_image -#: model:ir.model.fields,help:custom_image.field_image_image -msgid "This field holds the standard image, limited to 1024x1024px" -msgstr "" - -#. module: custom_image -#: model:ir.model,name:custom_image.model_abstract_custom_image -msgid "abstract.custom.image" -msgstr "" - -#. module: custom_image -#: model:ir.model,name:custom_image.model_image -msgid "image" -msgstr "" - diff --git a/base_conditional_image/models/__init__.py b/base_conditional_image/models/__init__.py index 8deef0ec7..e3eb58eca 100644 --- a/base_conditional_image/models/__init__.py +++ b/base_conditional_image/models/__init__.py @@ -1,2 +1,2 @@ -from . import image -from . import abstract_image +from . import conditional_image_consumer_mixin +from . import conditional_image diff --git a/base_conditional_image/models/abstract_image.py b/base_conditional_image/models/abstract_image.py deleted file mode 100644 index 9eefb6c1c..000000000 --- a/base_conditional_image/models/abstract_image.py +++ /dev/null @@ -1,69 +0,0 @@ -# Copyright 2019 Camptocamp SA -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) - -from odoo import fields, models -from odoo.tools.safe_eval import safe_eval - - -class AbstractConditionalImage(models.AbstractModel): - _name = "abstract.conditional.image" - _description = "Abstract image" - - image = fields.Binary(compute="_compute_image", store=False, readonly=True) - image_medium = fields.Binary( - compute="_compute_image", - string="Medium-sized image", - store=False, - readonly=True, - ) - image_small = fields.Binary( - compute="_compute_image", string="Small-sized image", store=False, readonly=True - ) - - @staticmethod - def _compute_selector_test_without_company(image_selector, record): - return bool(safe_eval(image_selector.selector or "True", {"object": record})) - - @staticmethod - def _compute_selector_test_with_company(image_selector, record): - if ( - image_selector.company_id == record.company_id - or record.company_id - and not image_selector.company_id - ): - return AbstractConditionalImage._compute_selector_test_without_company( - image_selector, record - ) - return False - - def _compute_image(self): - if "company_id" in self._fields: - search_clause = [("model_name", "=", self._name)] - test_method = self._compute_selector_test_with_company - else: - # If inherited object doesn't have a `company_id` field, - # remove the items with a company defined and the related checks - search_clause = [ - ("model_name", "=", self._name), - ("company_id", "=", False), - ] - test_method = self._compute_selector_test_without_company - - image_selectors = self.env["image"].search( - search_clause, order="company_id, selector" - ) - - for rec in self: - found = None - for image_selector in image_selectors: - if test_method(image_selector, rec): - found = image_selector - break - - rec.update( - { - "image": found and found.image, - "image_medium": found and found.image_medium, - "image_small": found and found.image_small, - } - ) diff --git a/base_conditional_image/models/conditional_image.py b/base_conditional_image/models/conditional_image.py new file mode 100644 index 000000000..37ed3bb04 --- /dev/null +++ b/base_conditional_image/models/conditional_image.py @@ -0,0 +1,27 @@ +# Copyright 2022 Camptocamp SA +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) + +from odoo import fields, models + + +class ConditionalImage(models.Model): + _name = "conditional.image" + _description = "Conditional Image" + _inherit = ["image.mixin"] + + name = fields.Char(required=True) + model_name = fields.Char(required=True) + selector = fields.Text( + help="Python expression used as selector when multiple images are used" + "for the same object. The variable `object` refers " + "to the actual record on which the expression will be executed. " + "An empty expression will always return `True`.", + ) + company_id = fields.Many2one( + "res.company", + "Company", + help="Company related check. If inherited object does not have a " + "`company_id` field, it will be ignored. " + "The check will first take the records with a company then, " + "if no match is found, the ones without a company.", + ) diff --git a/base_conditional_image/models/conditional_image_consumer_mixin.py b/base_conditional_image/models/conditional_image_consumer_mixin.py new file mode 100644 index 000000000..054ffa702 --- /dev/null +++ b/base_conditional_image/models/conditional_image_consumer_mixin.py @@ -0,0 +1,67 @@ +# Copyright 2022 Camptocamp SA +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) + +from odoo import fields, models +from odoo.tools.safe_eval import safe_eval + + +class ConditionalImageConsumerMixin(models.AbstractModel): + _name = "conditional.image.consumer.mixin" + _description = "Mixin for conditional images consumers" + _inherit = "image.mixin" + + image_1920 = fields.Image(compute="_compute_images", store=False, readonly=True) + image_1024 = fields.Image(compute="_compute_images", store=False, readonly=True) + image_512 = fields.Image(compute="_compute_images", store=False, readonly=True) + image_256 = fields.Image(compute="_compute_images", store=False, readonly=True) + image_128 = fields.Image(compute="_compute_images", store=False, readonly=True) + + def _conditional_image_evaluate_selector(self, conditional_image): + self.ensure_one() + if conditional_image.selector: + if ( + conditional_image.company_id == self.company_id + or self.company_id + and not conditional_image.company_id + ): + return bool( + safe_eval(conditional_image.selector or "True", {"object": self}) + ) + return False + + def _compute_images(self): + if "company_id" in self._fields: + search_clause = [("model_name", "=", self._name)] + else: + # If inherited object doesn't have a `company_id` field, + # remove the items with a company defined and the related checks + search_clause = [ + ("model_name", "=", self._name), + ("company_id", "=", False), + ] + + conditional_images = self.env["conditional.image"].search( + search_clause, order="company_id, selector" + ) + + for record in self: + images_found = conditional_images.filtered( + lambda img: record._conditional_image_evaluate_selector(img) + ) + values = { + "image_1920": False, + "image_1024": False, + "image_512": False, + "image_256": False, + "image_128": False, + } + if images_found: + image = images_found[0] + values = { + "image_1920": image.image_1920, + "image_1024": image.image_1024, + "image_512": image.image_512, + "image_256": image.image_256, + "image_128": image.image_128, + } + record.update(values) diff --git a/base_conditional_image/models/image.py b/base_conditional_image/models/image.py deleted file mode 100644 index 227b26a73..000000000 --- a/base_conditional_image/models/image.py +++ /dev/null @@ -1,66 +0,0 @@ -# Copyright 2019 Camptocamp SA -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) - -from odoo import _, api, fields, models, tools -from odoo.exceptions import ValidationError - - -class Image(models.Model): - _name = "image" - _description = "Image" - - name = fields.Char(required=True) - model_name = fields.Char(required=True) - selector = fields.Text( - help="Python expression used as selector when multiple images are used" - "for the same object. The variable `object` refers " - "to the actual record on which the expression will be executed. " - "An empty expression will always return `True`.", - ) - company_id = fields.Many2one( - "res.company", - "Company", - help="Company related check. If inherited object does not have a " - "`company_id` field, it will be ignored. " - "The check will first take the records with a company then, " - "if no match is found, the ones without a company.", - ) - - # image: all image fields are base64 encoded and PIL-supported - image = fields.Binary( - attachment=True, - help="This field holds the standard image, limited to 1024x1024px", - ) - image_medium = fields.Binary( - "Medium-sized image", - attachment=True, - help="Medium-sized image. It is automatically " - "resized as a 128x128px image, with aspect ratio preserved. " - "Use this field in form views or some kanban views.", - ) - image_small = fields.Binary( - "Small-sized image", - attachment=True, - help="Small-sized image. It is automatically " - "resized as a 64x64px image, with aspect ratio preserved. " - "Use this field anywhere a small image is required.", - ) - - @api.model - def _process_images(self, vals, required=False): - if {"image", "image_medium", "image_small"} & set(vals.keys()): - vals["image_medium"] = tools.image_process( - vals.get("image"), size=(128, 128) - ) - vals["image_small"] = tools.image_process(vals.get("image"), size=(64, 64)) - elif required: - raise ValidationError(_("At least one image type must be specified")) - - @api.model - def create(self, vals): - self._process_images(vals, required=True) - return super().create(vals) - - def write(self, vals): - self._process_images(vals) - return super().write(vals) diff --git a/base_conditional_image/readme/CONTRIBUTORS.rst b/base_conditional_image/readme/CONTRIBUTORS.rst index 0b6b45600..cc8227538 100644 --- a/base_conditional_image/readme/CONTRIBUTORS.rst +++ b/base_conditional_image/readme/CONTRIBUTORS.rst @@ -1,4 +1,5 @@ * `Camptocamp `_: * Patrick Tombez + * Denis Leemann * `Trobz `_: * Son Ho diff --git a/base_conditional_image/readme/INSTALL.rst b/base_conditional_image/readme/INSTALL.rst index 18474d1c9..ef318f558 100644 --- a/base_conditional_image/readme/INSTALL.rst +++ b/base_conditional_image/readme/INSTALL.rst @@ -1,11 +1,11 @@ The sole purpose of this module is to add an abstract model to be inherited. So, you will not notice any changes on install. -To develop using this module, you have to inherit the abstract model `abstract.conditional.image` +To develop using this module, you have to inherit the abstract model `conditional.image.consumer.mixin` to the model that needs the conditional images:: class ResPartner(models.Model): - _inherit = ['res.partner', 'abstract.conditional.image'] + _inherit = ['res.partner', 'conditional.image.consumer.mixin'] _name = 'res.partner' Then, configure how the images will be selected for each record. diff --git a/base_conditional_image/security/ir.model.access.csv b/base_conditional_image/security/ir.model.access.csv index 0609565ce..0d9ca2bc7 100644 --- a/base_conditional_image/security/ir.model.access.csv +++ b/base_conditional_image/security/ir.model.access.csv @@ -1,3 +1,3 @@ id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink -access_conditional_image,Conditional Image,base_conditional_image.model_image,base.group_no_one,1,1,1,1 -access_conditional_image_users,Conditional Image Users,base_conditional_image.model_image,base.group_user,1,0,0,0 +access_conditional_image,Conditional Image,base_conditional_image.model_conditional_image,base.group_no_one,1,1,1,1 +access_conditional_image_users,Conditional Image Users,base_conditional_image.model_conditional_image,base.group_user,1,0,0,0 diff --git a/base_conditional_image/static/description/index.html b/base_conditional_image/static/description/index.html index 9861a6884..2dfb7bf89 100644 --- a/base_conditional_image/static/description/index.html +++ b/base_conditional_image/static/description/index.html @@ -3,7 +3,7 @@ - + Conditional Images