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

[17.0][MIG] product_category_active: Migration to 17.0 #1487

Closed
wants to merge 24 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
e1ea81e
[ADD] product_category_archive: new module
May 4, 2020
5cd8f56
[FIX] product_category_archive: Constraint search refinement
pedrobaeza May 15, 2020
34a99ee
[IMP] product_category_archive: add a test
May 15, 2020
cd5626d
Added translation using Weblate (Portuguese)
pedrocs-exo Oct 18, 2020
142e96e
Translated using Weblate (Portuguese)
pedrocs-exo Oct 18, 2020
b96d543
Added translation using Weblate (Catalan)
claudiagn Jan 26, 2021
086a8d1
Translated using Weblate (Catalan)
claudiagn Jan 26, 2021
b7897a7
[IMP] product_category_active: black, isort, prettier
CarlosRoca13 Feb 19, 2021
4788a19
[MIG] product_category_active: Migration to v13.0
CarlosRoca13 Feb 19, 2021
c138dd7
[14.0][MIG] product_category_active
rousseldenis Dec 22, 2021
72c3be7
[MIG] product_category_active: Migration to 15.0
tgrellety Mar 9, 2022
b8dcc3f
[MIG] product_category_active: Migration to 16.0
Jan 17, 2023
95cfef1
[UPD] Update product_category_active.pot
Feb 15, 2023
c4fb006
[UPD] README.rst
OCA-git-bot Feb 15, 2023
30e1f45
product_category_active 16.0.1.0.1
OCA-git-bot Feb 15, 2023
aaa0ad3
Update translation files
weblate Feb 15, 2023
be41750
Added translation using Weblate (Italian)
PicchiSeba Apr 27, 2023
64926cd
Translated using Weblate (Italian)
PicchiSeba Apr 27, 2023
ee71951
[UPD] README.rst
OCA-git-bot Sep 3, 2023
0145e64
[IMP] product_category_active: test performance improvement
josep-tecnativa Oct 23, 2023
75e2540
[BOT] post-merge updates
OCA-git-bot Oct 30, 2023
a69da53
Translated using Weblate (Italian)
mymage Nov 1, 2023
3230f33
[IMP] product_category_active: pre-commit auto fixes
LuisBrose Jan 2, 2024
f0ee551
[MIG] product_category_active: Migration to 17.0
LuisBrose Jan 2, 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
108 changes: 108 additions & 0 deletions product_category_active/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
=======================
Product Category Active
=======================

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

.. |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%2Fproduct--attribute-lightgray.png?logo=github
:target: https://github.com/OCA/product-attribute/tree/17.0/product_category_active
:alt: OCA/product-attribute
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/product-attribute-17-0/product-attribute-17-0-product_category_active
: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/product-attribute&target_branch=17.0
:alt: Try me on Runboat

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

This module allows you to archive product categories.

**Table of contents**

.. contents::
:local:

Usage
=====

To use this module, you need to:

1. Go to *Inventory > Configuration > Products > Product categories*.
2. Select a product category or create a new one.
3. Click on the smart button Archive (this action will set active field
to False).

Note: If there are products in the category to be archived or any of its
children categories, an error will be raised and it won't be archived.

Note 2: Children category are not archived/unarchived when the parent
category does.

Known issues / Roadmap
======================

- when you try to deactivate a category from the tree view by clicking
on the boolean_toggle widget, if a validation error pop-up appears
indicating that the element cannot be deactivated, then the element
is NOT deactivated, although the corresponding line turns gray as if
it had been disabled, until that tree view is refreshed.

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/product-attribute/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/product-attribute/issues/new?body=module:%20product_category_active%0Aversion:%2017.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
-------

* Tecnativa

Contributors
------------

- `Tecnativa <https://www.tecnativa.com>`__:

- Ernesto Tejeda
- Pedro M. Baeza
- Carlos Roca

- Denis Roussel <denis.roussel@acsone.eu>
- Luis Brose <l.brose@intero-technologies.de>

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/product-attribute <https://github.com/OCA/product-attribute/tree/17.0/product_category_active>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
3 changes: 3 additions & 0 deletions product_category_active/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from . import models
14 changes: 14 additions & 0 deletions product_category_active/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright 2020 Tecnativa - Ernesto Tejeda
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

{
"name": "Product Category Active",
"version": "17.0.1.0.0",
"category": "Product",
"summary": "Add option to archive product categories",
"author": "Tecnativa, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/product-attribute",
"license": "AGPL-3",
"depends": ["product"],
"data": ["views/product_views.xml"],
}
48 changes: 48 additions & 0 deletions product_category_active/i18n/ca.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * product_category_active
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: \n"
"PO-Revision-Date: 2021-02-22 08:57+0100\n"
"Last-Translator: Carlos <carlos.roca@tecnativa.com>\n"
"Language-Team: none\n"
"Language: ca\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Poedit 2.0.6\n"

#. module: product_category_active
#: model:ir.model.fields,field_description:product_category_active.field_product_category__active
msgid "Active"
msgstr "Actiu"

#. module: product_category_active
#. odoo-python
#: code:addons/product_category_active/models/product_category.py:0
#, python-format
msgid ""
"At least one category that you are trying to archive or one of its children "
"has one or more product linked to it."
msgstr ""
"Almenys una categoria que intenteu arxivar o un dels seus fills hi té un o "
"més productes vinculats."

#. module: product_category_active
#: model:ir.model.fields,help:product_category_active.field_product_category__active
msgid ""
"If unchecked, it will allow you to hide the product category without "
"removing it."
msgstr ""
"Si no està marcat, us permetrà amagar la categoria de producte sense "
"eliminar-la."

