Search 1.9 billion lines of Odoo code on GitHub

base_conditional_image

Author: Camptocamp, Odoo Community Association (OCA)
License: AGPL-3
Branch: 15.0
Repository: AITIC/server-tools
Dependencies: base
Languages: HTML (378, 61.6%), Python (96, 15.6%), XML (57, 9.3%), and reStructuredText (83, 13.5%)
Other branches: 12.0, and 14.0
Other repositories: 001101/server-tools, 0yik/server-tools, AMhadhbi/server-tools, Artielkami/server-tools, CB-Gran-Canaria/server-tools, Callino/server-tools, Change2improve/server-tools, ComitorDevTeam/server-tools, Comunitea/server-tools, Digital5-Odoo/server-tools, Dobtor-OCA/server-tools, DucTruongKomit/server-tools, DulingLai/server-tools, ERPLibre/server-tools, FernandoRomera/server-tools, ForgeFlow/server-tools, GSLabIt/server-tools, Gabinete-Digital/server-tools, GleydsonHudson/server-tools, Ingeos/server-tools, Intesco2-0/server-tools, IvanShirokikh/server-tools, Jarsa/server-tools, JuaniFreedoo/server-tools, KonaERP/server-tools, LevelPrime/server-tools, LourenzoH/server-tools, NL66278/server-tools, OCA-MUK/server-tools, OCA/server-tools, OdooIndonesia/server-tools, Othniel1796/server-tools, PieterPaulussen/server-tools, QubiQ/server-tools, Rad0van/server-tools, SanteLibre/server-tools, ScopeaFrance/server-tools, SequarSrl/server-tools, SeuMarco/server-tools, SimoneVagile/server-tools, StefanRijnhart/server-tools, Syci-Consulting/server-tools, Tecnativa/server-tools, TimLai125/server-tools, UnknownInfo/server-tools, VanMoof/server-tools, Vauxoo/server-tools, Yaman-als/server-tools, YannickB/server-tools, YogeshMahera-SerpentCS/server-tools, aaltinisik/server-tools, acsone/server-tools, ajayjaviya/server-tools, akretion/server-tools, albertvimlet/server-tools, alfadil/server-tools, anhvu-sg/server-tools, anodino-dev/server-tools, ansinaesmejor/server-tools, antilhue/server-tools, area-scm/server-tools, aurestic/server-tools, avoinsystems/server-tools, azmeuk/server-tools, bangil0/server-tools, blooparksystems/server-tools, bmya/server-tools, brain-tec/server-tools, camptocamp/server-tools, captivea-dcr/server-tools, cheikhousy/server-tools, connect-to-ak/server-tools, coopiteasy/server-tools, crnd-inc/server-tools, dalal-intellisoft/server-tools, dani-xtendoo/server-tools, davidwah/server-tools, ddico/server-tools, dennybiasiolli/server-tools, diggy128/server-tools, dipakthapaofficial/server-tools, dndoanh/server-tools, druidoo-dev/server-tools, eLBati/server-tools, ecosoft-odoo/server-tools, emagdalenaC2i/server-tools, erfanjahanshahlo/server-tools, etobella/server-tools, eversatis/server-tools, ewac-nl/server-tools, exosoftware/oca-server-tools, fmdl/server-tools, focusate/oca-server-tools, gab-net/server-tools, gitguohao/server-tools, grindtildeath/server-tools, gurneyalex/server-tools, hbrunn/server-tools, hibou-io/oca-server-tools, ideaspositivas-group/server-tools, igallart/server-tools, initOS/server-tools, insscn/server-tools, invitu/server-tools, ip-candres/server-tools, jaballate/server-tools, jacky82669513/server-tools, janverb/server-tools, jeanpaul-mupagasi/server-tools, josueBulle/server-tools, jphatig/server-tools, kait-avalah/server-tools, kmee/server-tools, kos94ok-3D/server-tools, legalsylvain/server-tools, lideritjnma/server-tools, lilotter45/server-tools, lincersolucoes/oca-server-tools, lonelyleaves/server-tools, merchise-autrement/server-tools, modoolar/server-tools, multidadosti-erp/server-tools, nehaksolves/server-tools, nilshamerlinck/server-tools, njeudy/server-tools, omalbastin/server-tools, p-tombez/server-tools, petrus-v/server-tools, praxigento/oca-server-tools, programadorzurita/server-tools, raizs/server-tools, rdeheele/server-tools, robertsvx27/server-tools, romendil/server-tools, rsullivan2704/server-tools, rudisulistyo/server-tools, sanube/server-tools, sergiocorato/server-tools, solvosci/server-tools, ssaid/server-tools, steingabelgaard/server-tools, sunflowerit/server-tools, sunshineLhj/server-tools, suprielfath/server-tools, swbs-co/server-tools, sysprocesarcastro/server-tools, tafaRU/server-tools, takinobori/oca-server-tools, tarteo/server-tools, tegin/server-tools, tirma-sa/server-tools, tmasson/server-tools, tongjiou/server-tools, trevi-software/server-tools, unitek-solusi/OCA-server-tools, ursais/server-tools, valmarnet/server-tools, ventor-tech/server-tools, victoralmau/server-tools, vmelnych/server-tools, ygdmxy/server-tools, ypapouin/server-tools, yuzhengxing/server-tools, zarumaru/server-tools, and zhaohuaw/server-tools

