From ee993936a151b489ab8131bb47393850ad562342 Mon Sep 17 00:00:00 2001 From: "Laurent Mignon (ACSONE)" Date: Tue, 5 Sep 2023 15:32:11 +0200 Subject: [PATCH] [ADD] fs_product_multi_image: a drop-in replacement of storage_image_product --- fs_base_multi_image/README.rst | 35 +++ fs_base_multi_image/__init__.py | 1 + fs_base_multi_image/__manifest__.py | 24 ++ fs_base_multi_image/models/__init__.py | 2 + fs_base_multi_image/models/fs_image.py | 29 ++ .../models/fs_image_relation_mixin.py | 101 +++++++ fs_base_multi_image/readme/CONTRIBUTORS.rst | 1 + fs_base_multi_image/readme/DESCRIPTION.rst | 14 + fs_base_multi_image/readme/ROADMAP.rst | 2 + fs_base_multi_image/readme/USAGE.rst | 3 + fs_base_multi_image/security/fs_image.xml | 26 ++ fs_base_multi_image/security/res_groups.xml | 10 + .../static/description/icon.png | Bin 0 -> 9455 bytes fs_base_multi_image/views/fs_image.xml | 77 ++++++ .../views/fs_image_relation_mixin.xml | 42 +++ fs_product_multi_image/README.rst | 35 +++ fs_product_multi_image/__init__.py | 1 + fs_product_multi_image/__manifest__.py | 25 ++ fs_product_multi_image/models/__init__.py | 7 + .../models/fs_product_category_image.py | 24 ++ .../models/fs_product_image.py | 50 ++++ fs_product_multi_image/models/image_tag.py | 27 ++ .../models/product_category.py | 19 ++ .../models/product_product.py | 68 +++++ .../models/product_template.py | 32 +++ .../models/product_template_attribute_line.py | 31 +++ .../readme/CONTRIBUTORS.rst | 7 + fs_product_multi_image/readme/DESCRIPTION.rst | 4 + fs_product_multi_image/readme/USAGE.rst | 13 + .../security/fs_product_category_image.xml | 34 +++ .../security/fs_product_image.xml | 34 +++ .../static/description/icon.png | Bin 0 -> 9455 bytes fs_product_multi_image/tests/__init__.py | 1 + .../tests/test_fs_product_multi_image.py | 259 ++++++++++++++++++ .../views/fs_product_category_image.xml | 21 ++ .../views/fs_product_image.xml | 32 +++ .../views/product_category.xml | 35 +++ .../views/product_product.xml | 57 ++++ .../views/product_template.xml | 49 ++++ image_tag/README.rst | 35 +++ image_tag/__init__.py | 1 + image_tag/__manifest__.py | 19 ++ image_tag/models/__init__.py | 1 + image_tag/models/image_tag.py | 22 ++ image_tag/readme/CONTRIBUTORS.rst | 1 + image_tag/readme/DESCRIPTION.rst | 3 + image_tag/readme/USAGE.rst | 2 + image_tag/security/image_tag.xml | 25 ++ image_tag/security/res_groups.xml | 10 + image_tag/static/description/icon.png | Bin 0 -> 9455 bytes image_tag/views/image_tag.xml | 43 +++ .../odoo/addons/fs_base_multi_image | 1 + setup/fs_base_multi_image/setup.py | 6 + .../odoo/addons/fs_product_multi_image | 1 + setup/fs_product_multi_image/setup.py | 6 + setup/image_tag/odoo/addons/image_tag | 1 + setup/image_tag/setup.py | 6 + 57 files changed, 1415 insertions(+) create mode 100644 fs_base_multi_image/README.rst create mode 100644 fs_base_multi_image/__init__.py create mode 100644 fs_base_multi_image/__manifest__.py create mode 100644 fs_base_multi_image/models/__init__.py create mode 100644 fs_base_multi_image/models/fs_image.py create mode 100644 fs_base_multi_image/models/fs_image_relation_mixin.py create mode 100644 fs_base_multi_image/readme/CONTRIBUTORS.rst create mode 100644 fs_base_multi_image/readme/DESCRIPTION.rst create mode 100644 fs_base_multi_image/readme/ROADMAP.rst create mode 100644 fs_base_multi_image/readme/USAGE.rst create mode 100644 fs_base_multi_image/security/fs_image.xml create mode 100644 fs_base_multi_image/security/res_groups.xml create mode 100644 fs_base_multi_image/static/description/icon.png create mode 100644 fs_base_multi_image/views/fs_image.xml create mode 100644 fs_base_multi_image/views/fs_image_relation_mixin.xml create mode 100644 fs_product_multi_image/README.rst create mode 100644 fs_product_multi_image/__init__.py create mode 100644 fs_product_multi_image/__manifest__.py create mode 100644 fs_product_multi_image/models/__init__.py create mode 100644 fs_product_multi_image/models/fs_product_category_image.py create mode 100644 fs_product_multi_image/models/fs_product_image.py create mode 100644 fs_product_multi_image/models/image_tag.py create mode 100644 fs_product_multi_image/models/product_category.py create mode 100644 fs_product_multi_image/models/product_product.py create mode 100644 fs_product_multi_image/models/product_template.py create mode 100644 fs_product_multi_image/models/product_template_attribute_line.py create mode 100644 fs_product_multi_image/readme/CONTRIBUTORS.rst create mode 100644 fs_product_multi_image/readme/DESCRIPTION.rst create mode 100644 fs_product_multi_image/readme/USAGE.rst create mode 100644 fs_product_multi_image/security/fs_product_category_image.xml create mode 100644 fs_product_multi_image/security/fs_product_image.xml create mode 100644 fs_product_multi_image/static/description/icon.png create mode 100644 fs_product_multi_image/tests/__init__.py create mode 100644 fs_product_multi_image/tests/test_fs_product_multi_image.py create mode 100644 fs_product_multi_image/views/fs_product_category_image.xml create mode 100644 fs_product_multi_image/views/fs_product_image.xml create mode 100644 fs_product_multi_image/views/product_category.xml create mode 100644 fs_product_multi_image/views/product_product.xml create mode 100644 fs_product_multi_image/views/product_template.xml create mode 100644 image_tag/README.rst create mode 100644 image_tag/__init__.py create mode 100644 image_tag/__manifest__.py create mode 100644 image_tag/models/__init__.py create mode 100644 image_tag/models/image_tag.py create mode 100644 image_tag/readme/CONTRIBUTORS.rst create mode 100644 image_tag/readme/DESCRIPTION.rst create mode 100644 image_tag/readme/USAGE.rst create mode 100644 image_tag/security/image_tag.xml create mode 100644 image_tag/security/res_groups.xml create mode 100644 image_tag/static/description/icon.png create mode 100644 image_tag/views/image_tag.xml create mode 120000 setup/fs_base_multi_image/odoo/addons/fs_base_multi_image create mode 100644 setup/fs_base_multi_image/setup.py create mode 120000 setup/fs_product_multi_image/odoo/addons/fs_product_multi_image create mode 100644 setup/fs_product_multi_image/setup.py create mode 120000 setup/image_tag/odoo/addons/image_tag create mode 100644 setup/image_tag/setup.py diff --git a/fs_base_multi_image/README.rst b/fs_base_multi_image/README.rst new file mode 100644 index 0000000000..38929e8775 --- /dev/null +++ b/fs_base_multi_image/README.rst @@ -0,0 +1,35 @@ +**This file is going to be generated by oca-gen-addon-readme.** + +*Manual changes will be overwritten.* + +Please provide content in the ``readme`` directory: + +* **DESCRIPTION.rst** (required) +* INSTALL.rst (optional) +* CONFIGURE.rst (optional) +* **USAGE.rst** (optional, highly recommended) +* DEVELOP.rst (optional) +* ROADMAP.rst (optional) +* HISTORY.rst (optional, recommended) +* **CONTRIBUTORS.rst** (optional, highly recommended) +* CREDITS.rst (optional) + +Content of this README will also be drawn from the addon manifest, +from keys such as name, authors, maintainers, development_status, +and license. + +A good, one sentence summary in the manifest is also highly recommended. + + +Automatic changelog generation +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +`HISTORY.rst` can be auto generated using `towncrier `_. + +Just put towncrier compatible changelog fragments into `readme/newsfragments` +and the changelog file will be automatically generated and updated when a new fragment is added. + +Please refer to `towncrier` documentation to know more. + +NOTE: the changelog will be automatically generated when using `/ocabot merge $option`. +If you need to run it manually, refer to `OCA/maintainer-tools README `_. diff --git a/fs_base_multi_image/__init__.py b/fs_base_multi_image/__init__.py new file mode 100644 index 0000000000..0650744f6b --- /dev/null +++ b/fs_base_multi_image/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/fs_base_multi_image/__manifest__.py b/fs_base_multi_image/__manifest__.py new file mode 100644 index 0000000000..14a8b2686e --- /dev/null +++ b/fs_base_multi_image/__manifest__.py @@ -0,0 +1,24 @@ +# Copyright 2023 ACSONE SA/NV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +{ + "name": "Fs Base Multi Image", + "summary": """ + Mulitple Images from External File System""", + "version": "16.0.1.0.0", + "license": "AGPL-3", + "author": "ACSONE SA/NV,Odoo Community Association (OCA)", + "website": "https://github.com/OCA/storage", + "depends": [ + "fs_image", + ], + "data": [ + "security/res_groups.xml", + "security/fs_image.xml", + "views/fs_image.xml", + "views/fs_image_relation_mixin.xml", + ], + "demo": [], + "maintainers": ["lmignon"], + "development_status": "Alpha", +} diff --git a/fs_base_multi_image/models/__init__.py b/fs_base_multi_image/models/__init__.py new file mode 100644 index 0000000000..bada9ccdd2 --- /dev/null +++ b/fs_base_multi_image/models/__init__.py @@ -0,0 +1,2 @@ +from . import fs_image +from . import fs_image_relation_mixin diff --git a/fs_base_multi_image/models/fs_image.py b/fs_base_multi_image/models/fs_image.py new file mode 100644 index 0000000000..285995ae26 --- /dev/null +++ b/fs_base_multi_image/models/fs_image.py @@ -0,0 +1,29 @@ +# Copyright 2023 ACSONE SA/NV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import api, fields, models + +from odoo.addons.fs_image import fields as fs_fields + + +class FsImage(models.Model): + + _name = "fs.image" + _inherit = "fs.image.mixin" + _description = "Image" + _order = "name, id" + _rec_name = "name" + + image = fs_fields.FSImage(required=True) # makes field required + name = fields.Char(compute="_compute_name", store=True, index=True) + mimetype = fields.Char(compute="_compute_mimetype", store=True) + + @api.depends("image") + def _compute_name(self): + for record in self: + record.name = record.image.name if record.image else None + + @api.depends("image") + def _compute_mimetypes(self): + for record in self: + record.mimetype = record.image.mimetype if record.image else None diff --git a/fs_base_multi_image/models/fs_image_relation_mixin.py b/fs_base_multi_image/models/fs_image_relation_mixin.py new file mode 100644 index 0000000000..93181752c9 --- /dev/null +++ b/fs_base_multi_image/models/fs_image_relation_mixin.py @@ -0,0 +1,101 @@ +# Copyright 2023 ACSONE SA/NV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import _, api, fields, models +from odoo.exceptions import ValidationError + +from odoo.addons.fs_image import fields as fs_fields + + +class FsImageRelationMixin(models.AbstractModel): + + _name = "fs.image.relation.mixin" + _description = "Image Relation" + _order = "sequence, name" + _rec_name = "name" + + sequence = fields.Integer() + image_id = fields.Many2one( + comodel_name="fs.image", + string="Linked image", + ) + specific_image = fs_fields.FSImage("Specific Image") + # resized fields stored (as attachment) for performance + specific_image_medium = fs_fields.FSImage( + "Specific Image 128", + related="specific_image", + max_width=128, + max_height=128, + store=True, + ) + link_existing = fields.Boolean(default=False) + + image = fs_fields.FSImage( + "Image", compute="_compute_image", inverse="_inverse_image", store=False + ) + # resized fields stored (as attachment) for performance + image_medium = fs_fields.FSImage( + "Image 128", compute="_compute_image_medium", store=False + ) + + name = fields.Char(compute="_compute_name", store=True, index=True) + mimetype = fields.Char(compute="_compute_mimetype", store=True) + + @api.constrains("specific_image", "image_id") + def _check_image(self): + for record in self: + if not record.image_id and not record.specific_image: + raise ValidationError(_("You must set an image")) + + @api.depends("image") + def _compute_name(self): + for record in self: + record.name = record.image.name if record.image else None + + @api.depends("image") + def _compute_mimetypes(self): + for record in self: + record.mimetype = record.image.mimetype if record.image else None + + @api.depends("image_id", "specific_image", "link_existing") + def _compute_image(self): + for record in self: + if record.link_existing: + record.image = record.image_id.image + else: + record.image = record.specific_image + + @api.depends("image_id", "specific_image", "link_existing") + def _compute_image_medium(self): + for record in self: + if record.link_existing: + record.image_medium = record.image_id.image_medium + else: + record.image_medium = record.specific_image_medium + + def _inverse_image(self): + for record in self: + if record.link_existing: + raise ValueError(_("Cannot set image on a linked image")) + else: + record.specific_image = record.image + + @api.model + def _cleanup_vals(self, vals): + if ( + "link_existing" in vals + and vals["link_existing"] + and "specific_image" in vals + ): + vals["specific_image"] = False + return vals + + @api.model_create_multi + def create(self, vals_list): + for vals in vals_list: + self._cleanup_vals(vals) + return super().create(vals_list) + + def write(self, vals): + self._cleanup_vals(vals) + return super().write(vals) diff --git a/fs_base_multi_image/readme/CONTRIBUTORS.rst b/fs_base_multi_image/readme/CONTRIBUTORS.rst new file mode 100644 index 0000000000..172b2d223c --- /dev/null +++ b/fs_base_multi_image/readme/CONTRIBUTORS.rst @@ -0,0 +1 @@ +* Laurent Mignon diff --git a/fs_base_multi_image/readme/DESCRIPTION.rst b/fs_base_multi_image/readme/DESCRIPTION.rst new file mode 100644 index 0000000000..3690804632 --- /dev/null +++ b/fs_base_multi_image/readme/DESCRIPTION.rst @@ -0,0 +1,14 @@ +This addon is a technical addon providing a set of models to ease the +creation of other models that need to be linked to multiple images stored +into external filesystems. + +The models provided by this addon are: + +* ``fs.image``: a model that stores a reference to an image stored into + an external filesystem. +* ``fs.image.relation.mixin``: an abstract model that can be used to + as base class for models created to store an image linked to a model. + This abstract model defines fields and methods to transparently handle + 2 cases: + * the image is specific to the model. + * the image is shared between multiple models and therefore is a ``fs.image`` instance linked to the mixin. diff --git a/fs_base_multi_image/readme/ROADMAP.rst b/fs_base_multi_image/readme/ROADMAP.rst new file mode 100644 index 0000000000..776f992b58 --- /dev/null +++ b/fs_base_multi_image/readme/ROADMAP.rst @@ -0,0 +1,2 @@ +* Add dedicated widget to ease the addition of new images to a model linked to + multiple images. (As it's the case in the *storage_image_product* addon) diff --git a/fs_base_multi_image/readme/USAGE.rst b/fs_base_multi_image/readme/USAGE.rst new file mode 100644 index 0000000000..7a4d226aa3 --- /dev/null +++ b/fs_base_multi_image/readme/USAGE.rst @@ -0,0 +1,3 @@ +To be able to create and or manages shared images, you must have the ``Image Manager`` +role. If you do not have this role, as an authenticated user, you can +only view the shared images. diff --git a/fs_base_multi_image/security/fs_image.xml b/fs_base_multi_image/security/fs_image.xml new file mode 100644 index 0000000000..b976e34f28 --- /dev/null +++ b/fs_base_multi_image/security/fs_image.xml @@ -0,0 +1,26 @@ + + + + + + fs.image access read + + + + + + + + + + fs.image access manage + + + + + + + + + diff --git a/fs_base_multi_image/security/res_groups.xml b/fs_base_multi_image/security/res_groups.xml new file mode 100644 index 0000000000..0986498120 --- /dev/null +++ b/fs_base_multi_image/security/res_groups.xml @@ -0,0 +1,10 @@ + + + + Image Manager + + + diff --git a/fs_base_multi_image/static/description/icon.png b/fs_base_multi_image/static/description/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..3a0328b516c4980e8e44cdb63fd945757ddd132d GIT binary patch literal 9455 zcmW++2RxMjAAjx~&dlBk9S+%}OXg)AGE&Cb*&}d0jUxM@u(PQx^-s)697TX`ehR4?GS^qbkof1cslKgkU)h65qZ9Oc=ml_0temigYLJfnz{IDzUf>bGs4N!v3=Z3jMq&A#7%rM5eQ#dc?k~! zVpnB`o+K7|Al`Q_U;eD$B zfJtP*jH`siUq~{KE)`jP2|#TUEFGRryE2`i0**z#*^6~A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unryX_NhT8*Tj>BTrTTL&!?O+%Rv;b?B??gSzdp?6Uug9{ zd@V08Z$BdI?fpoCS$)t4mg4rT8Q_I}h`0d-vYZ^|dOB*Q^S|xqTV*vIg?@fVFSmMpaw0qtTRbx} z({Pg?#{2`sc9)M5N$*N|4;^t$+QP?#mov zGVC@I*lBVrOU-%2y!7%)fAKjpEFsgQc4{amtiHb95KQEwvf<(3T<9-Zm$xIew#P22 zc2Ix|App^>v6(3L_MCU0d3W##AB0M~3D00EWoKZqsJYT(#@w$Y_H7G22M~ApVFTRHMI_3be)Lkn#0F*V8Pq zc}`Cjy$bE;FJ6H7p=0y#R>`}-m4(0F>%@P|?7fx{=R^uFdISRnZ2W_xQhD{YuR3t< z{6yxu=4~JkeA;|(J6_nv#>Nvs&FuLA&PW^he@t(UwFFE8)|a!R{`E`K`i^ZnyE4$k z;(749Ix|oi$c3QbEJ3b~D_kQsPz~fIUKym($a_7dJ?o+40*OLl^{=&oq$<#Q(yyrp z{J-FAniyAw9tPbe&IhQ|a`DqFTVQGQ&Gq3!C2==4x{6EJwiPZ8zub-iXoUtkJiG{} zPaR&}_fn8_z~(=;5lD-aPWD3z8PZS@AaUiomF!G8I}Mf>e~0g#BelA-5#`cj;O5>N Xviia!U7SGha1wx#SCgwmn*{w2TRX*I literal 0 HcmV?d00001 diff --git a/fs_base_multi_image/views/fs_image.xml b/fs_base_multi_image/views/fs_image.xml new file mode 100644 index 0000000000..26347cbab9 --- /dev/null +++ b/fs_base_multi_image/views/fs_image.xml @@ -0,0 +1,77 @@ + + + + + + fs.image.form (in fs_base_multi_image) + fs.image + +
+ + +
+
+
+ + + fs.image.search (in fs_base_multi_image) + fs.image + + + + + + + + + + + + + + + fs.image.tree (in fs_base_multi_image) + fs.image + + + + + + + + + + + Fs Image + fs.image + tree,form + [] + {} + + + + Fs Images + + + + +
diff --git a/fs_base_multi_image/views/fs_image_relation_mixin.xml b/fs_base_multi_image/views/fs_image_relation_mixin.xml new file mode 100644 index 0000000000..27bc8f3a3c --- /dev/null +++ b/fs_base_multi_image/views/fs_image_relation_mixin.xml @@ -0,0 +1,42 @@ + + + + + + fs.image.relation.mixin.form + fs.image.relation.mixin + +
+ + + + + + + + + + + + + +
+
+
+ +
diff --git a/fs_product_multi_image/README.rst b/fs_product_multi_image/README.rst new file mode 100644 index 0000000000..38929e8775 --- /dev/null +++ b/fs_product_multi_image/README.rst @@ -0,0 +1,35 @@ +**This file is going to be generated by oca-gen-addon-readme.** + +*Manual changes will be overwritten.* + +Please provide content in the ``readme`` directory: + +* **DESCRIPTION.rst** (required) +* INSTALL.rst (optional) +* CONFIGURE.rst (optional) +* **USAGE.rst** (optional, highly recommended) +* DEVELOP.rst (optional) +* ROADMAP.rst (optional) +* HISTORY.rst (optional, recommended) +* **CONTRIBUTORS.rst** (optional, highly recommended) +* CREDITS.rst (optional) + +Content of this README will also be drawn from the addon manifest, +from keys such as name, authors, maintainers, development_status, +and license. + +A good, one sentence summary in the manifest is also highly recommended. + + +Automatic changelog generation +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +`HISTORY.rst` can be auto generated using `towncrier `_. + +Just put towncrier compatible changelog fragments into `readme/newsfragments` +and the changelog file will be automatically generated and updated when a new fragment is added. + +Please refer to `towncrier` documentation to know more. + +NOTE: the changelog will be automatically generated when using `/ocabot merge $option`. +If you need to run it manually, refer to `OCA/maintainer-tools README `_. diff --git a/fs_product_multi_image/__init__.py b/fs_product_multi_image/__init__.py new file mode 100644 index 0000000000..0650744f6b --- /dev/null +++ b/fs_product_multi_image/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/fs_product_multi_image/__manifest__.py b/fs_product_multi_image/__manifest__.py new file mode 100644 index 0000000000..43d7a70013 --- /dev/null +++ b/fs_product_multi_image/__manifest__.py @@ -0,0 +1,25 @@ +# Copyright 2023 ACSONE SA/NV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +{ + "name": "Fs Product Multi Image", + "summary": """ + Manage multi images from extenal file system on product""", + "version": "16.0.1.0.0", + "license": "AGPL-3", + "author": "ACSONE SA/NV,Odoo Community Association (OCA)", + "website": "https://github.com/OCA/storage", + "depends": ["fs_base_multi_image", "product", "sales_team", "image_tag"], + "data": [ + "security/fs_product_category_image.xml", + "views/fs_product_category_image.xml", + "views/product_category.xml", + "security/fs_product_image.xml", + "views/fs_product_image.xml", + "views/product_product.xml", + "views/product_template.xml", + ], + "demo": [], + "maintainers": ["lmignon"], + "development_status": "Alpha", +} diff --git a/fs_product_multi_image/models/__init__.py b/fs_product_multi_image/models/__init__.py new file mode 100644 index 0000000000..17c75c0abd --- /dev/null +++ b/fs_product_multi_image/models/__init__.py @@ -0,0 +1,7 @@ +from . import fs_product_category_image +from . import fs_product_image +from . import image_tag +from . import product_category +from . import product_template +from . import product_product +from . import product_template_attribute_line diff --git a/fs_product_multi_image/models/fs_product_category_image.py b/fs_product_multi_image/models/fs_product_category_image.py new file mode 100644 index 0000000000..d0075cfd68 --- /dev/null +++ b/fs_product_multi_image/models/fs_product_category_image.py @@ -0,0 +1,24 @@ +# Copyright 2023 ACSONE SA/NV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class FsProductCategoryImage(models.Model): + _name = "fs.product.category.image" + _inherit = "fs.image.relation.mixin" + _description = "Product Category Image" + + product_categ_id = fields.Many2one( + comodel_name="product.category", + string="Product Category", + ondelete="cascade", + index=True, + ) + + tag_id = fields.Many2one( + "image.tag", + string="Tag", + domain=[("apply_on", "=", "category")], + index=True, + ) diff --git a/fs_product_multi_image/models/fs_product_image.py b/fs_product_multi_image/models/fs_product_image.py new file mode 100644 index 0000000000..e5584be3a5 --- /dev/null +++ b/fs_product_multi_image/models/fs_product_image.py @@ -0,0 +1,50 @@ +# Copyright 2023 ACSONE SA/NV +# Copyright 2018 Akretion (http://www.akretion.com). +# @author Raphaël Reverdy +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import api, fields, models + + +class FsProductImage(models.Model): + _name = "fs.product.image" + _inherit = "fs.image.relation.mixin" + _description = "Product Image" + + product_tmpl_id = fields.Many2one( + comodel_name="product.template", + string="Product Template", + ondelete="cascade", + index=True, + ) + attribute_value_ids = fields.Many2many( + "product.attribute.value", + string="Attributes", + domain="[('id', 'in', available_attribute_value_ids)]", + ) + # This field will list all attribute value used by the template + # in order to filter the attribute value available for the current image + available_attribute_value_ids = fields.Many2many( + "product.attribute.value", + string="Available Attributes", + compute="_compute_available_attribute", + ) + tag_id = fields.Many2one( + "image.tag", + string="Tag", + domain=[("apply_on", "=", "product")], + index=True, + ) + + @api.depends("product_tmpl_id.attribute_line_ids.value_ids") + def _compute_available_attribute(self): + for rec in self: + rec.available_attribute_value_ids = rec.product_tmpl_id.mapped( + "attribute_line_ids.value_ids" + ) + + def _match_variant(self, variant): + variant_attribute_values = variant.mapped( + "product_template_attribute_value_ids.product_attribute_value_id" + ) + return not bool(self.attribute_value_ids - variant_attribute_values) diff --git a/fs_product_multi_image/models/image_tag.py b/fs_product_multi_image/models/image_tag.py new file mode 100644 index 0000000000..e608eb21d2 --- /dev/null +++ b/fs_product_multi_image/models/image_tag.py @@ -0,0 +1,27 @@ +# Copyright 2023 ACSONE SA/NV +# Copyright 2018 Akretion (http://www.akretion.com). +# @author Raphaël Reverdy +# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). + + +from odoo import api, fields, models + + +class ImageTag(models.Model): + _inherit = "image.tag" + + @api.model + def _get_default_apply_on(self): + active_model = self.env.context.get("active_model") + return ( + "product" + if active_model == "product.image.relation" + else "category" + if active_model == "category.image.relation" + else super()._get_default_apply_on() + ) + + apply_on = fields.Selection( + selection_add=[("product", "Product"), ("category", "Category")], + ondelete={"product": "cascade", "category": "cascade"}, + ) diff --git a/fs_product_multi_image/models/product_category.py b/fs_product_multi_image/models/product_category.py new file mode 100644 index 0000000000..e40c91a35a --- /dev/null +++ b/fs_product_multi_image/models/product_category.py @@ -0,0 +1,19 @@ +# Copyright 2023 ACSONE SA/NV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import fields, models + +from odoo.addons.fs_image.fields import FSImage + + +class ProductCategory(models.Model): + + _inherit = "product.category" + + image_ids = fields.One2many( + string="Images", + comodel_name="fs.product.category.image", + inverse_name="product_categ_id", + ) + image = FSImage(related="image_ids.image", readonly=True, store=False) + image_medium = FSImage(related="image_ids.image_medium", readonly=True, store=False) diff --git a/fs_product_multi_image/models/product_product.py b/fs_product_multi_image/models/product_product.py new file mode 100644 index 0000000000..7ea6e87b29 --- /dev/null +++ b/fs_product_multi_image/models/product_product.py @@ -0,0 +1,68 @@ +# Copyright 2017 Akretion (http://www.akretion.com). +# @author Sébastien BEAU +# Copyright 2021 Camptocamp SA (http://www.camptocamp.com) +# @author Simone Orsi +# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). + +from odoo import api, fields, models + +from odoo.addons.fs_image.fields import FSImage + + +class ProductProduct(models.Model): + _inherit = "product.product" + + variant_image_ids = fields.Many2many( + "fs.product.image", + compute="_compute_variant_image_ids", + store=True, + string="Variant Images", + ) + main_image_id = fields.Many2one( + string="Main Image", + comodel_name="fs.product.image", + compute="_compute_main_image_id", + # Store it to improve perfs + store=True, + ) + image = FSImage(related="main_image_id.image", readonly=True, store=False) + image_medium = FSImage( + related="main_image_id.image_medium", readonly=True, store=False + ) + + @api.depends( + "product_tmpl_id.image_ids", + "product_tmpl_id.image_ids.sequence", + "product_tmpl_id.image_ids.attribute_value_ids", + "product_template_attribute_value_ids", + ) + def _compute_variant_image_ids(self): + for variant in self: + img_relations = set() + # Not sure sorting is needed here + sorted_image_relations = variant.image_ids.sorted( + key=lambda i: (i.sequence, i.id) + ) + for image_rel in sorted_image_relations: + if image_rel._match_variant(variant): + img_relations.add(image_rel.id) + variant.variant_image_ids = list(img_relations) if img_relations else False + + @api.depends("variant_image_ids", "variant_image_ids.sequence") + def _compute_main_image_id(self): + for record in self: + record.main_image_id = record._get_main_image() + + def _select_main_image(self, images): + return fields.first(images.sorted(key=lambda i: (i.sequence, i.id))).id + + def _get_main_image(self): + match_image = self.variant_image_ids.filtered( + lambda i: i.attribute_value_ids + == self.mapped( + "product_template_attribute_value_ids.product_attribute_value_id" + ) + ) + if match_image: + return self._select_main_image(match_image) + return self._select_main_image(self.variant_image_ids) diff --git a/fs_product_multi_image/models/product_template.py b/fs_product_multi_image/models/product_template.py new file mode 100644 index 0000000000..38b749d97a --- /dev/null +++ b/fs_product_multi_image/models/product_template.py @@ -0,0 +1,32 @@ +# Copyright 2023 ACSONE SA/NV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import api, fields, models + +from odoo.addons.fs_image.fields import FSImage + + +class ProductTemplate(models.Model): + + _inherit = "product.template" + + image_ids = fields.One2many( + string="Images", comodel_name="fs.product.image", inverse_name="product_tmpl_id" + ) + main_image_id = fields.Many2one( + string="Main Image", + comodel_name="fs.product.image", + compute="_compute_main_image_id", + # Store it to improve perfs + store=True, + ) + image = FSImage(related="main_image_id.image", readonly=True, store=False) + image_medium = FSImage( + related="main_image_id.image_medium", readonly=True, store=False + ) + + @api.depends("image_ids", "image_ids.sequence") + def _compute_main_image_id(self): + for record in self: + image_ids = record.image_ids.sorted(key=lambda i: (i.sequence, i.id)) + record.main_image_id = image_ids and image_ids[0] or None diff --git a/fs_product_multi_image/models/product_template_attribute_line.py b/fs_product_multi_image/models/product_template_attribute_line.py new file mode 100644 index 0000000000..b6b6915066 --- /dev/null +++ b/fs_product_multi_image/models/product_template_attribute_line.py @@ -0,0 +1,31 @@ +# Copyright 2023 ACSONE SA/NV +# Copyright 2017 Akretion (http://www.akretion.com). +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import models + + +class ProductTemplateAttributeLine(models.Model): + + _inherit = "product.template.attribute.line" + + def write(self, values): + res = super().write(values) + if "value_ids" in values: + product_image_attribute_value_ids = self.product_tmpl_id.image_ids.mapped( + "attribute_value_ids" + ).filtered(lambda x: x.attribute_id == self.attribute_id) + available_attribute_values_ids = self.value_ids + to_remove = product_image_attribute_value_ids.filtered( + lambda x: x not in available_attribute_values_ids + ) + if to_remove: + for image in self.product_tmpl_id.image_ids: + image.attribute_value_ids -= to_remove + return res + + def unlink(self): + for line in self: + for image in line.product_tmpl_id.image_ids: + image.attribute_value_ids -= line.value_ids + return super().unlink() diff --git a/fs_product_multi_image/readme/CONTRIBUTORS.rst b/fs_product_multi_image/readme/CONTRIBUTORS.rst new file mode 100644 index 0000000000..33d0863bc0 --- /dev/null +++ b/fs_product_multi_image/readme/CONTRIBUTORS.rst @@ -0,0 +1,7 @@ +* Laurent Mignon +* Raphaël Reverdy +* Denis Roussel +* Quentin Groulard +* `Camptocamp `_ + + * Iván Todorovich diff --git a/fs_product_multi_image/readme/DESCRIPTION.rst b/fs_product_multi_image/readme/DESCRIPTION.rst new file mode 100644 index 0000000000..b1ae446b13 --- /dev/null +++ b/fs_product_multi_image/readme/DESCRIPTION.rst @@ -0,0 +1,4 @@ +Attach images to products and categories and store them on an external +filesystem instead of the database. + +This addon is a drop-in replacement for the **storage_image_product** addon. diff --git a/fs_product_multi_image/readme/USAGE.rst b/fs_product_multi_image/readme/USAGE.rst new file mode 100644 index 0000000000..43c2b473dd --- /dev/null +++ b/fs_product_multi_image/readme/USAGE.rst @@ -0,0 +1,13 @@ +On the category and product form, a new tab allows you to add images to the +related object. The images can be specific to the model or you can use an +existing one. + +On the link forms, you can add an image tag in addition to the image. In +the specific case of the product template, you can also specify for which +variant attribute values the image is valid. + +On the product variant form, the image tag will be automatically filled whith +the image tag of the product template for the same variant attribute values. + +In every case, a main image is computed and used as the default image for the +object. It depends on the sequence of the images (first one is the main one). diff --git a/fs_product_multi_image/security/fs_product_category_image.xml b/fs_product_multi_image/security/fs_product_category_image.xml new file mode 100644 index 0000000000..20c6ec6d6b --- /dev/null +++ b/fs_product_multi_image/security/fs_product_category_image.xml @@ -0,0 +1,34 @@ + + + + + + fs.product.category.image access read + + + + + + + + + fs.product.category.image access system admin + + + + + + + + + fs.product.category.image access sales manager + + + + + + + + + diff --git a/fs_product_multi_image/security/fs_product_image.xml b/fs_product_multi_image/security/fs_product_image.xml new file mode 100644 index 0000000000..4ecbabac5d --- /dev/null +++ b/fs_product_multi_image/security/fs_product_image.xml @@ -0,0 +1,34 @@ + + + + + + fs.product.image access read + + + + + + + + + fs.product.image access erp manager + + + + + + + + + fs.product.image access sales manager + + + + + + + + + diff --git a/fs_product_multi_image/static/description/icon.png b/fs_product_multi_image/static/description/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..3a0328b516c4980e8e44cdb63fd945757ddd132d GIT binary patch literal 9455 zcmW++2RxMjAAjx~&dlBk9S+%}OXg)AGE&Cb*&}d0jUxM@u(PQx^-s)697TX`ehR4?GS^qbkof1cslKgkU)h65qZ9Oc=ml_0temigYLJfnz{IDzUf>bGs4N!v3=Z3jMq&A#7%rM5eQ#dc?k~! zVpnB`o+K7|Al`Q_U;eD$B zfJtP*jH`siUq~{KE)`jP2|#TUEFGRryE2`i0**z#*^6~AI|YzIWy$Cu#CSLW3q=GA z6`?GZymC;dCPk~rBS%eCb`5OLr;RUZ;D`}um=H)BfVIq%7VhiMr)_#G0N#zrNH|__ zc+blN2UAB0=617@>_u;MPHN;P;N#YoE=)R#i$k_`UAA>WWCcEVMh~L_ zj--gtp&|K1#58Yz*AHCTMziU1Jzt_jG0I@qAOHsk$2}yTmVkBp_eHuY$A9)>P6o~I z%aQ?!(GqeQ-Y+b0I(m9pwgi(IIZZzsbMv+9w{PFtd_<_(LA~0H(xz{=FhLB@(1&qHA5EJw1>>=%q2f&^X>IQ{!GJ4e9U z&KlB)z(84HmNgm2hg2C0>WM{E(DdPr+EeU_N@57;PC2&DmGFW_9kP&%?X4}+xWi)( z;)z%wI5>D4a*5XwD)P--sPkoY(a~WBw;E~AW`Yue4kFa^LM3X`8x|}ZUeMnqr}>kH zG%WWW>3ml$Yez?i%)2pbKPI7?5o?hydokgQyZsNEr{a|mLdt;X2TX(#B1j35xPnPW z*bM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yyrp z{J-FAniyAw9tPbe&IhQ|a`DqFTVQGQ&Gq3!C2==4x{6EJwiPZ8zub-iXoUtkJiG{} zPaR&}_fn8_z~(=;5lD-aPWD3z8PZS@AaUiomF!G8I}Mf>e~0g#BelA-5#`cj;O5>N Xviia!U7SGha1wx#SCgwmn*{w2TRX*I literal 0 HcmV?d00001 diff --git a/fs_product_multi_image/tests/__init__.py b/fs_product_multi_image/tests/__init__.py new file mode 100644 index 0000000000..c686b22ff1 --- /dev/null +++ b/fs_product_multi_image/tests/__init__.py @@ -0,0 +1 @@ +from . import test_fs_product_multi_image diff --git a/fs_product_multi_image/tests/test_fs_product_multi_image.py b/fs_product_multi_image/tests/test_fs_product_multi_image.py new file mode 100644 index 0000000000..aabcdd6702 --- /dev/null +++ b/fs_product_multi_image/tests/test_fs_product_multi_image.py @@ -0,0 +1,259 @@ +# Copyright 2017 Akretion (http://www.akretion.com). +# Copyright 2023 ACSONE SA/NV +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +import base64 +import io + +from PIL import Image + +from odoo.tests.common import TransactionCase + + +class TestFsProductMultiImage(TransactionCase): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.env = cls.env(context=dict(cls.env.context, tracking_disable=True)) + cls.white_image = cls._create_image(16, 16, color="#FFFFFF") + cls.black_image = cls._create_image(16, 16, color="#000000") + cls.logo_image = cls._create_image(16, 16, color="#FFA500") + cls.template = cls.env.ref("product.product_product_4_product_template") + cls.product_a = cls.env.ref("product.product_product_4") + cls.product_b = cls.env.ref("product.product_product_4b") + cls.product_c = cls.env.ref("product.product_product_4c") + cls.image_white = cls.env["fs.image"].create( + { + "image": { + "filename": "white.png", + "content": base64.b64encode(cls.white_image), + } + } + ) + cls.image_logo = cls.env["fs.image"].create( + { + "image": { + "filename": "logo.png", + "content": base64.b64encode(cls.logo_image), + } + } + ) + cls.image_black = cls.env["fs.image"].create( + { + "image": { + "filename": "black.png", + "content": base64.b64encode(cls.black_image), + } + } + ) + + def setUp(self): + super().setUp() + self.temp_dir = self.env["fs.storage"].create( + { + "name": "Temp FS Storage", + "protocol": "memory", + "code": "mem_dir", + "directory_path": "/tmp/", + "model_xmlids": "fs_product_multi_image.model_fs_product_category_image," + "fs_product_multi_image.model_fs_product_image", + } + ) + + @classmethod + def _create_image(cls, width, height, color="#4169E1", img_format="PNG"): + f = io.BytesIO() + Image.new("RGB", (width, height), color).save(f, img_format) + f.seek(0) + return f.read() + + def test_available_attribute_value(self): + # The template have already 5 attribute values + # see demo data of ipad + image = self.env["fs.product.image"].new({"product_tmpl_id": self.template.id}) + self.assertEqual(len(image.available_attribute_value_ids), 5) + + def test_add_image_for_all_variant(self): + self.assertEqual(len(self.product_a.variant_image_ids), 0) + image = self.env["fs.product.image"].create( + { + "product_tmpl_id": self.template.id, + "specific_image": { + "filename": "white.png", + "content": base64.b64encode(self.white_image), + }, + } + ) + self.assertEqual(self.product_a.image.getvalue(), self.white_image) + self.assertEqual(self.product_a.variant_image_ids, image) + self.assertEqual(self.product_a.main_image_id, image) + self.assertEqual(self.product_b.image.getvalue(), self.white_image) + self.assertEqual(self.product_b.variant_image_ids, image) + self.assertEqual(self.product_b.main_image_id, image) + self.assertEqual(self.product_c.image.getvalue(), self.white_image) + self.assertEqual(self.product_c.variant_image_ids, image) + self.assertEqual(self.product_c.main_image_id, image) + + def test_add_image_for_white_variant(self): + image = self.env["fs.product.image"].create( + { + "product_tmpl_id": self.template.id, + "image_id": self.image_white.id, + "attribute_value_ids": [ + (6, 0, [self.env.ref("product.product_attribute_value_3").id]) + ], + } + ) + # White product should have the image + self.assertEqual(self.product_a.variant_image_ids, image) + self.assertEqual(self.product_a.main_image_id, image) + self.assertEqual(self.product_c.variant_image_ids, image) + self.assertEqual(self.product_c.main_image_id, image) + # Black product should not have the image + self.assertEqual(len(self.product_b.variant_image_ids), 0) + self.assertFalse(self.product_b.main_image_id) + + def _create_multiple_images(self): + logo = self.env["fs.product.image"].create( + { + "product_tmpl_id": self.template.id, + "image_id": self.image_logo.id, + "sequence": 10, + "link_existing": True, + } + ) + image_wh = self.env["fs.product.image"].create( + { + "product_tmpl_id": self.template.id, + "image_id": self.image_white.id, + "attribute_value_ids": [ + (6, 0, [self.env.ref("product.product_attribute_value_3").id]) + ], + "sequence": 2, + "link_existing": True, + } + ) + image_bk = self.env["fs.product.image"].create( + { + "product_tmpl_id": self.template.id, + "image_id": self.image_black.id, + "attribute_value_ids": [ + (6, 0, [self.env.ref("product.product_attribute_value_4").id]) + ], + "sequence": 1, + "link_existing": True, + } + ) + return logo, image_wh, image_bk + + def test_add_image_for_white_and_black_variant(self): + logo, image_wh, image_bk = self._create_multiple_images() + # White product should have the white image and the logo + self.assertEqual(self.product_a.variant_image_ids, image_wh + logo) + self.assertEqual(self.product_c.variant_image_ids, image_wh + logo) + # Black product should have the black image and the logo + self.assertEqual(self.product_b.variant_image_ids, image_bk + logo) + + def _test_main_images(self, expected): + for image, products in expected: + for prod in products: + self.assertEqual(prod.image.getvalue(), image) + + def test_main_image_and_urls(self): + logo, image_wh, image_bk = self._create_multiple_images() + # Template should have the one w/ lower sequence + expected = ((self.black_image, self.template),) + self._test_main_images(expected) + # Should have different main images + expected = ( + (self.white_image, self.product_a + self.product_c), + (self.black_image, self.product_b), + ) + self._test_main_images(expected) + # Change image order, change main image + logo.sequence = 0 + image_wh.sequence = 10 + expected = ((self.logo_image, self.template),) + self._test_main_images(expected) + expected = ( + (self.logo_image, self.product_a + self.product_c), + (self.logo_image, self.product_b), + ) + self._test_main_images(expected) + + def test_main_image_attribute(self): + """ + Attach the image to the template and check the first image of the + variant is the one with same attributes + """ + self.env["fs.product.image"].create( + { + "product_tmpl_id": self.template.id, + "image_id": self.image_logo.id, + "sequence": 1, + "link_existing": True, + } + ) + self.env["fs.product.image"].create( + { + "product_tmpl_id": self.template.id, + "image_id": self.image_white.id, + "attribute_value_ids": [ + ( + 6, + 0, + [ + self.env.ref("product.product_attribute_value_4").id, + self.env.ref("product.product_attribute_value_1").id, + ], + ) + ], + "sequence": 10, + "link_existing": True, + } + ) + # The variant should not take the only with the lowest sequence but + # the one with same attributes + expected = ((self.white_image, self.product_b),) + self._test_main_images(expected) + expected = ((self.logo_image, self.product_c + self.product_a),) + self._test_main_images(expected) + + def test_drop_template_attribute_value_propagation_to_image(self): + black_image = self.env["fs.product.image"].create( + { + "product_tmpl_id": self.template.id, + "image_id": self.image_black.id, + "attribute_value_ids": [ + ( + 6, + 0, + [ + self.env.ref("product.product_attribute_value_4").id, + self.env.ref("product.product_attribute_value_1").id, + ], + ) + ], + "sequence": 10, + "link_existing": True, + } + ) + # Remove Color black from variant tab: + self.template.attribute_line_ids.sudo().filtered( + lambda x: x.display_name == "Color" + ).value_ids -= self.env.ref("product.product_attribute_value_4") + # Attribute black is removed from image: + self.assertTrue( + self.env.ref("product.product_attribute_value_4") + not in black_image.attribute_value_ids + ) + + # Remove Leg attribute line from variant tab: + self.template.attribute_line_ids.sudo().filtered( + lambda x: x.display_name == "Legs" + ).unlink() + # Product image attribute values from Legs are removed: + self.assertTrue( + self.env.ref("product.product_attribute_value_1") + not in black_image.attribute_value_ids + ) diff --git a/fs_product_multi_image/views/fs_product_category_image.xml b/fs_product_multi_image/views/fs_product_category_image.xml new file mode 100644 index 0000000000..acaba220aa --- /dev/null +++ b/fs_product_multi_image/views/fs_product_category_image.xml @@ -0,0 +1,21 @@ + + + + + + product.category.fs.image.form + fs.product.category.image + + primary + + + + + + + + diff --git a/fs_product_multi_image/views/fs_product_image.xml b/fs_product_multi_image/views/fs_product_image.xml new file mode 100644 index 0000000000..e60cf84bda --- /dev/null +++ b/fs_product_multi_image/views/fs_product_image.xml @@ -0,0 +1,32 @@ + + + + + + fs.product.image.form + fs.product.image + + primary + + + + + + + + + + diff --git a/fs_product_multi_image/views/product_category.xml b/fs_product_multi_image/views/product_category.xml new file mode 100644 index 0000000000..c4e3757fd2 --- /dev/null +++ b/fs_product_multi_image/views/product_category.xml @@ -0,0 +1,35 @@ + + + + + + product.category.form + product.category + + +
+ +
+ + + + + + + + + + + +
+
+ + + +
diff --git a/fs_product_multi_image/views/product_product.xml b/fs_product_multi_image/views/product_product.xml new file mode 100644 index 0000000000..b7534f26ad --- /dev/null +++ b/fs_product_multi_image/views/product_product.xml @@ -0,0 +1,57 @@ + + + + + product.product + + + + + kanban_image('product.product', 'image_medium', record.id.raw_value) + + + + + product.product + + + + 1 + + + + + + +

