Skip to content

Commit

Permalink
[ADD] product_attribute_archive
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinkhao authored and Rferri44-S73 committed Mar 13, 2023
1 parent 2acf603 commit 6ffa1a0
Show file tree
Hide file tree
Showing 11 changed files with 90 additions and 0 deletions.
1 change: 1 addition & 0 deletions product_attribute_archive/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
todo
1 change: 1 addition & 0 deletions product_attribute_archive/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
16 changes: 16 additions & 0 deletions product_attribute_archive/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright 2021 Akretion
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
"name": "Product Attribute Archive",
"summary": """
Add an active field on product attributes""",
"version": "14.0.1.0.0",
"license": "AGPL-3",
"author": "Akretion,Odoo Community Association (OCA)",
"depends": ["product"],
"data": [
"views/product_attribute.xml",
],
"website": "https://github.com/OCA/product-attribute",
}
2 changes: 2 additions & 0 deletions product_attribute_archive/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import product_attribute
from . import product_attribute_value
10 changes: 10 additions & 0 deletions product_attribute_archive/models/product_attribute.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Copyright 2021 Akretion
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import fields, models


class ProductAttribute(models.Model):
_inherit = "product.attribute"

active = fields.Boolean(default=True)
10 changes: 10 additions & 0 deletions product_attribute_archive/models/product_attribute_value.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Copyright 2021 Akretion
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import fields, models


class ProductAttributeValue(models.Model):
_inherit = "product.attribute.value"

active = fields.Boolean(default=True)
1 change: 1 addition & 0 deletions product_attribute_archive/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Kevin Khao <[email protected]>
1 change: 1 addition & 0 deletions product_attribute_archive/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This module allows archival of product attributes and product attribute values.
7 changes: 7 additions & 0 deletions product_attribute_archive/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Simply use the archive action on any product attribute.

The attribute is then no longer usable on new products.

Identical functionality on product attribute values.

Existing variants are unaffected, only new ones.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
41 changes: 41 additions & 0 deletions product_attribute_archive/views/product_attribute.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2021 Akretion
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<odoo>

<record model="ir.ui.view" id="product_attribute_form_view">
<field name="name">product.attribute.form</field>
<field name="model">product.attribute</field>
<field name="inherit_id" ref="product.product_attribute_view_form" />
<field name="arch" type="xml">
<xpath expr="//group[@name='main_fields']" position="before">
<field name="active" invisible="1" />
<widget
name="web_ribbon"
title="Archived"
bg_color="bg-danger"
attrs="{'invisible': [('active', '=', True)]}"
/>
</xpath>
<field name="html_color" position="after">
<field name="active" optional="hide" />
</field>
</field>
</record>

<record id="product_attribute_tree_view" model="ir.ui.view">
<field name="name">product.attribute.tree</field>
<field name="model">product.attribute</field>
<field name="inherit_id" ref="product.attribute_tree_view" />
<field name="arch" type="xml">
<field name="create_variant" position="after">
<field name="active" />
</field>
</field>
</record>

<record model="ir.actions.act_window" id="product.attribute_action">
<field name="context">{'active_test': False}</field>
</record>

</odoo>

0 comments on commit 6ffa1a0

Please sign in to comment.