diff --git a/base_conditional_image/README.rst b/base_conditional_image/README.rst new file mode 100644 index 00000000000..adb45e5597e --- /dev/null +++ b/base_conditional_image/README.rst @@ -0,0 +1,115 @@ +================== +Conditional Images +================== + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :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/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-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/15.0 + :alt: Try me on Runbot + +|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. + +The main goal behind this module is to avoid storing the same image multiple times. +For example, for every partner, there is a related image (most of the time, it's the default one). +With this module properly set up, it will be stored only one time and you can change it whenever you want for all partners. + +**WARNING**: this module cannot be used on the same objects using the module `base_multi_image`. + +**Table of contents** + +.. contents:: + :local: + +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 `conditional.image.consumer.mixin` +to the model that needs the conditional images:: + + class ResPartner(models.Model): + _inherit = ['res.partner', 'conditional.image.consumer.mixin'] + _name = 'res.partner' + +Then, configure how the images will be selected for each record. + +Usage +===== + +Go to *Technical Settings > Settings > Images* to configure all the images. +You can define images for specific objects, depending on the attributes and the company of the object. + +The `selector` should return a boolean expression. All fields of the object are available to compute the result. + +The system will first try to match an image with a company set up, then with the ones without a company. +If your object does not have a `company_id` field, this check will be ignored and only images without a company will be used. + +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 `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Camptocamp + +Contributors +~~~~~~~~~~~~ + +* `Camptocamp `_: + * Patrick Tombez + * Denis Leemann +* `Trobz `_: + * Son Ho + +Other credits +~~~~~~~~~~~~~ + +The migration of this module from 12.0 to 14.0 was financially supported by Camptocamp + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +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. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/base_conditional_image/__init__.py b/base_conditional_image/__init__.py new file mode 100644 index 00000000000..0650744f6bc --- /dev/null +++ b/base_conditional_image/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/base_conditional_image/__manifest__.py b/base_conditional_image/__manifest__.py new file mode 100644 index 00000000000..fba87556beb --- /dev/null +++ b/base_conditional_image/__manifest__.py @@ -0,0 +1,20 @@ +# 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": "16.0.1.0.0", + "author": "Camptocamp, Odoo Community Association (OCA)", + "license": "AGPL-3", + "category": "Misc", + "depends": [ + "base", + ], + "website": "https://github.com/OCA/server-tools", + "data": [ + "views/image_view.xml", + "security/ir.model.access.csv", + ], + "installable": True, +} diff --git a/base_conditional_image/i18n/base_conditional_image.pot b/base_conditional_image/i18n/base_conditional_image.pot new file mode 100644 index 00000000000..2a184719cb8 --- /dev/null +++ b/base_conditional_image/i18n/base_conditional_image.pot @@ -0,0 +1,133 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * base_conditional_image +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 15.0\n" +"Report-Msgid-Bugs-To: \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: base_conditional_image +#: 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_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 " +"company then, if no match is found, the ones without a company." +msgstr "" + +#. module: base_conditional_image +#: 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 +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_conditional_image__create_date +msgid "Created on" +msgstr "" + +#. module: base_conditional_image +#: 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_conditional_image__id +msgid "ID" +msgstr "" + +#. module: base_conditional_image +#: model:ir.model.fields,field_description:base_conditional_image.field_conditional_image__image_1920 +#: model:ir.model.fields,field_description:base_conditional_image.field_conditional_image_consumer_mixin__image_1920 +msgid "Image" +msgstr "" + +#. module: base_conditional_image +#: model:ir.model.fields,field_description:base_conditional_image.field_conditional_image__image_1024 +#: model:ir.model.fields,field_description:base_conditional_image.field_conditional_image_consumer_mixin__image_1024 +msgid "Image 1024" +msgstr "" + +#. module: base_conditional_image +#: model:ir.model.fields,field_description:base_conditional_image.field_conditional_image__image_128 +#: model:ir.model.fields,field_description:base_conditional_image.field_conditional_image_consumer_mixin__image_128 +msgid "Image 128" +msgstr "" + +#. module: base_conditional_image +#: model:ir.model.fields,field_description:base_conditional_image.field_conditional_image__image_256 +#: model:ir.model.fields,field_description:base_conditional_image.field_conditional_image_consumer_mixin__image_256 +msgid "Image 256" +msgstr "" + +#. module: base_conditional_image +#: model:ir.model.fields,field_description:base_conditional_image.field_conditional_image__image_512 +#: model:ir.model.fields,field_description:base_conditional_image.field_conditional_image_consumer_mixin__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_conditional_image__write_uid +msgid "Last Updated by" +msgstr "" + +#. module: base_conditional_image +#: 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,name:base_conditional_image.model_conditional_image_consumer_mixin +msgid "Mixin for conditional images consumers" +msgstr "" + +#. module: base_conditional_image +#: 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_conditional_image__name +msgid "Name" +msgstr "" + +#. module: base_conditional_image +#: 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 " +"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_conditional_image__selector +#: model_terms:ir.ui.view,arch_db:base_conditional_image.view_conditional_image_form +msgid "Selector" +msgstr "" diff --git a/base_conditional_image/i18n/es_AR.po b/base_conditional_image/i18n/es_AR.po new file mode 100644 index 00000000000..a21213b8354 --- /dev/null +++ b/base_conditional_image/i18n/es_AR.po @@ -0,0 +1,144 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * base_conditional_image +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 15.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2022-10-09 22:36+0000\n" +"Last-Translator: Ignacio Buioli \n" +"Language-Team: none\n" +"Language: es_AR\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.3.2\n" + +#. module: base_conditional_image +#: model:ir.model.fields,field_description:base_conditional_image.field_conditional_image__company_id +msgid "Company" +msgstr "Compañía" + +#. module: base_conditional_image +#: 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 " +"company then, if no match is found, the ones without a company." +msgstr "" +"Verificación de compañía relacionada. Si el objeto heredado no tiene un " +"campo `company_id`, se ignorará. La verificación tomará primero los " +"registros con una compañía y luego, si no se encuentra ninguna coincidencia, " +"los que no tengan una compañía." + +#. module: base_conditional_image +#: 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 "Imagen Condicional" + +#. 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 +msgid "Conditional Images" +msgstr "Imágenes Condicionales" + +#. module: base_conditional_image +#: model:ir.model.fields,field_description:base_conditional_image.field_conditional_image__create_uid +msgid "Created by" +msgstr "Creado por" + +#. module: base_conditional_image +#: model:ir.model.fields,field_description:base_conditional_image.field_conditional_image__create_date +msgid "Created on" +msgstr "Creado en" + +#. module: base_conditional_image +#: model:ir.model.fields,field_description:base_conditional_image.field_conditional_image__display_name +msgid "Display Name" +msgstr "Mostrar Nombre" + +#. module: base_conditional_image +#: model:ir.model.fields,field_description:base_conditional_image.field_conditional_image__id +msgid "ID" +msgstr "ID" + +#. module: base_conditional_image +#: model:ir.model.fields,field_description:base_conditional_image.field_conditional_image__image_1920 +#: model:ir.model.fields,field_description:base_conditional_image.field_conditional_image_consumer_mixin__image_1920 +msgid "Image" +msgstr "Imagen" + +#. module: base_conditional_image +#: model:ir.model.fields,field_description:base_conditional_image.field_conditional_image__image_1024 +#: model:ir.model.fields,field_description:base_conditional_image.field_conditional_image_consumer_mixin__image_1024 +msgid "Image 1024" +msgstr "Imagen 1024" + +#. module: base_conditional_image +#: model:ir.model.fields,field_description:base_conditional_image.field_conditional_image__image_128 +#: model:ir.model.fields,field_description:base_conditional_image.field_conditional_image_consumer_mixin__image_128 +msgid "Image 128" +msgstr "Imagen 128" + +#. module: base_conditional_image +#: model:ir.model.fields,field_description:base_conditional_image.field_conditional_image__image_256 +#: model:ir.model.fields,field_description:base_conditional_image.field_conditional_image_consumer_mixin__image_256 +msgid "Image 256" +msgstr "Imagen 256" + +#. module: base_conditional_image +#: model:ir.model.fields,field_description:base_conditional_image.field_conditional_image__image_512 +#: model:ir.model.fields,field_description:base_conditional_image.field_conditional_image_consumer_mixin__image_512 +msgid "Image 512" +msgstr "Imagen 512" + +#. module: base_conditional_image +#: model:ir.model.fields,field_description:base_conditional_image.field_conditional_image____last_update +msgid "Last Modified on" +msgstr "Última modificación en" + +#. module: base_conditional_image +#: model:ir.model.fields,field_description:base_conditional_image.field_conditional_image__write_uid +msgid "Last Updated by" +msgstr "Última actualización realizada por" + +#. module: base_conditional_image +#: model:ir.model.fields,field_description:base_conditional_image.field_conditional_image__write_date +msgid "Last Updated on" +msgstr "Última actualización el" + +#. module: base_conditional_image +#: model:ir.model,name:base_conditional_image.model_conditional_image_consumer_mixin +msgid "Mixin for conditional images consumers" +msgstr "Mixin para consumidores de imágenes condicionales" + +#. module: base_conditional_image +#: model:ir.model.fields,field_description:base_conditional_image.field_conditional_image__model_name +msgid "Model Name" +msgstr "Nombre del Modelo" + +#. module: base_conditional_image +#: model:ir.model.fields,field_description:base_conditional_image.field_conditional_image__name +msgid "Name" +msgstr "Nombre" + +#. module: base_conditional_image +#: 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 " +"expression will be executed. An empty expression will always return `True`." +msgstr "" +"Expresión de Python utilizada como selector cuando se utilizan varias " +"imágenes para el mismo objeto. La variable `objet` se refiere al registro " +"real en el que se ejecutará la expresión. Una expresión vacía siempre " +"devolverá `True`." + +#. module: base_conditional_image +#: 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 "Selector" diff --git a/base_conditional_image/models/__init__.py b/base_conditional_image/models/__init__.py new file mode 100644 index 00000000000..e3eb58ecae5 --- /dev/null +++ b/base_conditional_image/models/__init__.py @@ -0,0 +1,2 @@ +from . import conditional_image_consumer_mixin +from . import conditional_image diff --git a/base_conditional_image/models/conditional_image.py b/base_conditional_image/models/conditional_image.py new file mode 100644 index 00000000000..37ed3bb049e --- /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 00000000000..054ffa702bc --- /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/readme/CONTRIBUTORS.rst b/base_conditional_image/readme/CONTRIBUTORS.rst new file mode 100644 index 00000000000..cc8227538af --- /dev/null +++ b/base_conditional_image/readme/CONTRIBUTORS.rst @@ -0,0 +1,5 @@ +* `Camptocamp `_: + * Patrick Tombez + * Denis Leemann +* `Trobz `_: + * Son Ho diff --git a/base_conditional_image/readme/CREDITS.rst b/base_conditional_image/readme/CREDITS.rst new file mode 100644 index 00000000000..ca6e4f9cdb3 --- /dev/null +++ b/base_conditional_image/readme/CREDITS.rst @@ -0,0 +1 @@ +The migration of this module from 12.0 to 14.0 was financially supported by Camptocamp diff --git a/base_conditional_image/readme/DESCRIPTION.rst b/base_conditional_image/readme/DESCRIPTION.rst new file mode 100644 index 00000000000..43630823e69 --- /dev/null +++ b/base_conditional_image/readme/DESCRIPTION.rst @@ -0,0 +1,8 @@ +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. + +The main goal behind this module is to avoid storing the same image multiple times. +For example, for every partner, there is a related image (most of the time, it's the default one). +With this module properly set up, it will be stored only one time and you can change it whenever you want for all partners. + +**WARNING**: this module cannot be used on the same objects using the module `base_multi_image`. diff --git a/base_conditional_image/readme/INSTALL.rst b/base_conditional_image/readme/INSTALL.rst new file mode 100644 index 00000000000..ef318f5581c --- /dev/null +++ b/base_conditional_image/readme/INSTALL.rst @@ -0,0 +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 `conditional.image.consumer.mixin` +to the model that needs the conditional images:: + + class ResPartner(models.Model): + _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/readme/USAGE.rst b/base_conditional_image/readme/USAGE.rst new file mode 100644 index 00000000000..6c70db0389e --- /dev/null +++ b/base_conditional_image/readme/USAGE.rst @@ -0,0 +1,7 @@ +Go to *Technical Settings > Settings > Images* to configure all the images. +You can define images for specific objects, depending on the attributes and the company of the object. + +The `selector` should return a boolean expression. All fields of the object are available to compute the result. + +The system will first try to match an image with a company set up, then with the ones without a company. +If your object does not have a `company_id` field, this check will be ignored and only images without a company will be used. diff --git a/base_conditional_image/security/ir.model.access.csv b/base_conditional_image/security/ir.model.access.csv new file mode 100644 index 00000000000..0d9ca2bc728 --- /dev/null +++ b/base_conditional_image/security/ir.model.access.csv @@ -0,0 +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_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/icon.png b/base_conditional_image/static/description/icon.png new file mode 100644 index 00000000000..3a0328b516c Binary files /dev/null and b/base_conditional_image/static/description/icon.png differ diff --git a/base_conditional_image/static/description/index.html b/base_conditional_image/static/description/index.html new file mode 100644 index 00000000000..1b43cf7f8f5 --- /dev/null +++ b/base_conditional_image/static/description/index.html @@ -0,0 +1,468 @@ + + + + + + +Conditional Images + + + +
+

