-
-
Notifications
You must be signed in to change notification settings - Fork 161
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ADD] fs_product_public_category_multi_image: a drop-in replacement o…
…f storage_image_product_public_category
- Loading branch information
1 parent
1fe1a81
commit c73b9cd
Showing
19 changed files
with
790 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
====================================== | ||
Fs Product Public Category Multi Image | ||
====================================== | ||
|
||
.. | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! This file is generated by oca-gen-addon-readme !! | ||
!! changes will be overwritten. !! | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! source digest: sha256:52faa35306ff117e720655c0ff7d10523f12a5d0f19d1213cd6d183ed81c513f | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
.. |badge1| image:: https://img.shields.io/badge/maturity-Alpha-red.png | ||
:target: https://odoo-community.org/page/development-status | ||
:alt: Alpha | ||
.. |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/16.0/fs_product_public_category_multi_image | ||
:alt: OCA/storage | ||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png | ||
:target: https://translation.odoo-community.org/projects/storage-16-0/storage-16-0-fs_product_public_category_multi_image | ||
: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=16.0 | ||
:alt: Try me on Runboat | ||
|
||
|badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
||
Attach images to public categories | ||
|
||
.. IMPORTANT:: | ||
This is an alpha version, the data model and design can change at any time without warning. | ||
Only for development or testing purpose, do not use in production. | ||
`More details on development status <https://odoo-community.org/page/development-status>`_ | ||
|
||
**Table of contents** | ||
|
||
.. contents:: | ||
:local: | ||
|
||
Usage | ||
===== | ||
|
||
A) Public Categories | ||
|
||
Go to Website > eCommerce > Products > eCommerce Categories. | ||
A new section Images is available to upload or use an existing image. | ||
|
||
For uploading and managing the images see the module fs_product_multi_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:%20fs_product_public_category_multi_image%0Aversion:%2016.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 | ||
======= | ||
|
||
Contributors | ||
~~~~~~~~~~~~ | ||
|
||
* Juany Davila <juany.davila@forgeflow.com> | ||
* Bernat Puig <bernat.puig@forgeflow.com> | ||
|
||
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/16.0/fs_product_public_category_multi_image>`_ project on GitHub. | ||
|
||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Copyright 2024 ForgeFlow (http://www.forgeflow.com). | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
{ | ||
"name": "Fs Product Public Category Multi Image", | ||
"summary": """ | ||
Manage multi images from extenal file system on eCommerce public categories""", | ||
"version": "16.0.1.0.0", | ||
"license": "AGPL-3", | ||
"author": "Odoo Community Association (OCA)", | ||
"website": "https://github.com/OCA/storage", | ||
"depends": ["fs_product_multi_image", "website_sale"], | ||
"data": [ | ||
"security/fs_product_public_category_image.xml", | ||
"views/fs_product_public_category_image.xml", | ||
"views/product_public_category.xml", | ||
], | ||
"demo": [], | ||
"development_status": "Alpha", | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from . import fs_product_public_category_image | ||
from . import image_tag | ||
from . import product_public_category |
22 changes: 22 additions & 0 deletions
22
fs_product_public_category_multi_image/models/fs_product_public_category_image.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Copyright 2024 ForgeFlow (http://www.forgeflow.com). | ||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). | ||
|
||
from odoo import fields, models | ||
|
||
|
||
class FsProductPublicCategoryImage(models.Model): | ||
_name = "fs.product.public.category.image" | ||
_inherit = "fs.image.relation.mixin" | ||
_description = "Product Public Category Image" | ||
|
||
public_category_id = fields.Many2one( | ||
"product.public.category", | ||
required=True, | ||
ondelete="cascade", | ||
index=True, | ||
) | ||
tag_id = fields.Many2many( | ||
"image.tag", | ||
string="Tag", | ||
domain=[("apply_on", "=", "public.category")], | ||
) |
23 changes: 23 additions & 0 deletions
23
fs_product_public_category_multi_image/models/image_tag.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Copyright 2024 ForgeFlow (http://www.forgeflow.com). | ||
# 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 ( | ||
"public.category" | ||
if active_model == "public.category.image.relation" | ||
else super()._get_default_apply_on() | ||
) | ||
|
||
apply_on = fields.Selection( | ||
selection_add=[("public.category", "Public Category")], | ||
ondelete={"product": "cascade", "category": "cascade"}, | ||
) |
18 changes: 18 additions & 0 deletions
18
fs_product_public_category_multi_image/models/product_public_category.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Copyright 2024 ForgeFlow (http://www.forgeflow.com). | ||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). | ||
|
||
from odoo import fields, models | ||
|
||
from odoo.addons.fs_image.fields import FSImage | ||
|
||
|
||
class ProductPublicCategory(models.Model): | ||
_inherit = "product.public.category" | ||
|
||
image_ids = fields.One2many( | ||
string="Images", | ||
comodel_name="fs.product.public.category.image", | ||
inverse_name="public_category_id", | ||
) | ||
image = FSImage(related="image_ids.image", readonly=True, store=False) | ||
image_medium = FSImage(related="image_ids.image_medium", readonly=True, store=False) |
2 changes: 2 additions & 0 deletions
2
fs_product_public_category_multi_image/readme/CONTRIBUTORS.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
* Juany Davila <juany.davila@forgeflow.com> | ||
* Bernat Puig <bernat.puig@forgeflow.com> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Attach images to public categories |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
A) Public Categories | ||
|
||
Go to Website > eCommerce > Products > eCommerce Categories. | ||
A new section Images is available to upload or use an existing image. | ||
|
||
For uploading and managing the images see the module fs_product_multi_image. |
34 changes: 34 additions & 0 deletions
34
fs_product_public_category_multi_image/security/fs_product_public_category_image.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<!-- Copyright 2024 ForgeFlow (http://www.forgeflow.com). | ||
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). --> | ||
<odoo> | ||
|
||
<record model="ir.model.access" id="fs_product_public_category_image_read"> | ||
<field name="name">fs.product.public.category.image access read</field> | ||
<field name="model_id" ref="model_fs_product_public_category_image" /> | ||
<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="fs_product_public_category_image_system_admin"> | ||
<field name="name">fs.product.public.category.image access system admin</field> | ||
<field name="model_id" ref="model_fs_product_public_category_image" /> | ||
<field name="group_id" ref="base.group_system" /> | ||
<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> | ||
<record model="ir.model.access" id="fs_product_public_category_image_sales_manager"> | ||
<field name="name">fs.product.public.category.image access sales manager</field> | ||
<field name="model_id" ref="model_fs_product_public_category_image" /> | ||
<field name="group_id" ref="sales_team.group_sale_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.
Oops, something went wrong.