+ If you need to edit the images, do it from the product template. +

+ +
+
+
+
+ + product.product + + + + 1 + + + + + + +
diff --git a/fs_product_multi_image/views/product_template.xml b/fs_product_multi_image/views/product_template.xml new file mode 100644 index 0000000000..7298ae3583 --- /dev/null +++ b/fs_product_multi_image/views/product_template.xml @@ -0,0 +1,49 @@ + + + + + product.template + + + + + 1 + + + + + + + + + + + + + + + + + + + product.template + + + + + kanban_image('product.template', 'image_medium', record.id.raw_value) + + + + diff --git a/image_tag/README.rst b/image_tag/README.rst new file mode 100644 index 0000000000..38929e8775 --- /dev/null +++ b/image_tag/README.rst @@ -0,0 +1,35 @@ +**This file is going to be generated by oca-gen-addon-readme.** + +*Manual changes will be overwritten.* + +Please provide content in the ``readme`` directory: + +* **DESCRIPTION.rst** (required) +* INSTALL.rst (optional) +* CONFIGURE.rst (optional) +* **USAGE.rst** (optional, highly recommended) +* DEVELOP.rst (optional) +* ROADMAP.rst (optional) +* HISTORY.rst (optional, recommended) +* **CONTRIBUTORS.rst** (optional, highly recommended) +* CREDITS.rst (optional) + +Content of this README will also be drawn from the addon manifest, +from keys such as name, authors, maintainers, development_status, +and license. + +A good, one sentence summary in the manifest is also highly recommended. + + +Automatic changelog generation +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +`HISTORY.rst` can be auto generated using `towncrier `_. + +Just put towncrier compatible changelog fragments into `readme/newsfragments` +and the changelog file will be automatically generated and updated when a new fragment is added. + +Please refer to `towncrier` documentation to know more. + +NOTE: the changelog will be automatically generated when using `/ocabot merge $option`. +If you need to run it manually, refer to `OCA/maintainer-tools README `_. diff --git a/image_tag/__init__.py b/image_tag/__init__.py new file mode 100644 index 0000000000..0650744f6b --- /dev/null +++ b/image_tag/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/image_tag/__manifest__.py b/image_tag/__manifest__.py new file mode 100644 index 0000000000..9fce9bee00 --- /dev/null +++ b/image_tag/__manifest__.py @@ -0,0 +1,19 @@ +# Copyright 2023 ACSONE SA/NV +# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). + +{ + "name": "Image Tag", + "summary": """ + Image tag model""", + "version": "16.0.1.0.0", + "license": "AGPL-3", + "author": "ACSONE SA/NV,Akretion,Odoo Community Association (OCA)", + "website": "https://github.com/OCA/storage", + "depends": ["server_environment", "sale"], # sale is needed for the menu only :-( + "data": [ + "security/res_groups.xml", + "security/image_tag.xml", + "views/image_tag.xml", + ], + "demo": [], +} diff --git a/image_tag/models/__init__.py b/image_tag/models/__init__.py new file mode 100644 index 0000000000..888490ab30 --- /dev/null +++ b/image_tag/models/__init__.py @@ -0,0 +1 @@ +from . import image_tag diff --git a/image_tag/models/image_tag.py b/image_tag/models/image_tag.py new file mode 100644 index 0000000000..86f255873d --- /dev/null +++ b/image_tag/models/image_tag.py @@ -0,0 +1,22 @@ +# Copyright 2023 ACSONE SA/NV +# Copyright 2018 Akretion (http://www.akretion.com). +# @author Raphaël Reverdy +# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). + +from odoo import api, fields, models + + +class ImageTag(models.Model): + _name = "image.tag" + _inherit = ["server.env.techname.mixin"] + _description = "Image Tag" + + @api.model + def _get_default_apply_on(self): + return False + + name = fields.Char(required=True) + apply_on = fields.Selection( + selection=[], + default=lambda self: self._get_default_apply_on(), + ) diff --git a/image_tag/readme/CONTRIBUTORS.rst b/image_tag/readme/CONTRIBUTORS.rst new file mode 100644 index 0000000000..172b2d223c --- /dev/null +++ b/image_tag/readme/CONTRIBUTORS.rst @@ -0,0 +1 @@ +* Laurent Mignon diff --git a/image_tag/readme/DESCRIPTION.rst b/image_tag/readme/DESCRIPTION.rst new file mode 100644 index 0000000000..40adead6fe --- /dev/null +++ b/image_tag/readme/DESCRIPTION.rst @@ -0,0 +1,3 @@ +This addon provide only one basic model used to define image's tags. These +tags are used by other addons to enrich the image's information of an image +linked to an other model. The `fs_product_multi_image` addon use this model. diff --git a/image_tag/readme/USAGE.rst b/image_tag/readme/USAGE.rst new file mode 100644 index 0000000000..314932f6fa --- /dev/null +++ b/image_tag/readme/USAGE.rst @@ -0,0 +1,2 @@ +To manage the list of available tags, you must have the ``Image Tag Manager`` +role. diff --git a/image_tag/security/image_tag.xml b/image_tag/security/image_tag.xml new file mode 100644 index 0000000000..61a18fa863 --- /dev/null +++ b/image_tag/security/image_tag.xml @@ -0,0 +1,25 @@ + + + + + + image.tag access read + + + + + + + + + + image.tag access read + + + + + + + + diff --git a/image_tag/security/res_groups.xml b/image_tag/security/res_groups.xml new file mode 100644 index 0000000000..7ba612b045 --- /dev/null +++ b/image_tag/security/res_groups.xml @@ -0,0 +1,10 @@ + + + + Image Tag Manager + + + diff --git a/image_tag/static/description/icon.png b/image_tag/static/description/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..3a0328b516c4980e8e44cdb63fd945757ddd132d GIT binary patch literal 9455 zcmW++2RxMjAAjx~&dlBk9S+%}OXg)AGE&Cb*&}d0jUxM@u(PQx^-s)697TX`ehR4?GS^qbkof1cslKgkU)h65qZ9Oc=ml_0temigYLJfnz{IDzUf>bGs4N!v3=Z3jMq&A#7%rM5eQ#dc?k~! zVpnB`o+K7|Al`Q_U;eD$B zfJtP*jH`siUq~{KE)`jP2|#TUEFGRryE2`i0**z#*^6~AI|YzIWy$Cu#CSLW3q=GA z6`?GZymC;dCPk~rBS%eCb`5OLr;RUZ;D`}um=H)BfVIq%7VhiMr)_#G0N#zrNH|__ zc+blN2UAB0=617@>_u;MPHN;P;N#YoE=)R#i$k_`UAA>WWCcEVMh~L_ zj--gtp&|K1#58Yz*AHCTMziU1Jzt_jG0I@qAOHsk$2}yTmVkBp_eHuY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Hb95KQEwvf<(3T<9-Zm$xIew#P22 zc2Ix|App^>v6(3L_MCU0d3W##AB0M~3D00EWoKZqsJYT(#@w$Y_H7G22M~ApVFTRHMI_3be)Lkn#0F*V8Pq zc}`Cjy$bE;FJ6H7p=0y#R>`}-m4(0F>%@P|?7fx{=R^uFdISRnZ2W_xQhD{YuR3t< z{6yxu=4~JkeA;|(J6_nv#>Nvs&FuLA&PW^he@t(UwFFE8)|a!R{`E`K`i^ZnyE4$k z;(749Ix|oi$c3QbEJ3b~D_kQsPz~fIUKym($a_7dJ?o+40*OLl^{=&oq$<#Q(yyrp z{J-FAniyAw9tPbe&IhQ|a`DqFTVQGQ&Gq3!C2==4x{6EJwiPZ8zub-iXoUtkJiG{} zPaR&}_fn8_z~(=;5lD-aPWD3z8PZS@AaUiomF!G8I}Mf>e~0g#BelA-5#`cj;O5>N Xviia!U7SGha1wx#SCgwmn*{w2TRX*I literal 0 HcmV?d00001 diff --git a/image_tag/views/image_tag.xml b/image_tag/views/image_tag.xml new file mode 100644 index 0000000000..05a7a67489 --- /dev/null +++ b/image_tag/views/image_tag.xml @@ -0,0 +1,43 @@ + + + + image.tag + + + + + + + + + + image.tag + + + + + + + + + Image Tag + ir.actions.act_window + image.tag + tree + + [] + {} + + + + + tree + + + + diff --git a/setup/fs_base_multi_image/odoo/addons/fs_base_multi_image b/setup/fs_base_multi_image/odoo/addons/fs_base_multi_image new file mode 120000 index 0000000000..e4d18ef8c4 --- /dev/null +++ b/setup/fs_base_multi_image/odoo/addons/fs_base_multi_image @@ -0,0 +1 @@ +../../../../fs_base_multi_image \ No newline at end of file diff --git a/setup/fs_base_multi_image/setup.py b/setup/fs_base_multi_image/setup.py new file mode 100644 index 0000000000..28c57bb640 --- /dev/null +++ b/setup/fs_base_multi_image/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/setup/fs_product_multi_image/odoo/addons/fs_product_multi_image b/setup/fs_product_multi_image/odoo/addons/fs_product_multi_image new file mode 120000 index 0000000000..3327030d29 --- /dev/null +++ b/setup/fs_product_multi_image/odoo/addons/fs_product_multi_image @@ -0,0 +1 @@ +../../../../fs_product_multi_image \ No newline at end of file diff --git a/setup/fs_product_multi_image/setup.py b/setup/fs_product_multi_image/setup.py new file mode 100644 index 0000000000..28c57bb640 --- /dev/null +++ b/setup/fs_product_multi_image/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/setup/image_tag/odoo/addons/image_tag b/setup/image_tag/odoo/addons/image_tag new file mode 120000 index 0000000000..f25ed02804 --- /dev/null +++ b/setup/image_tag/odoo/addons/image_tag @@ -0,0 +1 @@ +../../../../image_tag \ No newline at end of file diff --git a/setup/image_tag/setup.py b/setup/image_tag/setup.py new file mode 100644 index 0000000000..28c57bb640 --- /dev/null +++ b/setup/image_tag/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)