Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
104 changes: 104 additions & 0 deletions product_state_active/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
====================
Product State Active
====================

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

.. |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/18.0/product_state_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-18-0/product-attribute-18-0-product_state_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=18.0
:alt: Try me on Runboat

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

This module allows to set options on product states that will trigger
the activation or deactivation (Archive) of the products.

**Table of contents**

.. contents::
:local:

Usage
=====

1. Go to *Sales > Configuration > Products > Product States*.
2. Check the box 'Activate Product' or 'Deactivate Product'

To deactivate the product:

1. Go to the product itself and edit.
2. Click on the state you have configured to deactivate it

To deactivate the product:

1. Go to the product itself and edit.
2. Click on the state you have configured to activate it

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_state_active%0Aversion:%2018.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
------------

- Denis Roussel <denis.roussel@acsone.eu>
- `Komit <https://komit-consulting.com>`__:

- Cai Hoang Huynh

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.

.. |maintainer-rousseldenis| image:: https://github.com/rousseldenis.png?size=40px
:target: https://github.com/rousseldenis
:alt: rousseldenis

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-rousseldenis|

This module is part of the `OCA/product-attribute <https://github.com/OCA/product-attribute/tree/18.0/product_state_active>`_ 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 product_state_active/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
19 changes: 19 additions & 0 deletions product_state_active/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright 2021 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
"name": "Product State Active",
"summary": """
Allows to define option on product state to activate or inactivate product""",
"version": "18.0.1.0.0",
"license": "AGPL-3",
"author": "ACSONE SA/NV,Odoo Community Association (OCA)",
"maintainers": ["rousseldenis"],
"website": "https://github.com/OCA/product-attribute",
"depends": [
"product_state",
],
"data": [
"views/product_state.xml",
],
}
78 changes: 78 additions & 0 deletions product_state_active/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * product_state_active
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2024-01-13 23:56+0000\n"
"Last-Translator: Ivorra78 <informatica@totmaterial.es>\n"
"Language-Team: none\n"
"Language: es\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_state_active
#: model:ir.model.fields,field_description:product_state_active.field_product_state__activate_product
msgid "Activate Product"
msgstr "Activar Producto"

#. module: product_state_active
#: model:ir.model.fields,help:product_state_active.field_product_state__deactivate_product
msgid "Check this if you want to archive product when reaching this state."
msgstr ""
"Marque esta opción si desea archivar el producto cuando alcance este estado."

#. module: product_state_active
#: model:ir.model.fields,help:product_state_active.field_product_state__activate_product
msgid "Check this if you want to un-archive product when reaching this state."
msgstr ""
"Marque esta opción si desea desarchivar el producto cuando alcance este "
"estado."

#. module: product_state_active
#: model:ir.model.fields,field_description:product_state_active.field_product_state__deactivate_product
msgid "Deactivate Product"
msgstr "Desactivar Producto"

#. module: product_state_active
#: model:ir.model.fields,field_description:product_state_active.field_product_state__display_name
#: model:ir.model.fields,field_description:product_state_active.field_product_template__display_name
msgid "Display Name"
msgstr "Mostrar Nombre"

#. module: product_state_active
#: model:ir.model.fields,field_description:product_state_active.field_product_state__id
#: model:ir.model.fields,field_description:product_state_active.field_product_template__id
msgid "ID"
msgstr "ID"

#. module: product_state_active
#: model:ir.model.fields,field_description:product_state_active.field_product_state____last_update
#: model:ir.model.fields,field_description:product_state_active.field_product_template____last_update
msgid "Last Modified on"
msgstr "Última Modificación el"

#. module: product_state_active
#: model:ir.model,name:product_state_active.model_product_state
msgid "Product State"
msgstr "Estado del Producto"

#. module: product_state_active
#: model:ir.model,name:product_state_active.model_product_template
msgid "Product Template"
msgstr "Plantilla del Producto"

#. module: product_state_active
#: code:addons/product_state_active/models/product_state.py:0
#, python-format
msgid ""
"You cannot have both 'Deactivate Product' and 'Activate Product' options at "
"the same time!"
msgstr ""
"¡No puede tener las opciones \"Desactivar producto\" y \"Activar producto\" "
"al mismo tiempo!"
79 changes: 79 additions & 0 deletions product_state_active/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * product_state_active
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2023-11-03 09: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_state_active
#: model:ir.model.fields,field_description:product_state_active.field_product_state__activate_product
msgid "Activate Product"
msgstr "Prdotto attivato"

