diff --git a/sale_tier_validation/README.rst b/sale_tier_validation/README.rst index 612adc6b9ec..13d2815ff5b 100644 --- a/sale_tier_validation/README.rst +++ b/sale_tier_validation/README.rst @@ -1,14 +1,38 @@ -.. image:: https://img.shields.io/badge/license-AGPL--3-blue.png - :target: https://www.gnu.org/licenses/agpl - :alt: License: AGPL-3 - ==================== Sale Tier Validation ==================== +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! 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%2Fsale--workflow-lightgray.png?logo=github + :target: https://github.com/OCA/sale-workflow/tree/13.0/sale_tier_validation + :alt: OCA/sale-workflow +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/sale-workflow-13-0/sale-workflow-13-0-sale_tier_validation + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/167/13.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + This module extends the functionality of Sale Orders to support a tier validation process. +**Table of contents** + +.. contents:: + :local: + Installation ============ @@ -41,44 +65,46 @@ Additional features: be generated) can directly do the operation, this is, there is no need for her/him to request a validation. -.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas - :alt: Try me on Runbot - :target: https://runbot.odoo-community.org/runbot/142/12.0 - 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. +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 smashing it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. Credits ======= -Images ------- +Authors +~~~~~~~ -* Odoo Community Association: `Icon `_. +* Open Source Integrators Contributors ------------- +~~~~~~~~~~~~ * Mayank Gosai -Do not contact contributors directly about support or help with technical issues. +* `Tecnativa `__: + + * Sergio Teruel -Maintainer ----------- +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. .. 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 https://odoo-community.org. +This module is part of the `OCA/sale-workflow `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/sale_tier_validation/__manifest__.py b/sale_tier_validation/__manifest__.py index 0a9cd26029a..10af6908082 100644 --- a/sale_tier_validation/__manifest__.py +++ b/sale_tier_validation/__manifest__.py @@ -4,13 +4,13 @@ "name": "Sale Tier Validation", "summary": "Extends the functionality of Sale Orders to " "support a tier validation process.", - "version": "12.0.1.0.0", + "version": "13.0.1.0.0", "category": "Sale", "website": "https://github.com/OCA/sale-workflow", "author": "Open Source Integrators, Odoo Community Association (OCA)", "license": "AGPL-3", "application": False, "installable": True, - "depends": ["sale", "base_tier_validation",], - "data": ["views/sale_order_view.xml",], + "depends": ["sale", "base_tier_validation"], + "data": ["views/sale_order_view.xml"], } diff --git a/sale_tier_validation/i18n/es.po b/sale_tier_validation/i18n/es.po index bb6ff5514fe..c8b50a2e094 100644 --- a/sale_tier_validation/i18n/es.po +++ b/sale_tier_validation/i18n/es.po @@ -6,15 +6,17 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 12.0\n" "Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2020-05-25 14:07+0000\n" +"PO-Revision-Date: \n" "Last-Translator: Enric Tobella \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" +"Content-Transfer-Encoding: 8bit\n" "SO-Revision-Date: 2019-05-08 12:03+0000\n" "Plural-Forms: nplurals=2; plural=n != 1;\n" -"X-Generator: Weblate 3.5.1\n" +"X-Generator: Poedit 2.0.6\n" #. module: sale_tier_validation #: model_terms:ir.ui.view,arch_db:sale_tier_validation.sale_order_form_tier @@ -37,10 +39,8 @@ msgstr "La operación ha sido validada!" #. module: sale_tier_validation #: model_terms:ir.ui.view,arch_db:sale_tier_validation.view_sale_order_filter -#, fuzzy -#| msgid "My sales to review" msgid "My Sales to review" -msgstr "Mis Compras a revisar" +msgstr "Mis ventas a revisar" #. module: sale_tier_validation #: model_terms:ir.ui.view,arch_db:sale_tier_validation.view_sale_order_filter @@ -69,10 +69,8 @@ msgstr "SOs validadas y preparadas para ser confirmadas" #. module: sale_tier_validation #: model:ir.model,name:sale_tier_validation.model_sale_order -#, fuzzy -#| msgid "sale Order" -msgid "Sale Order" -msgstr "Orden de Compra" +msgid "Sales Order" +msgstr "Pedidos" #. module: sale_tier_validation #: model:ir.model,name:sale_tier_validation.model_tier_definition @@ -90,6 +88,3 @@ msgstr "Validar" #: model_terms:ir.ui.view,arch_db:sale_tier_validation.view_sale_order_filter msgid "Validated" msgstr "Validada" - -#~ msgid "Reviews" -#~ msgstr "Revisiones" diff --git a/sale_tier_validation/i18n/sale_tier_validation.pot b/sale_tier_validation/i18n/sale_tier_validation.pot index 3463ab2f850..4a4f237601d 100644 --- a/sale_tier_validation/i18n/sale_tier_validation.pot +++ b/sale_tier_validation/i18n/sale_tier_validation.pot @@ -1,12 +1,14 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: -# * sale_tier_validation +# * sale_tier_validation # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 12.0\n" +"Project-Id-Version: Odoo Server 13.0\n" "Report-Msgid-Bugs-To: \n" -"Last-Translator: <>\n" +"POT-Creation-Date: 2020-05-25 14:07+0000\n" +"PO-Revision-Date: 2020-05-25 14:07+0000\n" +"Last-Translator: \n" "Language-Team: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -15,7 +17,8 @@ msgstr "" #. module: sale_tier_validation #: model_terms:ir.ui.view,arch_db:sale_tier_validation.sale_order_form_tier -msgid "This SO needs to be\n" +msgid "" +"This SO needs to be\n" " validated." msgstr "" @@ -61,7 +64,7 @@ msgstr "" #. module: sale_tier_validation #: model:ir.model,name:sale_tier_validation.model_sale_order -msgid "Sale Order" +msgid "Sales Order" msgstr "" #. module: sale_tier_validation @@ -78,4 +81,3 @@ msgstr "" #: model_terms:ir.ui.view,arch_db:sale_tier_validation.view_sale_order_filter msgid "Validated" msgstr "" - diff --git a/sale_tier_validation/models/tier_definition.py b/sale_tier_validation/models/tier_definition.py index e289fddc934..f08a2a966fd 100644 --- a/sale_tier_validation/models/tier_definition.py +++ b/sale_tier_validation/models/tier_definition.py @@ -9,6 +9,6 @@ class TierDefinition(models.Model): @api.model def _get_tier_validation_model_names(self): - res = super(TierDefinition, self)._get_tier_validation_model_names() + res = super()._get_tier_validation_model_names() res.append("sale.order") return res diff --git a/sale_tier_validation/readme/CONFIGURE.rst b/sale_tier_validation/readme/CONFIGURE.rst new file mode 100644 index 00000000000..c1a5a4001ea --- /dev/null +++ b/sale_tier_validation/readme/CONFIGURE.rst @@ -0,0 +1,4 @@ +To configure this module, you need to: + +#. Go to *Settings > Technical > Tier Validations > Tier Definition*. +#. Create as many tiers as you want for Sale Order model. diff --git a/sale_tier_validation/readme/CONTRIBUTORS.rst b/sale_tier_validation/readme/CONTRIBUTORS.rst new file mode 100644 index 00000000000..39113c1d86e --- /dev/null +++ b/sale_tier_validation/readme/CONTRIBUTORS.rst @@ -0,0 +1,5 @@ +* Mayank Gosai + +* `Tecnativa `__: + + * Sergio Teruel diff --git a/sale_tier_validation/readme/DESCRIPTION.rst b/sale_tier_validation/readme/DESCRIPTION.rst new file mode 100644 index 00000000000..9333ac3bd73 --- /dev/null +++ b/sale_tier_validation/readme/DESCRIPTION.rst @@ -0,0 +1,2 @@ +This module extends the functionality of Sale Orders to support a tier +validation process. diff --git a/sale_tier_validation/readme/INSTALL.rst b/sale_tier_validation/readme/INSTALL.rst new file mode 100644 index 00000000000..638fbd2d688 --- /dev/null +++ b/sale_tier_validation/readme/INSTALL.rst @@ -0,0 +1,2 @@ +This module depends on ``base_tier_validation``. You can find it at +`OCA/server-ux `_ diff --git a/sale_tier_validation/readme/USAGE.rst b/sale_tier_validation/readme/USAGE.rst new file mode 100644 index 00000000000..a661117e7b8 --- /dev/null +++ b/sale_tier_validation/readme/USAGE.rst @@ -0,0 +1,14 @@ +To use this module, you need to: + +#. Create a Sale Order triggering at least one "Tier Definition". +#. Click on *Request Validation* button. +#. Under the tab *Reviews* have a look to pending reviews and their statuses. +#. Once all reviews are validated click on *Confirm Order*. + +Additional features: + +* You can filter the SOs requesting your review through the filter *Needs my + Review*. +* User with rights to confirm the SO (validate all tiers that would + be generated) can directly do the operation, this is, there is no need for + her/him to request a validation. diff --git a/sale_tier_validation/static/description/index.html b/sale_tier_validation/static/description/index.html new file mode 100644 index 00000000000..6e533dd3019 --- /dev/null +++ b/sale_tier_validation/static/description/index.html @@ -0,0 +1,458 @@ + + + + + + +Sale Tier Validation + + + +
+

