Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[15.0] [MIG] storage_image_product_brand: Migration to 15.0 #394

Open
wants to merge 25 commits into
base: 15.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
0489df1
[ADD] Storage image product brand
qgroulard Nov 30, 2020
858c826
[UPD] Update storage_image_product_brand.pot
oca-travis Dec 6, 2020
aca86c4
[UPD] README.rst
OCA-git-bot Dec 6, 2020
5e2b219
[ADD] add new V14 config
sebastienbeau Dec 6, 2020
b662676
[IMP] all: black, isort, prettier
sebastienbeau Dec 6, 2020
f34b914
[MIG] batch migration of modules
sebastienbeau Dec 6, 2020
cd517c6
[CHG] storage: Use more permissive licence: AGPL-> LGPL
etobella Mar 10, 2021
209b8bb
[IMP] storage_image_product_brand: Technical improvements
ivantodorovich Jul 29, 2021
afeca4c
[FIX] storage_image_product_brand: Do not store url
ivantodorovich Aug 2, 2021
6e13e89
[MIG] storage_image_product_brand: Migration to 14.0
ivantodorovich Aug 25, 2021
7e1216b
[UPD] Update storage_image_product_brand.pot
oca-travis Aug 25, 2021
f95435a
[UPD] README.rst
OCA-git-bot Aug 25, 2021
e69fd05
[IMP] add tag support for brand image
sebastienbeau Aug 30, 2021
5faed07
[UPD] Update storage_image_product_brand.pot
oca-travis Oct 4, 2021
41c9a12
storage_image_product_brand 14.0.1.1.0
OCA-git-bot Oct 4, 2021
7be4e9d
[IMP] use notebook for a better UI
sebastienbeau Oct 6, 2021
2ca6123
[FIX] storage_image_product_brand: fix dependency on storage_image_pr…
kevinkhao Oct 6, 2021
d83c54a
storage_image_product_brand 14.0.1.2.0
OCA-git-bot Oct 6, 2021
3473b29
storage_image_product_brand 14.0.1.3.0
OCA-git-bot Oct 15, 2021
b5b2f15
[UPD] Update storage_image_product_brand.pot
oca-travis May 27, 2022
6f593c4
storage_image_product_brand: re-license to AGPL
simahawk Aug 1, 2022
bd79eeb
storage_image_product_brand 14.0.2.0.0
OCA-git-bot Aug 1, 2022
4a5ebbc
[UPD] README.rst
OCA-git-bot Sep 4, 2023
e490326
[IMP] storage_image_product_brand: black, isort, prettier
bizzappdev Oct 1, 2024
752f6d3
[MIG][15.0] storage_image_product_brand:Migration to 15.0
bizzappdev Oct 1, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions setup/storage_image_product_brand/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
87 changes: 87 additions & 0 deletions storage_image_product_brand/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
===========================
Storage Image Product Brand
===========================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:494af9918f9bcaf619be482903bd5ad999f2358d91801f71ccd01b7e1612509f
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |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%2Fstorage-lightgray.png?logo=github
:target: https://github.com/OCA/storage/tree/14.0/storage_image_product_brand
:alt: OCA/storage
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/storage-14-0/storage-14-0-storage_image_product_brand
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/storage&target_branch=14.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

Attach images to product brands

**Table of contents**

.. contents::
:local:

Usage
=====

Go to Sales > Configuration > Products > Product Brands.
A new field Images is available to upload or use existing images.

For uploading and managing the images see the module storage_image.

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/storage/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/storage/issues/new?body=module:%20storage_image_product_brand%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

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

Credits
=======

Authors
~~~~~~~

* ACSONE SA/NV

Contributors
~~~~~~~~~~~~

* Quentin Groulard <[email protected]>
* `Camptocamp <https://www.camptocamp.com>`_

* Iván Todorovich <[email protected]>

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/storage <https://github.com/OCA/storage/tree/14.0/storage_image_product_brand>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions storage_image_product_brand/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
17 changes: 17 additions & 0 deletions storage_image_product_brand/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright 2020 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
"name": "Storage Image Product Brand",
"summary": "Link images to product brands",
"version": "15.0.1.0.0",
"license": "AGPL-3",
"author": "ACSONE SA/NV,Odoo Community Association (OCA)",
"website": "https://github.com/OCA/storage",
"depends": ["storage_image_product", "product_brand"],
"data": [
"security/product_brand_image_relation.xml",
"views/product_brand.xml",
"views/product_brand_image_relation.xml",
],
}
139 changes: 139 additions & 0 deletions storage_image_product_brand/i18n/storage_image_product_brand.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * storage_image_product_brand
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.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: storage_image_product_brand
#: model:ir.model.fields,field_description:storage_image_product_brand.field_product_brand_image_relation__image_alt_name
msgid "Alt Image name"
msgstr ""

