Conditional Images

base_conditional_image
REPOSITORY
REPOSITORYOCA/server-tools
GIT
GIThttps://github.com/OCA/server-tools.git
GIT FOLDER
GIT FOLDERhttps://github.com/OCA/server-tools/tree/18.0/base_conditional_image
VERSION
VERSION 1.0.0
CATEGORY
CATEGORYMisc
LICENSE
LICENSEAGPL-3
APPLICATION
APPLICATIONNo
AUTO-INSTALLABLE
AUTO-INSTALLABLENo
AUTHORS
AUTHORSOdoo Community Association (OCA), Camptocamp
MAINTAINERS
MAINTAINERSOdoo Community Association (OCA), Camptocamp
COMMITTERS
COMMITTERSOCA-git-bot, oca-ci, Bhavesh Heliconia
WEBSITE
WEBSITEhttps://github.com/OCA/server-tools
LAST TRACKING UPDATE
LAST TRACKING UPDATE2026-07-06 19:30:08
ODOO DEPENDENCIES
ODOO DEPENDENCIES odoo/odoo:
    - base
PYTHON DEPENDENCIES
PYTHON DEPENDENCIES Not have
SYSTEM DEPENDENCIES
SYSTEM DEPENDENCIES Not have
DESCRIPTION
DESCRIPTION
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.

Code Analysis

Views touched (2)
XML IDNameModelTypeStatus
view_conditional_image_form conditional.image.form conditional.image form New
view_conditional_image_tree conditional.image.tree conditional.image list New
Models touched (2)

New fields (4)
  • company_id Many2one → res.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.' args: 'res.company', 'Company'
  • model_name Char
    required=True
  • name Char
    required=True
  • selector Text
    help='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`.'
Public methods (0)

No public methods.

New fields (5)
  • image_1024 Image
    compute='_compute_images' readonly=True store=False
  • image_128 Image
    compute='_compute_images' readonly=True store=False
  • image_1920 Image
    compute='_compute_images' readonly=True store=False
  • image_256 Image
    compute='_compute_images' readonly=True store=False
  • image_512 Image
    compute='_compute_images' readonly=True store=False
Public methods (0)

No public methods.

REPOSITORY
REPOSITORYOCA/server-tools
GIT
GIThttps://github.com/OCA/server-tools.git
GIT FOLDER
GIT FOLDERhttps://github.com/OCA/server-tools/tree/16.0/base_conditional_image
VERSION
VERSION 1.0.0
CATEGORY
CATEGORYMisc
LICENSE
LICENSEAGPL-3
APPLICATION
APPLICATIONNo
AUTO-INSTALLABLE
AUTO-INSTALLABLENo
AUTHORS
AUTHORSOdoo Community Association (OCA), Camptocamp
MAINTAINERS
MAINTAINERSOdoo Community Association (OCA), Camptocamp
COMMITTERS
COMMITTERSWeblate, OCA-git-bot, oca-ci, pol
WEBSITE
WEBSITEhttps://github.com/OCA/server-tools
LAST TRACKING UPDATE
LAST TRACKING UPDATE2026-07-06 00:53:53
ODOO DEPENDENCIES
ODOO DEPENDENCIES odoo/odoo:
    - base
PYTHON DEPENDENCIES
PYTHON DEPENDENCIES Not have
SYSTEM DEPENDENCIES
SYSTEM DEPENDENCIES Not have
DESCRIPTION
DESCRIPTION

Code Analysis

Views touched (2)
XML IDNameModelTypeStatus
view_conditional_image_form conditional.image.form conditional.image form New
view_conditional_image_tree conditional.image.tree conditional.image tree New
Models touched (2)

New fields (4)
  • company_id Many2one → res.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.' args: 'res.company', 'Company'
  • model_name Char
    required=True
  • name Char
    required=True
  • selector Text
    help='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`.'
Public methods (0)

No public methods.

New fields (5)
  • image_1024 Image
    compute='_compute_images' readonly=True store=False
  • image_128 Image
    compute='_compute_images' readonly=True store=False
  • image_1920 Image
    compute='_compute_images' readonly=True store=False
  • image_256 Image
    compute='_compute_images' readonly=True store=False
  • image_512 Image
    compute='_compute_images' readonly=True store=False
Public methods (0)

No public methods.

REPOSITORY
REPOSITORYOCA/server-tools
GIT
GIThttps://github.com/OCA/server-tools.git
GIT FOLDER
GIT FOLDERhttps://github.com/OCA/server-tools/tree/15.0/base_conditional_image
VERSION
VERSION 1.0.0
CATEGORY
CATEGORYMisc
LICENSE
LICENSEAGPL-3
APPLICATION
APPLICATIONNo
AUTO-INSTALLABLE
AUTO-INSTALLABLENo
AUTHORS
AUTHORSOdoo Community Association (OCA), Camptocamp
MAINTAINERS
MAINTAINERSOdoo Community Association (OCA), Camptocamp
COMMITTERS
COMMITTERSOCA Transbot, Denis Leemann, Weblate, OCA-git-bot, Stephane Mangin, oca-ci
WEBSITE
WEBSITEhttps://github.com/OCA/server-tools
LAST TRACKING UPDATE
LAST TRACKING UPDATE2026-07-06 00:46:39
ODOO DEPENDENCIES
ODOO DEPENDENCIES odoo/odoo:
    - base
PYTHON DEPENDENCIES
PYTHON DEPENDENCIES Not have
SYSTEM DEPENDENCIES
SYSTEM DEPENDENCIES Not have
DESCRIPTION
DESCRIPTION

