Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
711904d
[ADD] add new features to manage completion rate and completion state…
Jun 10, 2020
b2355d0
[UPD] README.rst
Jun 18, 2020
ca5f2b3
attribute_set_completeness 12.0.1.0.1
Jun 18, 2020
06d7bfd
[10.0][FIX] attribute_set_completeness: Fix one2many
rousseldenis Jun 26, 2020
86d95b5
[10.0][FIX] attribute_set_completeness: Percentage with 100.0
rousseldenis Jun 26, 2020
d9f732d
[10.0][FIX] attribute_set_completeness: Add not completed fields
rousseldenis Jun 26, 2020
f791e52
[10.0][IMP] pre-commit updates
rousseldenis Jun 29, 2020
8504723
[10.0][FIX] attribute_set_completeness: fix search method
Jun 29, 2020
09a11cf
attribute_set_completeness 12.0.1.1.0
Oct 2, 2020
a0eddea
attribute_set_completeness 12.0.1.1.1
Oct 2, 2020
2dcdfa9
[FIX] attribute_set_completeness: speed up completion fields
Jul 7, 2020
dcfb48e
attribute_set_completeness: tests use SavepointComponentCase
simahawk Oct 2, 2020
0336b9a
attribute_set_completeness 12.0.1.2.0
Oct 5, 2020
1cbfb86
[IMP] product_attribute_set_completeness UI
clementmbr Oct 16, 2020
29b634d
[IMP] more accurate domain in attribute_set_completeness's field_ids
clementmbr Oct 16, 2020
7b85889
[IMP] no_create:True on completeness field_id
clementmbr Oct 17, 2020
b896577
attribute_set_completeness 12.0.1.2.1
Oct 20, 2020
65a0c23
[IMP] attribute_set_completeness: black, isort, prettier
xavier-bouquiaux Apr 15, 2021
7b898b3
[14.0][MIG] attribute_set_completeness
xavier-bouquiaux Apr 15, 2021
b061219
[14.0][IMP] attribute_set_completeness: Avoid duplicated strings
rousseldenis Apr 27, 2021
3694cf2
[UPD] Update attribute_set_completeness.pot
Oct 6, 2021
8c7359c
[UPD] README.rst
OCA-git-bot Oct 6, 2021
419bbad
[ADD] icon.png
OCA-git-bot Oct 6, 2021
4a84430
attribute_set_completeness 14.0.1.0.1
OCA-git-bot Oct 6, 2021
29c74cd
[14.0][FIX] attribute_set_completeness
xavier-bouquiaux Jan 27, 2022
d022ecb
[14.0] attribute_set_completeness: store completion state and rate fo…
Feb 1, 2022
0d8c208
attribute_set_completeness 14.0.2.0.0
OCA-git-bot Oct 17, 2022
8eac106
[IMP] attribute_set_completeness: pre-commit stuff
dsolanki-initos Jul 17, 2023
422ea70
[MIG] attribute_set_completeness: Migration to 16.0
dsolanki-initos Jul 17, 2023
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
86 changes: 86 additions & 0 deletions attribute_set_completeness/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
==========================
Attribute Set Completeness
==========================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |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%2Fodoo--pim-lightgray.png?logo=github
:target: https://github.com/OCA/odoo-pim/tree/14.0/attribute_set_completeness
:alt: OCA/odoo-pim
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/odoo-pim-14-0/odoo-pim-14-0-attribute_set_completeness
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/295/14.0
:alt: Try me on Runbot

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

This module allows the user define a completion rate on the model linked to an attribute set.

**Table of contents**

.. contents::
:local:

Usage
=====

Go on an attribute set and fill in the section 'Completeness'.
Select the fields you want to take in account and set them their proportion on the completeness rate.
Then on the model linked to the attribute set you'll get 2 fields: completion rate and completion state

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/odoo-pim/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/odoo-pim/issues/new?body=module:%20attribute_set_completeness%0Aversion:%2014.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
~~~~~~~~~~~~

* Cédric PIGEON <[email protected]>
* Xavier Bouquiaux <[email protected]>
* `Camptocamp <https://www.camptocamp.com>`_

* Iván Todorovich <[email protected]>