<h1 class="title">Conditional Images</h1> <p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/server-tools/tree/15.0/base_conditional_image"><img alt="OCA/server-tools" src="https://img.shields.io/badge/github-OCA%2Fserver--tools-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/server-tools-15-0/server-tools-15-0-base_conditional_image"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/149/15.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p> <p>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.</p> <p>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.</p> <p><strong>WARNING</strong>: this module cannot be used on the same objects using the module <cite>base_multi_image</cite>.</p> <p><strong>Table of contents</strong></p> <div class="contents local topic" id="contents"> <ul class="simple"> <li><a class="reference internal" href="#installation" id="id1">Installation</a></li> <li><a class="reference internal" href="#usage" id="id2">Usage</a></li> <li><a class="reference internal" href="#bug-tracker" id="id3">Bug Tracker</a></li> <li><a class="reference internal" href="#credits" id="id4">Credits</a><ul> <li><a class="reference internal" href="#authors" id="id5">Authors</a></li> <li><a class="reference internal" href="#contributors" id="id6">Contributors</a></li> <li><a class="reference internal" href="#other-credits" id="id7">Other credits</a></li> <li><a class="reference internal" href="#maintainers" id="id8">Maintainers</a></li> </ul> </li> </ul> </div> <a name="installation"></a> <h2><a class="toc-backref" href="#id1">Installation</a></h2> <p>The sole purpose of this module is to add an abstract model to be inherited. So, you will not notice any changes on install.</p> <p>To develop using this module, you have to inherit the abstract model <cite>conditional.image.consumer.mixin</cite> to the model that needs the conditional images:</p> <pre> <code>class ResPartner(models.Model): _inherit = ['res.partner', 'conditional.image.consumer.mixin'] _name = 'res.partner'</code> </pre> <p>Then, configure how the images will be selected for each record.</p> <a name="usage"></a> <h2><a class="toc-backref" href="#id2">Usage</a></h2> <p>Go to <em>Technical Settings &gt; Settings &gt; Images</em> to configure all the images. You can define images for specific objects, depending on the attributes and the company of the object.</p> <p>The <cite>selector</cite> should return a boolean expression. All fields of the object are available to compute the result.</p> <p>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 <cite>company_id</cite> field, this check will be ignored and only images without a company will be used.</p> <a name="bug-tracker"></a> <h2><a class="toc-backref" href="#id3">Bug Tracker</a></h2> <p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/server-tools/issues">GitHub Issues</a>. 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 <a class="reference external" href="https://github.com/OCA/server-tools/issues/new?body=module:%20base_conditional_image%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p> <p>Do not contact contributors directly about support or help with technical issues.</p> <a name="credits"></a> <h2><a class="toc-backref" href="#id4">Credits</a></h2> <a name="authors"></a> <h3><a class="toc-backref" href="#id5">Authors</a></h3> <ul class="simple"> <li>Camptocamp</li> </ul> <a name="contributors"></a> <h3><a class="toc-backref" href="#id6">Contributors</a></h3> <ul class="simple"> <li><dl class="first docutils"> <dt><a class="reference external" href="https://camptocamp.com/">Camptocamp</a>:</dt> <dd><ul class="first last"> <li>Patrick Tombez &lt;<a class="reference external" href="mailto:patrick.tombez&#64;camptocamp.com">patrick.tombez&#64;camptocamp.com</a>&gt;</li> <li>Denis Leemann &lt;<a class="reference external" href="mailto:denis.leemann&#64;camptocamp.com">denis.leemann&#64;camptocamp.com</a>&gt;</li> </ul> </dd> </dl> </li> <li><dl class="first docutils"> <dt><a class="reference external" href="https://trobz.com">Trobz</a>:</dt> <dd><ul class="first last"> <li>Son Ho &lt;<a class="reference external" href="mailto:sonhd&#64;trobz.com">sonhd&#64;trobz.com</a>&gt;</li> </ul> </dd> </dl> </li> </ul> <a name="other-credits"></a> <h3><a class="toc-backref" href="#id7">Other credits</a></h3> <p>The migration of this module from 12.0 to 14.0 was financially supported by Camptocamp</p> <a name="maintainers"></a> <h3><a class="toc-backref" href="#id8">Maintainers</a></h3> <p>This module is maintained by the OCA.</p> <a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a> <p>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.</p> <p>This module is part of the <a class="reference external" href="https://github.com/OCA/server-tools/tree/15.0/base_conditional_image">OCA/server-tools</a> project on GitHub.</p> <p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>