Code Analysis

Views touched (2)
XML IDNameModelTypeStatus
view_conditional_image_form conditional.image.form conditional.image form New
view_conditional_image_tree conditional.image.tree conditional.image tree New
Models touched (2)

New fields (4)
  • company_id Many2one → res.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.' args: 'res.company', 'Company'
  • model_name Char
    required=True
  • name Char
    required=True
  • selector Text
    help='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`.'
Public methods (0)

No public methods.

New fields (5)
  • image_1024 Image
    compute='_compute_images' readonly=True store=False
  • image_128 Image
    compute='_compute_images' readonly=True store=False
  • image_1920 Image
    compute='_compute_images' readonly=True store=False
  • image_256 Image
    compute='_compute_images' readonly=True store=False
  • image_512 Image
    compute='_compute_images' readonly=True store=False
Public methods (0)

No public methods.

REPOSITORY
REPOSITORYOCA/server-tools
GIT
GIThttps://github.com/OCA/server-tools.git
GIT FOLDER
GIT FOLDERhttps://github.com/OCA/server-tools/tree/14.0/base_conditional_image
VERSION
VERSION 2.0.1
CATEGORY
CATEGORYMisc
LICENSE
LICENSEAGPL-3
APPLICATION
APPLICATIONNo
AUTO-INSTALLABLE
AUTO-INSTALLABLENo
AUTHORS
AUTHORSOdoo Community Association (OCA), Camptocamp
MAINTAINERS
MAINTAINERSOdoo Community Association (OCA), Camptocamp
COMMITTERS
COMMITTERSAkim Juillerat, Weblate, OCA-git-bot, oca-ci, sonhd
WEBSITE
WEBSITEhttps://github.com/OCA/server-tools
LAST TRACKING UPDATE
LAST TRACKING UPDATE2026-07-06 00:41:06
ODOO DEPENDENCIES
ODOO DEPENDENCIES odoo/odoo:
    - mail
    - base
    - base_setup
    - web
    - bus
    - web_tour
PYTHON DEPENDENCIES
PYTHON DEPENDENCIES Not have
SYSTEM DEPENDENCIES
SYSTEM DEPENDENCIES Not have
DESCRIPTION
DESCRIPTION

Code Analysis

Views touched (2)
XML IDNameModelTypeStatus
view_conditional_image_form conditional.image.form conditional.image form New
view_conditional_image_tree conditional.image.tree conditional.image tree New
Models touched (2)

New fields (4)
  • company_id Many2one → res.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.' args: 'res.company', 'Company'
  • model_name Char
    required=True
  • name Char
    required=True
  • selector Text
    help='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`.'
Public methods (0)

No public methods.

New fields (5)
  • image_1024 Image
    compute='_compute_images' readonly=True store=False
  • image_128 Image
    compute='_compute_images' readonly=True store=False
  • image_1920 Image
    compute='_compute_images' readonly=True store=False
  • image_256 Image
    compute='_compute_images' readonly=True store=False
  • image_512 Image
    compute='_compute_images' readonly=True store=False
Public methods (0)

No public methods.

REPOSITORY
REPOSITORYOCA/server-tools
GIT
GIThttps://github.com/OCA/server-tools.git
GIT FOLDER
GIT FOLDERhttps://github.com/OCA/server-tools/tree/12.0/base_conditional_image
VERSION
VERSION 1.0.2
CATEGORY
CATEGORYMisc
LICENSE
LICENSEAGPL-3
APPLICATION
APPLICATIONNo
AUTO-INSTALLABLE
AUTO-INSTALLABLENo
AUTHORS
AUTHORSOdoo Community Association (OCA), Camptocamp
MAINTAINERS
MAINTAINERSOdoo Community Association (OCA), Camptocamp
COMMITTERS
COMMITTERSGitHub, Enric Tobella, Patrick Tombez, oca-travis, OCA-git-bot, Tom Blauwendraat
WEBSITE
WEBSITEhttps://github.com/OCA/server-tools
LAST TRACKING UPDATE
LAST TRACKING UPDATE2026-07-06 00:29:22
ODOO DEPENDENCIES
ODOO DEPENDENCIES odoo/odoo:
    - base
PYTHON DEPENDENCIES
PYTHON DEPENDENCIES Not have
SYSTEM DEPENDENCIES
SYSTEM DEPENDENCIES Not have
DESCRIPTION
DESCRIPTION

Code Analysis

Views touched (2)
XML IDNameModelTypeStatus
view_image_form image.form image form New
view_image_tree image.tree image tree New
Models touched (2)

New fields (3)
  • image Binary
    compute='_compute_image' readonly=True store=False string='Image'
  • image_medium Binary
    compute='_compute_image' readonly=True store=False string='Medium-sized image'
  • image_small Binary
    compute='_compute_image' readonly=True store=False string='Small-sized image'
Public methods (0)

No public methods.

New fields (7)
  • company_id Many2one → res.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.' args: 'res.company', 'Company'
  • image Binary
    attachment=True help='This field holds the standard image, limited to 1024x1024px' args: 'Image'
  • image_medium Binary
    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.' args: 'Medium-sized image'
  • image_small Binary
    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.' args: 'Small-sized image'
  • model_name Char
    required=True args: 'Model Name'
  • name Char
    required=True args: 'Name'
  • selector Text
    help='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`.' args: 'Selector'
Public methods (2)
  • create(self, vals)
    @api.model
  • write(self, vals)
    @api.multi