Conditional Images

+ + +

Beta License: AGPL-3 OCA/server-tools Translate me on Weblate Try me on Runbot

+

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.

+

The main goal behind this module is to avoid storing the same image multiple times. +For example, for every partner, there is a related image (most of the time, it’s the default one). +With this module properly set up, it will be stored only one time and you can change it whenever you want for all partners.

+

WARNING: this module cannot be used on the same objects using the module base_multi_image.

+

Table of contents

+ +
+

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 conditional.image.consumer.mixin +to the model that needs the conditional images:

+
+class ResPartner(models.Model):
+    _inherit = ['res.partner', 'conditional.image.consumer.mixin']
+    _name = 'res.partner'
+
+

Then, configure how the images will be selected for each record.

+
+
+

Usage

+

Go to Technical Settings > Settings > Images to configure all the images. +You can define images for specific objects, depending on the attributes and the company of the object.

+

The selector should return a boolean expression. All fields of the object are available to compute the result.

+

The system will first try to match an image with a company set up, then with the ones without a company. +If your object does not have a company_id field, this check will be ignored and only images without a company will be used.

+
+
+

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.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Camptocamp
  • +
+
+
+

Contributors

+ +
+
+

Other credits

+

The migration of this module from 12.0 to 14.0 was financially supported by Camptocamp

+
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

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.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/base_conditional_image/views/image_view.xml b/base_conditional_image/views/image_view.xml new file mode 100644 index 00000000000..50cdfb4ee6e --- /dev/null +++ b/base_conditional_image/views/image_view.xml @@ -0,0 +1,60 @@ + + + + conditional.image.tree + conditional.image + + + + + + + + + + + + conditional.image.form + conditional.image + +
+ + + + + + + + + + + + + +
+
+
+ + + Conditional Images + conditional.image + tree,form + + + + Conditional Images + + + + +
diff --git a/setup/base_conditional_image/odoo/addons/base_conditional_image b/setup/base_conditional_image/odoo/addons/base_conditional_image new file mode 120000 index 00000000000..3e3201d049b --- /dev/null +++ b/setup/base_conditional_image/odoo/addons/base_conditional_image @@ -0,0 +1 @@ +../../../../base_conditional_image \ No newline at end of file diff --git a/setup/base_conditional_image/setup.py b/setup/base_conditional_image/setup.py new file mode 100644 index 00000000000..28c57bb6403 --- /dev/null +++ b/setup/base_conditional_image/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)