* Dhara Solanki <[email protected]>

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/odoo-pim <https://github.com/OCA/odoo-pim/tree/14.0/attribute_set_completeness>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 2 additions & 0 deletions attribute_set_completeness/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import components
from . import models
17 changes: 17 additions & 0 deletions attribute_set_completeness/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright 2020 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
"name": "Attribute Set Completeness",
"version": "16.0.1.0.0",
"license": "AGPL-3",
"author": "ACSONE SA/NV, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/odoo-pim",
"depends": ["attribute_set", "component_event"],
"data": [
"views/attribute_set.xml",
"security/attribute_set_completeness.xml",
"views/attribute_set_completeness.xml",
],
"demo": [],
}
3 changes: 3 additions & 0 deletions attribute_set_completeness/components/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Copyright 2020 ACSONE SA/NV (<http://acsone.eu>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import attribute_set_owner_event_listener
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Copyright 2020 ACSONE SA/NV (<http://acsone.eu>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo.addons.component.core import AbstractComponent
from odoo.addons.component_event import skip_if


class AttributeSetOwnerEventListener(AbstractComponent):
_name = "attribute.set.owner.event.listener"
_inherit = "base.event.listener"

def _get_skip_if_condition_fields(self, record):
"""Return the field names that trigger the condition"""
attribute_set = record.attribute_set_id
attribute_set_completeness = attribute_set.attribute_set_completeness_ids
field_names = attribute_set_completeness.mapped("field_id.name")
field_names.append("attribute_set_id")
return field_names

def _get_skip_if_condition(self, record, **kwargs):
if not record.attribute_set_id:
return True

Check warning on line 22 in attribute_set_completeness/components/attribute_set_owner_event_listener.py

View check run for this annotation

Codecov / codecov/patch

attribute_set_completeness/components/attribute_set_owner_event_listener.py#L22

Added line #L22 was not covered by tests
if set(self._get_skip_if_condition_fields(record)) & set(kwargs["fields"]):
return False
return True

@skip_if(
lambda self, record, **kwargs: self._get_skip_if_condition(record, **kwargs)
)
def on_record_write(self, record, fields=None):
record._compute_attribute_set_completed_ids()
168 changes: 168 additions & 0 deletions attribute_set_completeness/i18n/attribute_set_completeness.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * attribute_set_completeness
#
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: attribute_set_completeness
#: model:ir.model,name:attribute_set_completeness.model_attribute_set
#: model:ir.model.fields,field_description:attribute_set_completeness.field_attribute_set_completeness__attribute_set_id
msgid "Attribute Set"
msgstr ""

#. module: attribute_set_completeness
#: model:ir.model,name:attribute_set_completeness.model_attribute_set_completeness
msgid "Attribute Set Completeness"
msgstr ""

#. module: attribute_set_completeness
#: model:ir.model.fields,field_description:attribute_set_completeness.field_attribute_set_owner_mixin__attribute_set_completion_rate
msgid "Attribute Set Completion Rate"
msgstr ""

#. module: attribute_set_completeness
#: model:ir.model.fields,field_description:attribute_set_completeness.field_attribute_set_owner_mixin__attribute_set_completion_state
msgid "Attribute Set Completion State"
msgstr ""

#. module: attribute_set_completeness
#: model:ir.model.fields,field_description:attribute_set_completeness.field_attribute_set_owner_mixin__attribute_set_completed_ids
msgid "Attribute Set completed criterias"
msgstr ""

#. module: attribute_set_completeness
#: model:ir.model.fields,field_description:attribute_set_completeness.field_attribute_set_owner_mixin__attribute_set_not_completed_ids
msgid "Attribute Set not completed criterias"
msgstr ""

#. module: attribute_set_completeness
#: model:ir.model.fields,field_description:attribute_set_completeness.field_attribute_set_completeness__available_field_ids
msgid "Attribute Set's fields"
msgstr ""

#. module: attribute_set_completeness
#: model:ir.model.fields,help:attribute_set_completeness.field_attribute_set_owner_mixin__attribute_set_completion_rate
msgid "Attribute set completeness percentage"
msgstr ""

#. module: attribute_set_completeness
#: model:ir.model.fields,help:attribute_set_completeness.field_attribute_set_owner_mixin__attribute_set_completion_state
msgid "Attribute set completeness status"
msgstr ""

#. module: attribute_set_completeness
#: model:ir.model,name:attribute_set_completeness.model_attribute_set_owner_mixin
msgid "Attribute set owner mixin"
msgstr ""

#. module: attribute_set_completeness
#: model:ir.model.fields.selection,name:attribute_set_completeness.selection__attribute_set_owner_mixin__attribute_set_completion_state__complete
msgid "Complete"
msgstr ""

#. module: attribute_set_completeness
#: model_terms:ir.ui.view,arch_db:attribute_set_completeness.attribute_set_form_view
msgid "Completeness"
msgstr ""

#. module: attribute_set_completeness
#: model:ir.model.fields,field_description:attribute_set_completeness.field_attribute_set__attribute_set_completeness_ids
#: model:ir.model.fields,field_description:attribute_set_completeness.field_attribute_set_owner_mixin__attribute_set_completeness_ids
msgid "Completeness Requirements"
msgstr ""

#. module: attribute_set_completeness
#: model:ir.model.fields,field_description:attribute_set_completeness.field_attribute_set_completeness__completion_rate
msgid "Completion Rate"
msgstr ""

#. module: attribute_set_completeness
#: model:ir.model.fields,field_description:attribute_set_completeness.field_attribute_set_completeness__completion_rate_progress
msgid "Completion Rate Progress"
msgstr ""

#. module: attribute_set_completeness
#: model:ir.model.fields,field_description:attribute_set_completeness.field_attribute_set_completeness__create_uid
msgid "Created by"
msgstr ""

#. module: attribute_set_completeness
#: model:ir.model.fields,field_description:attribute_set_completeness.field_attribute_set_completeness__create_date
msgid "Created on"
msgstr ""

#. module: attribute_set_completeness
#: model:ir.model.fields,field_description:attribute_set_completeness.field_attribute_set__display_name
#: model:ir.model.fields,field_description:attribute_set_completeness.field_attribute_set_completeness__display_name
#: model:ir.model.fields,field_description:attribute_set_completeness.field_attribute_set_owner_mixin__display_name
msgid "Display Name"
msgstr ""

#. module: attribute_set_completeness
#: model:ir.model.fields,field_description:attribute_set_completeness.field_attribute_set_completeness__field_description
msgid "Field Description"
msgstr ""

#. module: attribute_set_completeness
#: model:ir.model.fields,field_description:attribute_set_completeness.field_attribute_set_completeness__field_id
msgid "Field Name"
msgstr ""

#. module: attribute_set_completeness
#: model:ir.model.fields,help:attribute_set_completeness.field_attribute_set_completeness__available_field_ids
msgid "Fields related to the Attribute set's attributes"
msgstr ""

#. module: attribute_set_completeness
#: model:ir.model.fields,field_description:attribute_set_completeness.field_attribute_set__id
#: model:ir.model.fields,field_description:attribute_set_completeness.field_attribute_set_completeness__id
#: model:ir.model.fields,field_description:attribute_set_completeness.field_attribute_set_owner_mixin__id
msgid "ID"
msgstr ""

#. module: attribute_set_completeness
#: model:ir.model.fields,field_description:attribute_set_completeness.field_attribute_set____last_update
#: model:ir.model.fields,field_description:attribute_set_completeness.field_attribute_set_completeness____last_update
#: model:ir.model.fields,field_description:attribute_set_completeness.field_attribute_set_owner_mixin____last_update
msgid "Last Modified on"
msgstr ""

#. module: attribute_set_completeness
#: model:ir.model.fields,field_description:attribute_set_completeness.field_attribute_set_completeness__write_uid
msgid "Last Updated by"
msgstr ""

#. module: attribute_set_completeness
#: model:ir.model.fields,field_description:attribute_set_completeness.field_attribute_set_completeness__write_date
msgid "Last Updated on"
msgstr ""

#. module: attribute_set_completeness
#: model:ir.model.fields,field_description:attribute_set_completeness.field_attribute_set_completeness__model_id
msgid "Model"
msgstr ""

#. module: attribute_set_completeness
#: model:ir.model.fields.selection,name:attribute_set_completeness.selection__attribute_set_owner_mixin__attribute_set_completion_state__not_complete
msgid "Not complete"
msgstr ""

#. module: attribute_set_completeness
#: model_terms:ir.ui.view,arch_db:attribute_set_completeness.attribute_set_completeness_tree_view
msgid "Total"
msgstr ""

#. module: attribute_set_completeness
#: code:addons/attribute_set_completeness/models/attribute_set.py:0
#, python-format
msgid "Total of completion rate must be 100 %"
msgstr ""
27 changes: 27 additions & 0 deletions attribute_set_completeness/migrations/14.0.1.0.1/pre-migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Copyright 2022 Acsone SA
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this must be trashed

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is still to be trashed

# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

# when migrating to v14, 2 fields have been renamed
# completion_rate -> attribute_set_completion_rate
# completion_state -> attribute_set_completion_state
from openupgradelib import openupgrade

field_renames = [
(
"attribute.set.owner.mixin",
"attribute.set.owner.mixin",
"completion_rate",
"attribute_set_completion_rate",
),
(
"attribute.set.owner.mixin",
"attribute.set.owner.mixin",
"completion_state",
"attribute_set_completion_state",
),
]


@openupgrade.migrate()
def migrate(env, version):
openupgrade.rename_fields(env, field_renames)
3 changes: 3 additions & 0 deletions attribute_set_completeness/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from . import attribute_set_completeness
from . import attribute_set
from . import attribute_set_owner_mixin
25 changes: 25 additions & 0 deletions attribute_set_completeness/models/attribute_set.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright 2020 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 AttributeSet(models.Model):
_inherit = "attribute.set"

attribute_set_completeness_ids = fields.One2many(
comodel_name="attribute.set.completeness",
inverse_name="attribute_set_id",
string="Completeness Requirements",
auto_join=True,
)

@api.constrains("attribute_set_completeness_ids")
def _check_attribute_set_completeness_ids(self):
for attr_set in self:
completion_config = attr_set.attribute_set_completeness_ids
if completion_config:
total = sum([rule.completion_rate for rule in completion_config])
if total != 100.0:
raise ValidationError(_("Total of completion rate must be 100 %"))
Loading