#. module: product_state_active
#: model:ir.model.fields,help:product_state_active.field_product_state__deactivate_product
msgid "Check this if you want to archive product when reaching this state."
msgstr ""
"Selezonare se si vuole che il prodotto venga archiviato quando raggiunge "
"questo stato."

#. module: product_state_active
#: model:ir.model.fields,help:product_state_active.field_product_state__activate_product
msgid "Check this if you want to un-archive product when reaching this state."
msgstr ""
"Selezonare se si vuole che il prodotto venga riattivato quando raggiunge "
"questo stato."

#. module: product_state_active
#: model:ir.model.fields,field_description:product_state_active.field_product_state__deactivate_product
msgid "Deactivate Product"
msgstr "Prodotto sospeso"

#. module: product_state_active
#: model:ir.model.fields,field_description:product_state_active.field_product_state__display_name
#: model:ir.model.fields,field_description:product_state_active.field_product_template__display_name
msgid "Display Name"
msgstr "Nome visualizzato"

#. module: product_state_active
#: model:ir.model.fields,field_description:product_state_active.field_product_state__id
#: model:ir.model.fields,field_description:product_state_active.field_product_template__id
msgid "ID"
msgstr "ID"

#. module: product_state_active
#: model:ir.model.fields,field_description:product_state_active.field_product_state____last_update
#: model:ir.model.fields,field_description:product_state_active.field_product_template____last_update
msgid "Last Modified on"
msgstr "Ultima modifica il"

#. module: product_state_active
#: model:ir.model,name:product_state_active.model_product_state
msgid "Product State"
msgstr "Stato prodotto"

#. module: product_state_active
#: model:ir.model,name:product_state_active.model_product_template
msgid "Product Template"
msgstr "Modello prodotto"

#. module: product_state_active
#: code:addons/product_state_active/models/product_state.py:0
#, python-format
msgid ""
"You cannot have both 'Deactivate Product' and 'Activate Product' options at "
"the same time!"
msgstr ""
"Non si possono avere le opzioni 'Podotto sospeso' e 'Prodotto attivato' "
"nello stesso momento!"
70 changes: 70 additions & 0 deletions product_state_active/i18n/product_state_active.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * product_state_active
#
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: product_state_active
#: model:ir.model.fields,field_description:product_state_active.field_product_state__activate_product
msgid "Activate Product"
msgstr ""

#. module: product_state_active
#: model:ir.model.fields,help:product_state_active.field_product_state__deactivate_product
msgid "Check this if you want to archive product when reaching this state."
msgstr ""

#. module: product_state_active
#: model:ir.model.fields,help:product_state_active.field_product_state__activate_product
msgid "Check this if you want to un-archive product when reaching this state."
msgstr ""

#. module: product_state_active
#: model:ir.model.fields,field_description:product_state_active.field_product_state__deactivate_product
msgid "Deactivate Product"
msgstr ""

#. module: product_state_active
#: model:ir.model.fields,field_description:product_state_active.field_product_state__display_name
#: model:ir.model.fields,field_description:product_state_active.field_product_template__display_name
msgid "Display Name"
msgstr ""

#. module: product_state_active
#: model:ir.model.fields,field_description:product_state_active.field_product_state__id
#: model:ir.model.fields,field_description:product_state_active.field_product_template__id
msgid "ID"
msgstr ""

#. module: product_state_active
#: model:ir.model.fields,field_description:product_state_active.field_product_state____last_update
#: model:ir.model.fields,field_description:product_state_active.field_product_template____last_update
msgid "Last Modified on"
msgstr ""

#. module: product_state_active
#: model:ir.model,name:product_state_active.model_product_state
msgid "Product State"
msgstr ""

#. module: product_state_active
#: model:ir.model,name:product_state_active.model_product_template
msgid "Product Template"
msgstr ""

#. module: product_state_active
#: code:addons/product_state_active/models/product_state.py:0
#, python-format
msgid ""
"You cannot have both 'Deactivate Product' and 'Activate Product' options at "
"the same time!"
msgstr ""
2 changes: 2 additions & 0 deletions product_state_active/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import product_state
from . import product_template
26 changes: 26 additions & 0 deletions product_state_active/models/product_state.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Copyright 2021 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

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


class ProductState(models.Model):
_inherit = "product.state"

deactivate_product = fields.Boolean(
help="Check this if you want to archive product when reaching this state."
)
activate_product = fields.Boolean(
help="Check this if you want to un-archive product when reaching this state."
)

@api.constrains("deactivate_product", "activate_product")
def _check_product_inactive_active(self):
if any(state.deactivate_product and state.activate_product for state in self):
raise ValidationError(
_(
"You cannot have both 'Deactivate Product' and "
"'Activate Product' options at the same time!"
)
)
Loading