#. module: storage_image_product_brand
#: model:ir.model.fields,field_description:storage_image_product_brand.field_image_tag__apply_on
msgid "Apply On"
msgstr ""

#. module: storage_image_product_brand
#: model:ir.model.fields,field_description:storage_image_product_brand.field_product_brand_image_relation__brand_id
#: model:ir.model.fields.selection,name:storage_image_product_brand.selection__image_tag__apply_on__brand
msgid "Brand"
msgstr ""

#. module: storage_image_product_brand
#: model:ir.model.fields,field_description:storage_image_product_brand.field_product_brand_image_relation__create_uid
msgid "Created by"
msgstr ""

#. module: storage_image_product_brand
#: model:ir.model.fields,field_description:storage_image_product_brand.field_product_brand_image_relation__create_date
msgid "Created on"
msgstr ""

#. module: storage_image_product_brand
#: model:ir.model.fields,field_description:storage_image_product_brand.field_image_tag__display_name
#: model:ir.model.fields,field_description:storage_image_product_brand.field_product_brand__display_name
#: model:ir.model.fields,field_description:storage_image_product_brand.field_product_brand_image_relation__display_name
msgid "Display Name"
msgstr ""

#. module: storage_image_product_brand
#: model:ir.model.fields,field_description:storage_image_product_brand.field_image_tag__id
#: model:ir.model.fields,field_description:storage_image_product_brand.field_product_brand__id
#: model:ir.model.fields,field_description:storage_image_product_brand.field_product_brand_image_relation__id
msgid "ID"
msgstr ""

#. module: storage_image_product_brand
#: model:ir.model.fields,field_description:storage_image_product_brand.field_product_brand_image_relation__image_id
msgid "Image"
msgstr ""

#. module: storage_image_product_brand
#: model:ir.model,name:storage_image_product_brand.model_image_tag
msgid "Image Tag"
msgstr ""

#. module: storage_image_product_brand
#: model:ir.model.fields,field_description:storage_image_product_brand.field_product_brand__image_ids
#: model_terms:ir.ui.view,arch_db:storage_image_product_brand.product_brand_form_view
#: model_terms:ir.ui.view,arch_db:storage_image_product_brand.product_brand_image_relation_form_view
#: model_terms:ir.ui.view,arch_db:storage_image_product_brand.product_brand_image_relation_kanban_view
msgid "Images"
msgstr ""

#. module: storage_image_product_brand
#: model:ir.model.fields,field_description:storage_image_product_brand.field_product_brand_image_relation__import_from_url
msgid "Imported From Url"
msgstr ""

#. module: storage_image_product_brand
#: model:ir.model.fields,field_description:storage_image_product_brand.field_image_tag____last_update
#: model:ir.model.fields,field_description:storage_image_product_brand.field_product_brand____last_update
#: model:ir.model.fields,field_description:storage_image_product_brand.field_product_brand_image_relation____last_update
msgid "Last Modified on"
msgstr ""

#. module: storage_image_product_brand
#: model:ir.model.fields,field_description:storage_image_product_brand.field_product_brand_image_relation__write_uid
msgid "Last Updated by"
msgstr ""

#. module: storage_image_product_brand
#: model:ir.model.fields,field_description:storage_image_product_brand.field_product_brand_image_relation__write_date
msgid "Last Updated on"
msgstr ""

#. module: storage_image_product_brand
#: model:ir.model.fields,field_description:storage_image_product_brand.field_product_brand__main_image_id
msgid "Main Image"
msgstr ""

#. module: storage_image_product_brand
#: model:ir.model.fields,field_description:storage_image_product_brand.field_product_brand__image_medium_url
msgid "Main Image URL (medium)"
msgstr ""

#. module: storage_image_product_brand
#: model:ir.model.fields,field_description:storage_image_product_brand.field_product_brand__image_small_url
msgid "Main Image URL (small)"
msgstr ""

#. module: storage_image_product_brand
#: model:ir.model.fields,field_description:storage_image_product_brand.field_product_brand_image_relation__image_url
msgid "Medium thumb URL"
msgstr ""

#. module: storage_image_product_brand
#: model:ir.model.fields,field_description:storage_image_product_brand.field_product_brand_image_relation__image_name
msgid "Name"
msgstr ""

