From 42129027c5c0011917336eaf516210a633d299f4 Mon Sep 17 00:00:00 2001 From: Alfredo Date: Wed, 30 Oct 2024 09:22:41 +0100 Subject: [PATCH] [16.0][ADD] product_brand_active: In product brand new fields: "Active", "Start Date" and "End Date". --- product_brand_active/README.rst | 28 ++++++++ product_brand_active/__init__.py | 9 +++ product_brand_active/__manifest__.py | 18 +++++ product_brand_active/i18n/ca_ES.po | 71 +++++++++++++++++++ product_brand_active/i18n/en_GB.po | 71 +++++++++++++++++++ product_brand_active/i18n/es.po | 71 +++++++++++++++++++ product_brand_active/i18n/fr.po | 71 +++++++++++++++++++ .../i18n/product_brand_active.pot | 71 +++++++++++++++++++ product_brand_active/models/__init__.py | 1 + product_brand_active/models/product_brand.py | 15 ++++ .../views/product_brand_views.xml | 58 +++++++++++++++ .../odoo/addons/product_brand_active | 1 + setup/product_brand_active/setup.py | 6 ++ 13 files changed, 491 insertions(+) create mode 100644 product_brand_active/README.rst create mode 100644 product_brand_active/__init__.py create mode 100644 product_brand_active/__manifest__.py create mode 100644 product_brand_active/i18n/ca_ES.po create mode 100644 product_brand_active/i18n/en_GB.po create mode 100644 product_brand_active/i18n/es.po create mode 100644 product_brand_active/i18n/fr.po create mode 100644 product_brand_active/i18n/product_brand_active.pot create mode 100644 product_brand_active/models/__init__.py create mode 100644 product_brand_active/models/product_brand.py create mode 100644 product_brand_active/views/product_brand_views.xml create mode 120000 setup/product_brand_active/odoo/addons/product_brand_active create mode 100644 setup/product_brand_active/setup.py diff --git a/product_brand_active/README.rst b/product_brand_active/README.rst new file mode 100644 index 0000000000..f91f274990 --- /dev/null +++ b/product_brand_active/README.rst @@ -0,0 +1,28 @@ +.. image:: https://img.shields.io/badge/license-AGPL--3-blue.png + :target: https://www.gnu.org/licenses/agpl + :alt: License: AGPL-3 + +==================== +Product brand active +==================== + +* In product brand new fields: "Active", "Start Date" and "End Date". + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues +`_. In case of trouble, +please check there if your issue has already been reported. If you spotted +it first, help us smash it by providing detailed and welcomed feedback. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Contributors +------------ + +* Alfredo de la Fuente +* Ana Juaristi \ No newline at end of file diff --git a/product_brand_active/__init__.py b/product_brand_active/__init__.py new file mode 100644 index 0000000000..cc4b1cc64b --- /dev/null +++ b/product_brand_active/__init__.py @@ -0,0 +1,9 @@ +from . import models +from odoo import api, SUPERUSER_ID + + +def _post_install_active_product_brand(cr, registry): + env = api.Environment(cr, SUPERUSER_ID, {}) + brands = env["product.brand"].search([]) + if brands: + brands.write({"active": True}) \ No newline at end of file diff --git a/product_brand_active/__manifest__.py b/product_brand_active/__manifest__.py new file mode 100644 index 0000000000..1543c88188 --- /dev/null +++ b/product_brand_active/__manifest__.py @@ -0,0 +1,18 @@ +# Copyright 2024 Alfredo de la Fuente - AvanzOSC +# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html +{ + "name": "Product Brand Active", + "version": "16.0.1.0.0", + "category": "Sales/Sales", + "license": "AGPL-3", + "author": "AvanzOSC", + "website": "https://github.com/avanzosc/odoo-addons", + "depends": [ + "product_brand", + ], + "data": [ + "views/product_brand_views.xml", + ], + "installable": True, + "post_init_hook": "_post_install_active_product_brand", +} diff --git a/product_brand_active/i18n/ca_ES.po b/product_brand_active/i18n/ca_ES.po new file mode 100644 index 0000000000..1efbb941bc --- /dev/null +++ b/product_brand_active/i18n/ca_ES.po @@ -0,0 +1,71 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * product_brand_active +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-10-30 08:17+0000\n" +"PO-Revision-Date: 2024-10-30 08:17+0000\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_brand_active +#: model:ir.model.fields,field_description:product_brand_active.field_product_brand__active +#: model_terms:ir.ui.view,arch_db:product_brand_active.product_brand_search_form_view +msgid "Active" +msgstr "" + +#. module: product_brand_active +#. odoo-python +#: code:addons/product_brand_active/models/product_brand.py:0 +#: model:ir.model.fields.selection,name:product_brand_active.selection__product_brand__active_end_date_change__a +#, python-format +msgid "Change Active" +msgstr "" + +#. module: product_brand_active +#. odoo-python +#: code:addons/product_brand_active/models/product_brand.py:0 +#: model:ir.model.fields.selection,name:product_brand_active.selection__product_brand__active_end_date_change__d +#, python-format +msgid "Change End Date" +msgstr "" + +#. module: product_brand_active +#: model:ir.model.fields,field_description:product_brand_active.field_product_brand__end_date +msgid "End Date" +msgstr "" + +#. module: product_brand_active +#: model_terms:ir.ui.view,arch_db:product_brand_active.product_brand_search_form_view +msgid "Group By" +msgstr "" + +#. module: product_brand_active +#: model_terms:ir.ui.view,arch_db:product_brand_active.product_brand_search_form_view +msgid "Not Active" +msgstr "" + +#. module: product_brand_active +#. odoo-python +#: code:addons/product_brand_active/models/product_brand.py:0 +#: model:ir.model.fields.selection,name:product_brand_active.selection__product_brand__active_end_date_change__n +#, python-format +msgid "Nothing" +msgstr "" + +#. module: product_brand_active +#: model:ir.model,name:product_brand_active.model_product_brand +msgid "Product Brand" +msgstr "Marca de producte" + +#. module: product_brand_active +#: model:ir.model.fields,field_description:product_brand_active.field_product_brand__start_date +msgid "Start Date" +msgstr "" diff --git a/product_brand_active/i18n/en_GB.po b/product_brand_active/i18n/en_GB.po new file mode 100644 index 0000000000..2eee43bf44 --- /dev/null +++ b/product_brand_active/i18n/en_GB.po @@ -0,0 +1,71 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * product_brand_active +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-10-30 08:17+0000\n" +"PO-Revision-Date: 2024-10-30 08:17+0000\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_brand_active +#: model:ir.model.fields,field_description:product_brand_active.field_product_brand__active +#: model_terms:ir.ui.view,arch_db:product_brand_active.product_brand_search_form_view +msgid "Active" +msgstr "" + +#. module: product_brand_active +#. odoo-python +#: code:addons/product_brand_active/models/product_brand.py:0 +#: model:ir.model.fields.selection,name:product_brand_active.selection__product_brand__active_end_date_change__a +#, python-format +msgid "Change Active" +msgstr "" + +#. module: product_brand_active +#. odoo-python +#: code:addons/product_brand_active/models/product_brand.py:0 +#: model:ir.model.fields.selection,name:product_brand_active.selection__product_brand__active_end_date_change__d +#, python-format +msgid "Change End Date" +msgstr "" + +#. module: product_brand_active +#: model:ir.model.fields,field_description:product_brand_active.field_product_brand__end_date +msgid "End Date" +msgstr "" + +#. module: product_brand_active +#: model_terms:ir.ui.view,arch_db:product_brand_active.product_brand_search_form_view +msgid "Group By" +msgstr "" + +#. module: product_brand_active +#: model_terms:ir.ui.view,arch_db:product_brand_active.product_brand_search_form_view +msgid "Not Active" +msgstr "" + +#. module: product_brand_active +#. odoo-python +#: code:addons/product_brand_active/models/product_brand.py:0 +#: model:ir.model.fields.selection,name:product_brand_active.selection__product_brand__active_end_date_change__n +#, python-format +msgid "Nothing" +msgstr "" + +#. module: product_brand_active +#: model:ir.model,name:product_brand_active.model_product_brand +msgid "Product Brand" +msgstr "" + +#. module: product_brand_active +#: model:ir.model.fields,field_description:product_brand_active.field_product_brand__start_date +msgid "Start Date" +msgstr "" diff --git a/product_brand_active/i18n/es.po b/product_brand_active/i18n/es.po new file mode 100644 index 0000000000..11d757dc5c --- /dev/null +++ b/product_brand_active/i18n/es.po @@ -0,0 +1,71 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * product_brand_active +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-10-30 08:18+0000\n" +"PO-Revision-Date: 2024-10-30 08:18+0000\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_brand_active +#: model:ir.model.fields,field_description:product_brand_active.field_product_brand__active +#: model_terms:ir.ui.view,arch_db:product_brand_active.product_brand_search_form_view +msgid "Active" +msgstr "Activa" + +#. module: product_brand_active +#. odoo-python +#: code:addons/product_brand_active/models/product_brand.py:0 +#: model:ir.model.fields.selection,name:product_brand_active.selection__product_brand__active_end_date_change__a +#, python-format +msgid "Change Active" +msgstr "Cambio activa" + +#. module: product_brand_active +#. odoo-python +#: code:addons/product_brand_active/models/product_brand.py:0 +#: model:ir.model.fields.selection,name:product_brand_active.selection__product_brand__active_end_date_change__d +#, python-format +msgid "Change End Date" +msgstr "Cambio fecha fin" + +#. module: product_brand_active +#: model:ir.model.fields,field_description:product_brand_active.field_product_brand__end_date +msgid "End Date" +msgstr "Fecha fin" + +#. module: product_brand_active +#: model_terms:ir.ui.view,arch_db:product_brand_active.product_brand_search_form_view +msgid "Group By" +msgstr "Agrupar por" + +#. module: product_brand_active +#: model_terms:ir.ui.view,arch_db:product_brand_active.product_brand_search_form_view +msgid "Not Active" +msgstr "No Activa" + +#. module: product_brand_active +#. odoo-python +#: code:addons/product_brand_active/models/product_brand.py:0 +#: model:ir.model.fields.selection,name:product_brand_active.selection__product_brand__active_end_date_change__n +#, python-format +msgid "Nothing" +msgstr "Nada" + +#. module: product_brand_active +#: model:ir.model,name:product_brand_active.model_product_brand +msgid "Product Brand" +msgstr "Marca de producto" + +#. module: product_brand_active +#: model:ir.model.fields,field_description:product_brand_active.field_product_brand__start_date +msgid "Start Date" +msgstr "Fecha inicio" diff --git a/product_brand_active/i18n/fr.po b/product_brand_active/i18n/fr.po new file mode 100644 index 0000000000..7b46c2af7a --- /dev/null +++ b/product_brand_active/i18n/fr.po @@ -0,0 +1,71 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * product_brand_active +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-10-30 08:18+0000\n" +"PO-Revision-Date: 2024-10-30 08:18+0000\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_brand_active +#: model:ir.model.fields,field_description:product_brand_active.field_product_brand__active +#: model_terms:ir.ui.view,arch_db:product_brand_active.product_brand_search_form_view +msgid "Active" +msgstr "" + +#. module: product_brand_active +#. odoo-python +#: code:addons/product_brand_active/models/product_brand.py:0 +#: model:ir.model.fields.selection,name:product_brand_active.selection__product_brand__active_end_date_change__a +#, python-format +msgid "Change Active" +msgstr "" + +#. module: product_brand_active +#. odoo-python +#: code:addons/product_brand_active/models/product_brand.py:0 +#: model:ir.model.fields.selection,name:product_brand_active.selection__product_brand__active_end_date_change__d +#, python-format +msgid "Change End Date" +msgstr "" + +#. module: product_brand_active +#: model:ir.model.fields,field_description:product_brand_active.field_product_brand__end_date +msgid "End Date" +msgstr "" + +#. module: product_brand_active +#: model_terms:ir.ui.view,arch_db:product_brand_active.product_brand_search_form_view +msgid "Group By" +msgstr "" + +#. module: product_brand_active +#: model_terms:ir.ui.view,arch_db:product_brand_active.product_brand_search_form_view +msgid "Not Active" +msgstr "" + +#. module: product_brand_active +#. odoo-python +#: code:addons/product_brand_active/models/product_brand.py:0 +#: model:ir.model.fields.selection,name:product_brand_active.selection__product_brand__active_end_date_change__n +#, python-format +msgid "Nothing" +msgstr "" + +#. module: product_brand_active +#: model:ir.model,name:product_brand_active.model_product_brand +msgid "Product Brand" +msgstr "Marque d'article" + +#. module: product_brand_active +#: model:ir.model.fields,field_description:product_brand_active.field_product_brand__start_date +msgid "Start Date" +msgstr "" diff --git a/product_brand_active/i18n/product_brand_active.pot b/product_brand_active/i18n/product_brand_active.pot new file mode 100644 index 0000000000..2eee43bf44 --- /dev/null +++ b/product_brand_active/i18n/product_brand_active.pot @@ -0,0 +1,71 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * product_brand_active +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-10-30 08:17+0000\n" +"PO-Revision-Date: 2024-10-30 08:17+0000\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_brand_active +#: model:ir.model.fields,field_description:product_brand_active.field_product_brand__active +#: model_terms:ir.ui.view,arch_db:product_brand_active.product_brand_search_form_view +msgid "Active" +msgstr "" + +#. module: product_brand_active +#. odoo-python +#: code:addons/product_brand_active/models/product_brand.py:0 +#: model:ir.model.fields.selection,name:product_brand_active.selection__product_brand__active_end_date_change__a +#, python-format +msgid "Change Active" +msgstr "" + +#. module: product_brand_active +#. odoo-python +#: code:addons/product_brand_active/models/product_brand.py:0 +#: model:ir.model.fields.selection,name:product_brand_active.selection__product_brand__active_end_date_change__d +#, python-format +msgid "Change End Date" +msgstr "" + +#. module: product_brand_active +#: model:ir.model.fields,field_description:product_brand_active.field_product_brand__end_date +msgid "End Date" +msgstr "" + +#. module: product_brand_active +#: model_terms:ir.ui.view,arch_db:product_brand_active.product_brand_search_form_view +msgid "Group By" +msgstr "" + +#. module: product_brand_active +#: model_terms:ir.ui.view,arch_db:product_brand_active.product_brand_search_form_view +msgid "Not Active" +msgstr "" + +#. module: product_brand_active +#. odoo-python +#: code:addons/product_brand_active/models/product_brand.py:0 +#: model:ir.model.fields.selection,name:product_brand_active.selection__product_brand__active_end_date_change__n +#, python-format +msgid "Nothing" +msgstr "" + +#. module: product_brand_active +#: model:ir.model,name:product_brand_active.model_product_brand +msgid "Product Brand" +msgstr "" + +#. module: product_brand_active +#: model:ir.model.fields,field_description:product_brand_active.field_product_brand__start_date +msgid "Start Date" +msgstr "" diff --git a/product_brand_active/models/__init__.py b/product_brand_active/models/__init__.py new file mode 100644 index 0000000000..6cb55ac7f7 --- /dev/null +++ b/product_brand_active/models/__init__.py @@ -0,0 +1 @@ +from . import product_brand diff --git a/product_brand_active/models/product_brand.py b/product_brand_active/models/product_brand.py new file mode 100644 index 0000000000..671a0cb76d --- /dev/null +++ b/product_brand_active/models/product_brand.py @@ -0,0 +1,15 @@ +# Copyright 2024 Alfredo de la Fuente - AvanzOSC +# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html +from odoo import _, api, fields, models + + +class ProductBrand(models.Model): + _inherit = "product.brand" + + active = fields.Boolean(default=True, copy=False) + start_date = fields.Date(copy=False) + end_date = fields.Date(copy=False) + + @api.onchange("active") + def onchange_active(self): + self.end_date = False if self.active else fields.Date.context_today(self) diff --git a/product_brand_active/views/product_brand_views.xml b/product_brand_active/views/product_brand_views.xml new file mode 100644 index 0000000000..0299db3f7c --- /dev/null +++ b/product_brand_active/views/product_brand_views.xml @@ -0,0 +1,58 @@ + + + product.brand + + + + + + + + + + + + + + + + + + + + product.brand + + + + + + + + + + + + product.brand + + + + + + + + + + + + + + + + + + Brand + product.brand + kanban,form,tree + [('active', 'in', (True, False))] + + diff --git a/setup/product_brand_active/odoo/addons/product_brand_active b/setup/product_brand_active/odoo/addons/product_brand_active new file mode 120000 index 0000000000..b4f32d884e --- /dev/null +++ b/setup/product_brand_active/odoo/addons/product_brand_active @@ -0,0 +1 @@ +../../../../product_brand_active \ No newline at end of file diff --git a/setup/product_brand_active/setup.py b/setup/product_brand_active/setup.py new file mode 100644 index 0000000000..28c57bb640 --- /dev/null +++ b/setup/product_brand_active/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)