#. module: product_category_active
#: model:ir.model,name:product_category_active.model_product_category
msgid "Product Category"
msgstr "Categoria de producte"
48 changes: 48 additions & 0 deletions product_category_active/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * product_category_archive
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: \n"
"PO-Revision-Date: 2021-02-22 08:57+0100\n"
"Last-Translator: Carlos <carlos.roca@tecnativa.com>\n"
"Language-Team: \n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Poedit 2.0.6\n"

#. module: product_category_active
#: model:ir.model.fields,field_description:product_category_active.field_product_category__active
msgid "Active"
msgstr "Activo"

#. module: product_category_active
#. odoo-python
#: code:addons/product_category_active/models/product_category.py:0
#, python-format
msgid ""
"At least one category that you are trying to archive or one of its children "
"has one or more product linked to it."
msgstr ""
"Al menos una de las categorías que se están intentando archivar o al menos "
"una de sus hijas tiene uno o más productos asociados."

#. module: product_category_active
#: model:ir.model.fields,help:product_category_active.field_product_category__active
msgid ""
"If unchecked, it will allow you to hide the product category without "
"removing it."
msgstr ""
"Si no está marcado, permitirá ocultar la categoría de producto sin "
"eliminarla."

#. module: product_category_active
#: model:ir.model,name:product_category_active.model_product_category
msgid "Product Category"
msgstr "Categoría de producto"
47 changes: 47 additions & 0 deletions product_category_active/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * product_category_active
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2023-11-01 12:38+0000\n"
"Last-Translator: mymage <stefano.consolaro@mymage.it>\n"
"Language-Team: none\n"
"Language: it\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.17\n"

#. module: product_category_active
#: model:ir.model.fields,field_description:product_category_active.field_product_category__active
msgid "Active"
msgstr "Attivo"

#. module: product_category_active
#. odoo-python
#: code:addons/product_category_active/models/product_category.py:0
#, python-format
msgid ""
"At least one category that you are trying to archive or one of its children "
"has one or more product linked to it."
msgstr ""
"Almeno una categoria che si sta cercando di archiviare oppure una dei suoi "
"discendenti ha uno o più prodotti associati ad essa."

#. module: product_category_active
#: model:ir.model.fields,help:product_category_active.field_product_category__active
msgid ""
"If unchecked, it will allow you to hide the product category without "
"removing it."
msgstr ""
"Se non selezionato, consente di nascondere la categoria dei prodotti senza "
"rimuoverla."

#. module: product_category_active
#: model:ir.model,name:product_category_active.model_product_category
msgid "Product Category"
msgstr "Categoria prodotto"
40 changes: 40 additions & 0 deletions product_category_active/i18n/product_category_active.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * product_category_active
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.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: product_category_active
#: model:ir.model.fields,field_description:product_category_active.field_product_category__active
msgid "Active"
msgstr ""

#. module: product_category_active
#. odoo-python
#: code:addons/product_category_active/models/product_category.py:0
#, python-format
msgid ""
"At least one category that you are trying to archive or one of its children "
"has one or more product linked to it."
msgstr ""

#. module: product_category_active
#: model:ir.model.fields,help:product_category_active.field_product_category__active
msgid ""
"If unchecked, it will allow you to hide the product category without "
"removing it."
msgstr ""

#. module: product_category_active
#: model:ir.model,name:product_category_active.model_product_category
msgid "Product Category"
msgstr ""
44 changes: 44 additions & 0 deletions product_category_active/i18n/pt.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * product_category_active
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: \n"
"PO-Revision-Date: 2021-02-22 08:57+0100\n"
"Last-Translator: Carlos <carlos.roca@tecnativa.com>\n"
"Language-Team: none\n"
"Language: pt\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n > 1;\n"
"X-Generator: Poedit 2.0.6\n"

#. module: product_category_active
#: model:ir.model.fields,field_description:product_category_active.field_product_category__active
msgid "Active"
msgstr "Ativo"

#. module: product_category_active
#. odoo-python
#: code:addons/product_category_active/models/product_category.py:0
#, python-format
msgid ""
"At least one category that you are trying to archive or one of its children "
"has one or more product linked to it."
msgstr ""

#. module: product_category_active
#: model:ir.model.fields,help:product_category_active.field_product_category__active
msgid ""
"If unchecked, it will allow you to hide the product category without "
"removing it."
msgstr ""

#. module: product_category_active
#: model:ir.model,name:product_category_active.model_product_category
msgid "Product Category"
msgstr "Categoria de Produto"
1 change: 1 addition & 0 deletions product_category_active/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import product_category
30 changes: 30 additions & 0 deletions product_category_active/models/product_category.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Copyright 2020 Tecnativa - Ernesto Tejeda
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from odoo import _, api, fields, models
from odoo.exceptions import ValidationError


class ProductCategory(models.Model):
_inherit = "product.category"

active = fields.Boolean(
default=True,
help="If unchecked, it will allow you to hide the "
"product category without removing it.",
)

@api.constrains("active")
def _check_archive(self):
to_archive = self.filtered(lambda r: not r.active)
if (
self.env["product.template"]
.with_context(active_test=False)
.search([("categ_id", "child_of", to_archive.ids)])
):
raise ValidationError(
_(
"At least one category that you are trying to archive or one "
"of its children has one or more product linked to it."
)
)
3 changes: 3 additions & 0 deletions product_category_active/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
Loading
Loading