#. module: storage_image_product_brand
#: model:ir.model,name:storage_image_product_brand.model_product_brand
msgid "Product Brand"
msgstr ""

#. module: storage_image_product_brand
#: model:ir.model,name:storage_image_product_brand.model_product_brand_image_relation
msgid "Product Brand Image Relation"
msgstr ""

#. module: storage_image_product_brand
#: model:ir.model.fields,field_description:storage_image_product_brand.field_product_brand_image_relation__sequence
msgid "Sequence"
msgstr ""

#. module: storage_image_product_brand
#: model:ir.model.fields,field_description:storage_image_product_brand.field_product_brand_image_relation__tag_id
msgid "tag"
msgstr ""
3 changes: 3 additions & 0 deletions storage_image_product_brand/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from . import product_brand
from . import product_brand_image_relation
from . import image_tag
20 changes: 20 additions & 0 deletions storage_image_product_brand/models/image_tag.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright 2021 Akretion (https://www.akretion.com).
# @author Sébastien BEAU <[email protected]>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).


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")
if active_model == "product.brand.image.relation":
return "brand"

Check warning on line 16 in storage_image_product_brand/models/image_tag.py

View check run for this annotation

Codecov / codecov/patch

storage_image_product_brand/models/image_tag.py#L16

Added line #L16 was not covered by tests
else:
return super()._get_default_apply_on()

apply_on = fields.Selection(selection_add=[("brand", "Brand")])
33 changes: 33 additions & 0 deletions storage_image_product_brand/models/product_brand.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Copyright 2020 ACSONE SA/NV
# Copyright 2021 Camptocamp (http://www.camptocamp.com).
# @author Iván Todorovich <[email protected]>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import api, fields, models


class ProductBrand(models.Model):
_inherit = "product.brand"

image_ids = fields.One2many(
comodel_name="product.brand.image.relation",
inverse_name="brand_id",
string="Images",
)
main_image_id = fields.Many2one(
comodel_name="storage.image",
compute="_compute_main_image_id",
# Store it to improve perf on product views
store=True,
)
image_small_url = fields.Char(
string="Main Image URL (small)", related="main_image_id.image_small_url"
)
image_medium_url = fields.Char(
string="Main Image URL (medium)", related="main_image_id.image_medium_url"
)

@api.depends("image_ids.sequence")
def _compute_main_image_id(self):
for rec in self:
rec.main_image_id = fields.first(rec.image_ids).image_id

Check warning on line 33 in storage_image_product_brand/models/product_brand.py

View check run for this annotation

Codecov / codecov/patch

storage_image_product_brand/models/product_brand.py#L33

Added line #L33 was not covered by tests
21 changes: 21 additions & 0 deletions storage_image_product_brand/models/product_brand_image_relation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright 2020 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import fields, models


class ProductBrandImageRelation(models.Model):
_name = "product.brand.image.relation"
_inherit = "image.relation.abstract"
_description = "Product Brand Image Relation"

brand_id = fields.Many2one(
"product.brand",
required=True,
ondelete="cascade",
)
tag_id = fields.Many2one(
"image.tag",
string="tag",
domain=[("apply_on", "=", "brand")],
)
4 changes: 4 additions & 0 deletions storage_image_product_brand/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
* Quentin Groulard <[email protected]>
* `Camptocamp <https://www.camptocamp.com>`_

* Iván Todorovich <[email protected]>
1 change: 1 addition & 0 deletions storage_image_product_brand/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Attach images to product brands
4 changes: 4 additions & 0 deletions storage_image_product_brand/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Go to Sales > Configuration > Products > Product Brands.
A new field Images is available to upload or use existing images.

For uploading and managing the images see the module storage_image.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2020 ACSONE SA/NV
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<odoo>
<record model="ir.model.access" id="product_brand_image_relation_access_read">
<field name="name">product.brand.image.relation access read</field>
<field name="model_id" ref="model_product_brand_image_relation" />
<field name="group_id" ref="base.group_user" />
<field name="perm_read" eval="1" />
<field name="perm_create" eval="0" />
<field name="perm_write" eval="0" />
<field name="perm_unlink" eval="0" />
</record>
<record model="ir.model.access" id="product_brand_image_relation_access_edit">
<field name="name">product.brand.image.relation access edit</field>
<field name="model_id" ref="model_product_brand_image_relation" />
<field name="group_id" ref="storage_image.group_image_manager" />
<field name="perm_read" eval="1" />
<field name="perm_create" eval="1" />
<field name="perm_write" eval="1" />
<field name="perm_unlink" eval="1" />
</record>
</odoo>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading