Skip to content

Commit

Permalink
Merge d3c918c into 9fe57f3
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinkhao committed Jan 7, 2020
2 parents 9fe57f3 + d3c918c commit 8ba34ff
Show file tree
Hide file tree
Showing 24 changed files with 480 additions and 0 deletions.
92 changes: 92 additions & 0 deletions product_variant_inactive/README.rst
@@ -0,0 +1,92 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3

========================
Product Variant Inactive
========================

This module extend the functionality of Product Variants
and allow you to make activate or deactivate products using the two buttons


Usage
=====

To use this module, you need to Product menu (Product Template)

On Variant tab, click on the button 'List of variants'

You can now activate or deactivate variants with button on the right side


.. image:: /product_variant_inactive/static/description/pvi-2.png
:alt: Create a sales template
:width: 600 px


.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/135/8.0


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

Additional features:
* Desactivation of many product with 'more menu' action
* Add a group to inactive / active variants


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 smashing it by providing a detailed and welcomed `feedback
<https://github.com/OCA/product-attribute/issues/new?body=module:%20product_variant_inactive%0Aversion:%208.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Credits
=======

This module was written to extend the functionality of Product Variants
and allow you to make activate or deactivate products using the two buttons

.. image:: /product_variant_inactive/static/img/pvi_1.png
:alt: screenshot
:width: 600 px


Installation
============

To install this module, you need to:

* To install Product module

For further information, please visit:

* https://www.odoo.com/forum/help-1

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

* Sebastien BEAU <sebastien.beau@akretion.com>
* Abdessamad HILALI <abdessamad.hilali@akretion.com>
* Kevin Khao <kevin.khao@akretion.com>

Maintainer
----------

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

This module is maintained by the OCA.

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.

To contribute to this module, please visit http://odoo-community.org.
4 changes: 4 additions & 0 deletions product_variant_inactive/__init__.py
@@ -0,0 +1,4 @@
# 2015 Abdessamad HILALI <abdessamad.hilali@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from . import models
17 changes: 17 additions & 0 deletions product_variant_inactive/__manifest__.py
@@ -0,0 +1,17 @@
# 2015 Abdessamad HILALI <abdessamad.hilali@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

{
"name": "Product Variant Inactive",
"author": "Akretion,Odoo Community Association (OCA)",
"website": "http://www.akretion.com",
"license": "AGPL-3",
"category": "Product",
"version": "12.0.1.0.0",
"depends": ["stock"],
"data": [
"views/product_template_view.xml",
"views/product_variant_view.xml",
],
"demo": ["data/product.product.csv"],
}
2 changes: 2 additions & 0 deletions product_variant_inactive/data/product.product.csv
@@ -0,0 +1,2 @@
id,active
product.product_product_4,0
24 changes: 24 additions & 0 deletions product_variant_inactive/i18n/ca.po
@@ -0,0 +1,24 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * product_variant_inactive
#
# Translators:
# OCA Transbot <transbot@odoo-community.org>, 2018
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-01-03 02:14+0000\n"
"PO-Revision-Date: 2018-01-03 02:14+0000\n"
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2018\n"
"Language-Team: Catalan (https://www.transifex.com/oca/teams/23907/ca/)\n"
"Language: ca\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"

#. module: product_variant_inactive
#: model:ir.model,name:product_variant_inactive.model_product_product
msgid "Product"
msgstr "Producte"
24 changes: 24 additions & 0 deletions product_variant_inactive/i18n/de.po
@@ -0,0 +1,24 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * product_variant_inactive
#
# Translators:
# OCA Transbot <transbot@odoo-community.org>, 2018
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-01-03 02:14+0000\n"
"PO-Revision-Date: 2018-01-03 02:14+0000\n"
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2018\n"
"Language-Team: German (https://www.transifex.com/oca/teams/23907/de/)\n"
"Language: de\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"

#. module: product_variant_inactive
#: model:ir.model,name:product_variant_inactive.model_product_product
msgid "Product"
msgstr "Produkt"
24 changes: 24 additions & 0 deletions product_variant_inactive/i18n/es.po
@@ -0,0 +1,24 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * product_variant_inactive
#
# Translators:
# OCA Transbot <transbot@odoo-community.org>, 2018
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-01-03 02:14+0000\n"
"PO-Revision-Date: 2018-01-03 02:14+0000\n"
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2018\n"
"Language-Team: Spanish (https://www.transifex.com/oca/teams/23907/es/)\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"

#. module: product_variant_inactive
#: model:ir.model,name:product_variant_inactive.model_product_product
msgid "Product"
msgstr "Producto"
24 changes: 24 additions & 0 deletions product_variant_inactive/i18n/fr.po
@@ -0,0 +1,24 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * product_variant_inactive
#
# Translators:
# OCA Transbot <transbot@odoo-community.org>, 2018
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-01-03 02:14+0000\n"
"PO-Revision-Date: 2018-01-03 02:14+0000\n"
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2018\n"
"Language-Team: French (https://www.transifex.com/oca/teams/23907/fr/)\n"
"Language: fr\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"

#. module: product_variant_inactive
#: model:ir.model,name:product_variant_inactive.model_product_product
msgid "Product"
msgstr "Article"
25 changes: 25 additions & 0 deletions product_variant_inactive/i18n/hr.po
@@ -0,0 +1,25 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * product_variant_inactive
#
# Translators:
# Bole <bole@dajmi5.com>, 2018
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-01-03 02:14+0000\n"
"PO-Revision-Date: 2018-01-03 02:14+0000\n"
"Last-Translator: Bole <bole@dajmi5.com>, 2018\n"
"Language-Team: Croatian (https://www.transifex.com/oca/teams/23907/hr/)\n"
"Language: hr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"

#. module: product_variant_inactive
#: model:ir.model,name:product_variant_inactive.model_product_product
msgid "Product"
msgstr "Proizvod"
24 changes: 24 additions & 0 deletions product_variant_inactive/i18n/it.po
@@ -0,0 +1,24 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * product_variant_inactive
#
# Translators:
# Paolo Valier <paolo.valier@hotmail.it>, 2018
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-01-03 02:14+0000\n"
"PO-Revision-Date: 2018-01-03 02:14+0000\n"
"Last-Translator: Paolo Valier <paolo.valier@hotmail.it>, 2018\n"
"Language-Team: Italian (https://www.transifex.com/oca/teams/23907/it/)\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"

#. module: product_variant_inactive
#: model:ir.model,name:product_variant_inactive.model_product_product
msgid "Product"
msgstr "Prodotto"
20 changes: 20 additions & 0 deletions product_variant_inactive/i18n/product_variant_inactive.pot
@@ -0,0 +1,20 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * product_variant_inactive
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.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_variant_inactive
#: model:ir.model,name:product_variant_inactive.model_product_product
msgid "Product"
msgstr ""

25 changes: 25 additions & 0 deletions product_variant_inactive/i18n/sl.po
@@ -0,0 +1,25 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * product_variant_inactive
#
# Translators:
# OCA Transbot <transbot@odoo-community.org>, 2018
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-01-27 03:49+0000\n"
"PO-Revision-Date: 2018-01-27 03:49+0000\n"
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2018\n"
"Language-Team: Slovenian (https://www.transifex.com/oca/teams/23907/sl/)\n"
"Language: sl\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n"
"%100==4 ? 2 : 3);\n"

#. module: product_variant_inactive
#: model:ir.model,name:product_variant_inactive.model_product_product
msgid "Product"
msgstr "Proizvod"
5 changes: 5 additions & 0 deletions product_variant_inactive/models/__init__.py
@@ -0,0 +1,5 @@
# 2015 Abdessamad HILALI <abdessamad.hilali@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from . import product_template
from . import product_variant
20 changes: 20 additions & 0 deletions product_variant_inactive/models/product_template.py
@@ -0,0 +1,20 @@
# © 2015 Abdessamad HILALI <abdessamad.hilali@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from odoo import models, fields


class ProductTemplate(models.Model):
_inherit = "product.template"

def _compute_product_variant_count_all(self):
for rec in self:
rec.product_variant_count_all = (
self.with_context(active_test=False)
.env["product.product"]
.search_count([("product_tmpl_id", "=", rec.id)])
)

product_variant_count_all = fields.Integer(
"Inactive variants", compute=_compute_product_variant_count_all
)
40 changes: 40 additions & 0 deletions product_variant_inactive/models/product_variant.py
@@ -0,0 +1,40 @@
# © 2015 Abdessamad HILALI <abdessamad.hilali@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from odoo import models, api
from lxml import etree
from odoo.osv import orm


class ProductProduct(models.Model):
_inherit = "product.product"

@api.multi
def button_activate(self):
for product in self:
product.active = True

@api.multi
def button_deactivate(self):
for product in self:
product.active = False

@api.model
def fields_view_get(
self, view_id=None, view_type="tree", toolbar=False, submenu=False
):
""" Dynamic modification of fields """
res = super(ProductProduct, self).fields_view_get(
view_id=view_id,
view_type=view_type,
toolbar=toolbar,
submenu=submenu,
)
root = etree.fromstring(res["arch"])
if view_type == "tree":
for button in root.findall(".//button"):
if "search_disable_custom_filters" in self.env.context:
button.set("invisible", "0")
orm.setup_modifiers(button, root)
res["arch"] = etree.tostring(root, pretty_print=True)
return res
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added product_variant_inactive/static/img/img.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added product_variant_inactive/static/img/pvi_1.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions product_variant_inactive/tests/__init__.py
@@ -0,0 +1 @@
from . import test_button

0 comments on commit 8ba34ff

Please sign in to comment.