Sale Tier Validation

+ + +

Beta License: AGPL-3 OCA/sale-workflow Translate me on Weblate Try me on Runbot

+

This module extends the functionality of Sale Orders to support a tier +validation process.

+

Table of contents

+ +
+

Installation

+

This module depends on base_tier_validation. You can find it at +OCA/server-ux

+
+
+

Configuration

+

To configure this module, you need to:

+
    +
  1. Go to Settings > Technical > Tier Validations > Tier Definition.
  2. +
  3. Create as many tiers as you want for Sale Order model.
  4. +
+
+
+

Usage

+

To use this module, you need to:

+
    +
  1. Create a Sale Order triggering at least one “Tier Definition”.
  2. +
  3. Click on Request Validation button.
  4. +
  5. Under the tab Reviews have a look to pending reviews and their statuses.
  6. +
  7. Once all reviews are validated click on Confirm Order.
  8. +
+

Additional features:

+
    +
  • You can filter the SOs requesting your review through the filter Needs my +Review.
  • +
  • User with rights to confirm the SO (validate all tiers that would +be generated) can directly do the operation, this is, there is no need for +her/him to request a validation.
  • +
+
+
+

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 smashing it by providing a detailed and welcomed +feedback.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Open Source Integrators
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

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/sale-workflow project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/sale_tier_validation/tests/__init__.py b/sale_tier_validation/tests/__init__.py new file mode 100644 index 00000000000..e1a50db59ca --- /dev/null +++ b/sale_tier_validation/tests/__init__.py @@ -0,0 +1,2 @@ +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +from . import test_tier_validation diff --git a/sale_tier_validation/tests/test_tier_validation.py b/sale_tier_validation/tests/test_tier_validation.py new file mode 100644 index 00000000000..4c389364ea9 --- /dev/null +++ b/sale_tier_validation/tests/test_tier_validation.py @@ -0,0 +1,71 @@ +# Copyright 2020 Sergio Teruel +# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). +from odoo.exceptions import ValidationError +from odoo.tests import common, tagged + + +@tagged("-at_install", "post_install") +class TestSaleTierValidation(common.SavepointCase): + @classmethod + def setUpClass(cls): + super().setUpClass() + # Get sale order model + cls.so_model = cls.env.ref("sale.model_sale_order") + + # Create users + group_ids = cls.env.ref("base.group_system").ids + cls.test_user_1 = cls.env["res.users"].create( + { + "name": "John", + "login": "test1", + "groups_id": [(6, 0, group_ids)], + "email": "test@examlple.com", + } + ) + + # Create tier definitions: + cls.tier_def_obj = cls.env["tier.definition"] + cls.tier_def_obj.create( + { + "model_id": cls.so_model.id, + "review_type": "individual", + "reviewer_id": cls.test_user_1.id, + "definition_domain": "[('amount_untaxed', '>', 50.0)]", + } + ) + cls.customer = cls.env["res.partner"].create({"name": "Partner for test"}) + cls.product = cls.env["product.product"].create( + {"name": "Product for test", "list_price": 120.00} + ) + + def test_tier_validation_model_name(self): + self.assertIn( + "sale.order", self.tier_def_obj._get_tier_validation_model_names() + ) + + def test_validation_sale_order(self): + so = self.env["sale.order"].create( + { + "partner_id": self.customer.id, + "order_line": [ + ( + 0, + 0, + { + "name": "Test line", + "product_id": self.product.id, + "product_uom_qty": 1, + "product_uom": self.product.uom_id.id, + "price_unit": self.product.list_price, + }, + ) + ], + "pricelist_id": self.customer.property_product_pricelist.id, + } + ) + with self.assertRaises(ValidationError): + so.action_confirm() + so.request_validation() + so.with_user(self.test_user_1).validate_tier() + so.action_confirm() + self.assertEqual(so.state, "sale")