From 9bb92e63d08b356205450936d905a5a4d5c7fea9 Mon Sep 17 00:00:00 2001 From: rodrigo Date: Wed, 27 May 2026 00:53:20 -0300 Subject: [PATCH 1/5] [16.0][ADD]sale_commission_product_criteria_sections --- .../README.rst | 90 +++++++++++++++++++ .../__init__.py | 1 + .../__manifest__.py | 13 +++ .../models/__init__.py | 2 + .../models/commission.py | 39 ++++++++ .../models/sale_commission_line_mixin.py | 22 +++++ .../readme/CONFIGURE.rst | 9 ++ .../readme/CONTRIBUTORS.rst | 3 + .../readme/DESCRIPTION.rst | 6 ++ .../readme/USAGE.rst | 13 +++ .../views/commission_views.xml | 35 ++++++++ 11 files changed, 233 insertions(+) create mode 100644 sale_commission_product_criteria_sections/README.rst create mode 100644 sale_commission_product_criteria_sections/__init__.py create mode 100644 sale_commission_product_criteria_sections/__manifest__.py create mode 100644 sale_commission_product_criteria_sections/models/__init__.py create mode 100644 sale_commission_product_criteria_sections/models/commission.py create mode 100644 sale_commission_product_criteria_sections/models/sale_commission_line_mixin.py create mode 100644 sale_commission_product_criteria_sections/readme/CONFIGURE.rst create mode 100644 sale_commission_product_criteria_sections/readme/CONTRIBUTORS.rst create mode 100644 sale_commission_product_criteria_sections/readme/DESCRIPTION.rst create mode 100644 sale_commission_product_criteria_sections/readme/USAGE.rst create mode 100644 sale_commission_product_criteria_sections/views/commission_views.xml diff --git a/sale_commission_product_criteria_sections/README.rst b/sale_commission_product_criteria_sections/README.rst new file mode 100644 index 000000000..4e81b52f2 --- /dev/null +++ b/sale_commission_product_criteria_sections/README.rst @@ -0,0 +1,90 @@ +========================================== +Sale Commission Product Criteria Sections +========================================== + +.. |badge1| 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 +.. |badge2| image:: https://img.shields.io/badge/github-rodmad85-lightgray.png?logo=github + :target: https://github.com/rodmad85/commission/tree/16.0/commission_product_criteria_sections + :alt: rodmad85/commission + +|badge1| |badge2| + +This module extends sale_commission_product_criteria to allow configuring +section-based (tiered) commission rates per product criteria rule. + +Each commission item can define its own set of rate sections with amount +ranges and percentages, enabling complex commission structures where +different products have different tiered rates based on the order amount. + +**Table of contents** + +.. contents:: + :local: + +Configuration +============= + +Go to Commissions > Configuration > Commission Types + +In a record of type "Product criteria", create or edit a commission item +and set "Compute Price" to "By sections". + +Define the rate tiers by adding lines with: + +* **From** - lower bound of the amount range +* **To** - upper bound of the amount range +* **Percent** - commission percentage for this range + +Usage +===== + +When a sale order is confirmed, the commission for each line is calculated +by finding the matching commission item rule for the product. If the rule +uses "By sections", the commission amount is computed by selecting the +rate tier that matches the line subtotal and applying the corresponding +percentage. + +For example, a rule with sections: + +* 0 - 100: 5% +* 100 - 500: 8% +* 500+: 10% + +A sale of 200 would grant 200 * 8% = 16 in commission. +A sale of 600 would grant 600 * 10% = 60 in commission. + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. + +Credits +======= + +Authors +~~~~~~~ + +* Madooit + +Contributors +~~~~~~~~~~~~ + +* `Madooit `__: + + * Rodrigo A. Madureira + +Maintainers +~~~~~~~~~~~ + +This module is maintained by Madooit. + +.. image:: https://raw.githubusercontent.com/rodmad85/commission/16.0/logo.png + :alt: Madooit + :target: https://github.com/rodmad85 + +This module is part of the `rodmad85/commission `_ project on GitHub. + +You are welcome to contribute. diff --git a/sale_commission_product_criteria_sections/__init__.py b/sale_commission_product_criteria_sections/__init__.py new file mode 100644 index 000000000..0650744f6 --- /dev/null +++ b/sale_commission_product_criteria_sections/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/sale_commission_product_criteria_sections/__manifest__.py b/sale_commission_product_criteria_sections/__manifest__.py new file mode 100644 index 000000000..164b4cb32 --- /dev/null +++ b/sale_commission_product_criteria_sections/__manifest__.py @@ -0,0 +1,13 @@ +{ + "name": "Sale Commission Product Criteria Sections", + "version": "16.0.1.0.0", + "author": "Madooit, Odoo Community Association (OCA)", + "license": "AGPL-3", + "category": "Sales", + "website": "https://github.com/OCA/commission", + "depends": ["sale_commission_product_criteria"], + "data": [ + "views/commission_views.xml", + ], + "installable": True, +} diff --git a/sale_commission_product_criteria_sections/models/__init__.py b/sale_commission_product_criteria_sections/models/__init__.py new file mode 100644 index 000000000..75441cbc1 --- /dev/null +++ b/sale_commission_product_criteria_sections/models/__init__.py @@ -0,0 +1,2 @@ +from . import commission +from . import sale_commission_line_mixin diff --git a/sale_commission_product_criteria_sections/models/commission.py b/sale_commission_product_criteria_sections/models/commission.py new file mode 100644 index 000000000..c22b0a60a --- /dev/null +++ b/sale_commission_product_criteria_sections/models/commission.py @@ -0,0 +1,39 @@ +from odoo import _, fields, models + + +class CommissionItem(models.Model): + _inherit = "commission.item" + + commission_type = fields.Selection( + selection_add=[("section", _("By sections"))], + ondelete={"section": "set default"}, + ) + section_ids = fields.One2many( + "commission.section", + "commission_item_id", + string="Sections", + copy=True, + ) + + def _compute_commission_item_name_value(self): + res = super()._compute_commission_item_name_value() + for item in self: + if item.commission_type == "section": + item.commission_value = _("By sections") + return res + + def _calculate_section_amount(self, base): + for section in self.section_ids: + if section.amount_from <= base <= section.amount_to: + return base * section.percent / 100.0 + return 0.0 + + +class CommissionSection(models.Model): + _inherit = "commission.section" + + commission_item_id = fields.Many2one( + "commission.item", + string="Commission Item", + ondelete="cascade", + ) diff --git a/sale_commission_product_criteria_sections/models/sale_commission_line_mixin.py b/sale_commission_product_criteria_sections/models/sale_commission_line_mixin.py new file mode 100644 index 000000000..1a6adde35 --- /dev/null +++ b/sale_commission_product_criteria_sections/models/sale_commission_line_mixin.py @@ -0,0 +1,22 @@ +from odoo import models + + +class SaleCommissionLineMixin(models.AbstractModel): + _inherit = "commission.line.mixin" + + def _get_single_commission_amount(self, commission, subtotal, product, quantity): + self.ensure_one() + item_ids = self._get_commission_items(commission, product) + if not item_ids: + return 0.0 + commission_item = self.env["commission.item"].browse(item_ids[0]) + if commission.amount_base_type == "net_amount": + subtotal = max([0, subtotal - product.standard_price * quantity]) + self.applied_commission_item_id = commission_item + self.applied_commission_id = commission_item.commission_id + if commission_item.commission_type == "fixed": + return commission_item.fixed_amount + elif commission_item.commission_type == "percentage": + return subtotal * (commission_item.percent_amount / 100.0) + elif commission_item.commission_type == "section": + return commission_item._calculate_section_amount(subtotal) diff --git a/sale_commission_product_criteria_sections/readme/CONFIGURE.rst b/sale_commission_product_criteria_sections/readme/CONFIGURE.rst new file mode 100644 index 000000000..8b6f9a34d --- /dev/null +++ b/sale_commission_product_criteria_sections/readme/CONFIGURE.rst @@ -0,0 +1,9 @@ +Go to Commissions > Configuration > Commission Types + +In a record of type "Product criteria", create or edit a commission item +and set "Compute Price" to "By sections". + +Define the rate tiers by adding lines with: +* **From** - lower bound of the amount range +* **To** - upper bound of the amount range +* **Percent** - commission percentage for this range diff --git a/sale_commission_product_criteria_sections/readme/CONTRIBUTORS.rst b/sale_commission_product_criteria_sections/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..d1e4cd7d9 --- /dev/null +++ b/sale_commission_product_criteria_sections/readme/CONTRIBUTORS.rst @@ -0,0 +1,3 @@ +* `Madooit `__: + + * Rodrigo A. Madureira diff --git a/sale_commission_product_criteria_sections/readme/DESCRIPTION.rst b/sale_commission_product_criteria_sections/readme/DESCRIPTION.rst new file mode 100644 index 000000000..598a86457 --- /dev/null +++ b/sale_commission_product_criteria_sections/readme/DESCRIPTION.rst @@ -0,0 +1,6 @@ +This module extends sale_commission_product_criteria to allow configuring +section-based (tiered) commission rates per product criteria rule. + +Each commission item can define its own set of rate sections with amount +ranges and percentages, enabling complex commission structures where +different products have different tiered rates based on the order amount. diff --git a/sale_commission_product_criteria_sections/readme/USAGE.rst b/sale_commission_product_criteria_sections/readme/USAGE.rst new file mode 100644 index 000000000..ce284a750 --- /dev/null +++ b/sale_commission_product_criteria_sections/readme/USAGE.rst @@ -0,0 +1,13 @@ +When a sale order is confirmed, the commission for each line is calculated +by finding the matching commission item rule for the product. If the rule +uses "By sections", the commission amount is computed by selecting the +rate tier that matches the line subtotal and applying the corresponding +percentage. + +For example, a rule with sections: +* 0 - 100: 5% +* 100 - 500: 8% +* 500+: 10% + +A sale of 200 would grant 200 * 8% = 16 in commission. +A sale of 600 would grant 600 * 10% = 60 in commission. diff --git a/sale_commission_product_criteria_sections/views/commission_views.xml b/sale_commission_product_criteria_sections/views/commission_views.xml new file mode 100644 index 000000000..62be4ae17 --- /dev/null +++ b/sale_commission_product_criteria_sections/views/commission_views.xml @@ -0,0 +1,35 @@ + + + + commission.form.product.sections.inherit + commission + + + + {'invisible': [('commission_type', '!=', 'section')]} + + + + + + commission.item.form.sections.inherit + commission.item + + + + + + + + + + + + + + From b7c763d02d5fd5a9ca67489a3eb9e7f1b8a85c34 Mon Sep 17 00:00:00 2001 From: rodrigo Date: Wed, 27 May 2026 01:09:45 -0300 Subject: [PATCH 2/5] [16.0][ADD]sale_commission_product_criteria_sections --- .../README.rst | 43 ++++++++++++++----- .../__init__.py | 3 ++ .../__manifest__.py | 1 + .../models/__init__.py | 3 ++ .../models/commission.py | 3 ++ .../models/sale_commission_line_mixin.py | 3 ++ 6 files changed, 45 insertions(+), 11 deletions(-) diff --git a/sale_commission_product_criteria_sections/README.rst b/sale_commission_product_criteria_sections/README.rst index 4e81b52f2..0af3b1ed2 100644 --- a/sale_commission_product_criteria_sections/README.rst +++ b/sale_commission_product_criteria_sections/README.rst @@ -2,12 +2,17 @@ Sale Commission Product Criteria Sections ========================================== +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + .. |badge1| 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 -.. |badge2| image:: https://img.shields.io/badge/github-rodmad85-lightgray.png?logo=github - :target: https://github.com/rodmad85/commission/tree/16.0/commission_product_criteria_sections - :alt: rodmad85/commission +.. |badge2| image:: https://img.shields.io/badge/github-OCA%2Fcommission-lightgray.png?logo=github + :target: https://github.com/OCA/commission/tree/16.0/sale_commission_product_criteria_sections + :alt: OCA/commission |badge1| |badge2| @@ -58,8 +63,12 @@ A sale of 600 would grant 600 * 10% = 60 in commission. Bug Tracker =========== -Bugs are tracked on `GitHub Issues `_. +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 to smash it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. Credits ======= @@ -74,17 +83,29 @@ Contributors * `Madooit `__: - * Rodrigo A. Madureira + * Rodrigo Maio Maintainers ~~~~~~~~~~~ -This module is maintained by Madooit. +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. + +.. |maintainer-rodmad85| image:: https://github.com/rodmad85.png?size=40px + :target: https://github.com/rodmad85 + :alt: rodmad85 + +Current `maintainer `__: -.. image:: https://raw.githubusercontent.com/rodmad85/commission/16.0/logo.png - :alt: Madooit - :target: https://github.com/rodmad85 +|maintainer-rodmad85| -This module is part of the `rodmad85/commission `_ project on GitHub. +This module is part of the `OCA/commission `_ project on GitHub. -You are welcome to contribute. +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/sale_commission_product_criteria_sections/__init__.py b/sale_commission_product_criteria_sections/__init__.py index 0650744f6..dfbf964a3 100644 --- a/sale_commission_product_criteria_sections/__init__.py +++ b/sale_commission_product_criteria_sections/__init__.py @@ -1 +1,4 @@ +# Copyright 2025 Madooit +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + from . import models diff --git a/sale_commission_product_criteria_sections/__manifest__.py b/sale_commission_product_criteria_sections/__manifest__.py index 164b4cb32..d81222ad6 100644 --- a/sale_commission_product_criteria_sections/__manifest__.py +++ b/sale_commission_product_criteria_sections/__manifest__.py @@ -2,6 +2,7 @@ "name": "Sale Commission Product Criteria Sections", "version": "16.0.1.0.0", "author": "Madooit, Odoo Community Association (OCA)", + "maintainer": "rodmad85", "license": "AGPL-3", "category": "Sales", "website": "https://github.com/OCA/commission", diff --git a/sale_commission_product_criteria_sections/models/__init__.py b/sale_commission_product_criteria_sections/models/__init__.py index 75441cbc1..f5f922876 100644 --- a/sale_commission_product_criteria_sections/models/__init__.py +++ b/sale_commission_product_criteria_sections/models/__init__.py @@ -1,2 +1,5 @@ +# Copyright 2025 Madooit +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + from . import commission from . import sale_commission_line_mixin diff --git a/sale_commission_product_criteria_sections/models/commission.py b/sale_commission_product_criteria_sections/models/commission.py index c22b0a60a..5e149a3f2 100644 --- a/sale_commission_product_criteria_sections/models/commission.py +++ b/sale_commission_product_criteria_sections/models/commission.py @@ -1,3 +1,6 @@ +# Copyright 2025 Madooit +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + from odoo import _, fields, models diff --git a/sale_commission_product_criteria_sections/models/sale_commission_line_mixin.py b/sale_commission_product_criteria_sections/models/sale_commission_line_mixin.py index 1a6adde35..7056f682c 100644 --- a/sale_commission_product_criteria_sections/models/sale_commission_line_mixin.py +++ b/sale_commission_product_criteria_sections/models/sale_commission_line_mixin.py @@ -1,3 +1,6 @@ +# Copyright 2025 Madooit +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + from odoo import models From 1894f7ae8edc7f6012041791d6498e4924396ddf Mon Sep 17 00:00:00 2001 From: rodrigo Date: Wed, 27 May 2026 01:20:15 -0300 Subject: [PATCH 3/5] [16.0][ADD]sale_commission_product_criteria_sections --- .../README.rst | 40 +++++++++++-------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/sale_commission_product_criteria_sections/README.rst b/sale_commission_product_criteria_sections/README.rst index 0af3b1ed2..4428c0bbb 100644 --- a/sale_commission_product_criteria_sections/README.rst +++ b/sale_commission_product_criteria_sections/README.rst @@ -1,20 +1,36 @@ -========================================== +.. image:: https://odoo-community.org/readme-banner-image + :target: https://odoo-community.org/get-involved?utm_source=readme + :alt: Odoo Community Association + +========================================= Sale Commission Product Criteria Sections -========================================== +========================================= -.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:57cbd22f5fc122ccb2dc557d53d8c4d6aa3cc85bbeeedd692e6b032269d0ad05 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -.. |badge1| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png +.. |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/license-AGPL--3-blue.png :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 -.. |badge2| image:: https://img.shields.io/badge/github-OCA%2Fcommission-lightgray.png?logo=github +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fcommission-lightgray.png?logo=github :target: https://github.com/OCA/commission/tree/16.0/sale_commission_product_criteria_sections :alt: OCA/commission +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/commission-16-0/commission-16-0-sale_commission_product_criteria_sections + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/builds?repo=OCA/commission&target_branch=16.0 + :alt: Try me on Runboat -|badge1| |badge2| +|badge1| |badge2| |badge3| |badge4| |badge5| This module extends sale_commission_product_criteria to allow configuring section-based (tiered) commission rates per product criteria rule. @@ -37,7 +53,6 @@ In a record of type "Product criteria", create or edit a commission item and set "Compute Price" to "By sections". Define the rate tiers by adding lines with: - * **From** - lower bound of the amount range * **To** - upper bound of the amount range * **Percent** - commission percentage for this range @@ -52,7 +67,6 @@ rate tier that matches the line subtotal and applying the corresponding percentage. For example, a rule with sections: - * 0 - 100: 5% * 100 - 500: 8% * 500+: 10% @@ -83,7 +97,7 @@ Contributors * `Madooit `__: - * Rodrigo Maio + * Rodrigo A. Madureira Maintainers ~~~~~~~~~~~ @@ -98,14 +112,6 @@ 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. -.. |maintainer-rodmad85| image:: https://github.com/rodmad85.png?size=40px - :target: https://github.com/rodmad85 - :alt: rodmad85 - -Current `maintainer `__: - -|maintainer-rodmad85| - This module is part of the `OCA/commission `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. From 64b3f2d074a8f70849b53dc6a05da75b2ea4c9b3 Mon Sep 17 00:00:00 2001 From: rodrigo Date: Wed, 27 May 2026 01:26:16 -0300 Subject: [PATCH 4/5] [16.0][ADD]sale_commission_product_criteria_sections --- .../README.rst | 40 ++++++++----------- .../readme/CONTRIBUTORS.rst | 2 +- .../views/commission_views.xml | 24 +++++++---- 3 files changed, 34 insertions(+), 32 deletions(-) diff --git a/sale_commission_product_criteria_sections/README.rst b/sale_commission_product_criteria_sections/README.rst index 4428c0bbb..35ef2c945 100644 --- a/sale_commission_product_criteria_sections/README.rst +++ b/sale_commission_product_criteria_sections/README.rst @@ -1,36 +1,20 @@ -.. image:: https://odoo-community.org/readme-banner-image - :target: https://odoo-community.org/get-involved?utm_source=readme - :alt: Odoo Community Association - -========================================= +========================================== Sale Commission Product Criteria Sections -========================================= +========================================== -.. - !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:57cbd22f5fc122ccb2dc557d53d8c4d6aa3cc85bbeeedd692e6b032269d0ad05 - !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -.. |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/license-AGPL--3-blue.png +.. |badge1| 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%2Fcommission-lightgray.png?logo=github +.. |badge2| image:: https://img.shields.io/badge/github-OCA%2Fcommission-lightgray.png?logo=github :target: https://github.com/OCA/commission/tree/16.0/sale_commission_product_criteria_sections :alt: OCA/commission -.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/commission-16-0/commission-16-0-sale_commission_product_criteria_sections - :alt: Translate me on Weblate -.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png - :target: https://runboat.odoo-community.org/builds?repo=OCA/commission&target_branch=16.0 - :alt: Try me on Runboat -|badge1| |badge2| |badge3| |badge4| |badge5| +|badge1| |badge2| This module extends sale_commission_product_criteria to allow configuring section-based (tiered) commission rates per product criteria rule. @@ -53,6 +37,7 @@ In a record of type "Product criteria", create or edit a commission item and set "Compute Price" to "By sections". Define the rate tiers by adding lines with: + * **From** - lower bound of the amount range * **To** - upper bound of the amount range * **Percent** - commission percentage for this range @@ -67,6 +52,7 @@ rate tier that matches the line subtotal and applying the corresponding percentage. For example, a rule with sections: + * 0 - 100: 5% * 100 - 500: 8% * 500+: 10% @@ -97,7 +83,7 @@ Contributors * `Madooit `__: - * Rodrigo A. Madureira + * Rodrigo Madureira Maintainers ~~~~~~~~~~~ @@ -112,6 +98,14 @@ 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. +.. |maintainer-rodmad85| image:: https://github.com/rodmad85.png?size=40px + :target: https://github.com/rodmad85 + :alt: rodmad85 + +Current `maintainer `__: + +|maintainer-rodmad85| + This module is part of the `OCA/commission `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/sale_commission_product_criteria_sections/readme/CONTRIBUTORS.rst b/sale_commission_product_criteria_sections/readme/CONTRIBUTORS.rst index d1e4cd7d9..ddab98859 100644 --- a/sale_commission_product_criteria_sections/readme/CONTRIBUTORS.rst +++ b/sale_commission_product_criteria_sections/readme/CONTRIBUTORS.rst @@ -1,3 +1,3 @@ * `Madooit `__: - * Rodrigo A. Madureira + * Rodrigo Madureira diff --git a/sale_commission_product_criteria_sections/views/commission_views.xml b/sale_commission_product_criteria_sections/views/commission_views.xml index 62be4ae17..d26f47387 100644 --- a/sale_commission_product_criteria_sections/views/commission_views.xml +++ b/sale_commission_product_criteria_sections/views/commission_views.xml @@ -1,12 +1,17 @@ - + commission.form.product.sections.inherit commission - {'invisible': [('commission_type', '!=', 'section')]} + + {'invisible': [('commission_type', '!=', 'section')]} + @@ -14,15 +19,18 @@ commission.item.form.sections.inherit commission.item - + + name="section_ids" + attrs="{'invisible': [('commission_type', '!=', 'section')]}" + nolabel="1" + colspan="2" + > From 011f3b381f0c18b1e470b00da5ef2e141a2f3e08 Mon Sep 17 00:00:00 2001 From: rodrigo Date: Wed, 27 May 2026 01:33:05 -0300 Subject: [PATCH 5/5] [16.0][ADD]sale_commission_product_criteria_sections --- .../README.rst | 38 +- .../static/description/index.html | 462 ++++++++++++++++++ .../sale_commission_product_criteria_sections | 1 + .../setup.py | 6 + 4 files changed, 491 insertions(+), 16 deletions(-) create mode 100644 sale_commission_product_criteria_sections/static/description/index.html create mode 120000 setup/sale_commission_product_criteria_sections/odoo/addons/sale_commission_product_criteria_sections create mode 100644 setup/sale_commission_product_criteria_sections/setup.py diff --git a/sale_commission_product_criteria_sections/README.rst b/sale_commission_product_criteria_sections/README.rst index 35ef2c945..d1ed73adf 100644 --- a/sale_commission_product_criteria_sections/README.rst +++ b/sale_commission_product_criteria_sections/README.rst @@ -1,20 +1,36 @@ -========================================== +.. image:: https://odoo-community.org/readme-banner-image + :target: https://odoo-community.org/get-involved?utm_source=readme + :alt: Odoo Community Association + +========================================= Sale Commission Product Criteria Sections -========================================== +========================================= -.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:633ef64596534a332b6fc3014f7ebc0dd3c79da3db070ed38f744d83d4351a1b + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -.. |badge1| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png +.. |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/license-AGPL--3-blue.png :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 -.. |badge2| image:: https://img.shields.io/badge/github-OCA%2Fcommission-lightgray.png?logo=github +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fcommission-lightgray.png?logo=github :target: https://github.com/OCA/commission/tree/16.0/sale_commission_product_criteria_sections :alt: OCA/commission +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/commission-16-0/commission-16-0-sale_commission_product_criteria_sections + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/builds?repo=OCA/commission&target_branch=16.0 + :alt: Try me on Runboat -|badge1| |badge2| +|badge1| |badge2| |badge3| |badge4| |badge5| This module extends sale_commission_product_criteria to allow configuring section-based (tiered) commission rates per product criteria rule. @@ -37,7 +53,6 @@ In a record of type "Product criteria", create or edit a commission item and set "Compute Price" to "By sections". Define the rate tiers by adding lines with: - * **From** - lower bound of the amount range * **To** - upper bound of the amount range * **Percent** - commission percentage for this range @@ -52,7 +67,6 @@ rate tier that matches the line subtotal and applying the corresponding percentage. For example, a rule with sections: - * 0 - 100: 5% * 100 - 500: 8% * 500+: 10% @@ -98,14 +112,6 @@ 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. -.. |maintainer-rodmad85| image:: https://github.com/rodmad85.png?size=40px - :target: https://github.com/rodmad85 - :alt: rodmad85 - -Current `maintainer `__: - -|maintainer-rodmad85| - This module is part of the `OCA/commission `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/sale_commission_product_criteria_sections/static/description/index.html b/sale_commission_product_criteria_sections/static/description/index.html new file mode 100644 index 000000000..a1999f573 --- /dev/null +++ b/sale_commission_product_criteria_sections/static/description/index.html @@ -0,0 +1,462 @@ + + + + + +README.rst + + + +
+ + + +Odoo Community Association + +
+

Sale Commission Product Criteria Sections

+ +

Beta License: AGPL-3 OCA/commission Translate me on Weblate Try me on Runboat

+

This module extends sale_commission_product_criteria to allow configuring +section-based (tiered) commission rates per product criteria rule.

+

Each commission item can define its own set of rate sections with amount +ranges and percentages, enabling complex commission structures where +different products have different tiered rates based on the order amount.

+

Table of contents

+ +
+

Configuration

+

Go to Commissions > Configuration > Commission Types

+

In a record of type “Product criteria”, create or edit a commission item +and set “Compute Price” to “By sections”.

+

Define the rate tiers by adding lines with: +* From - lower bound of the amount range +* To - upper bound of the amount range +* Percent - commission percentage for this range

+
+
+

Usage

+

When a sale order is confirmed, the commission for each line is calculated +by finding the matching commission item rule for the product. If the rule +uses “By sections”, the commission amount is computed by selecting the +rate tier that matches the line subtotal and applying the corresponding +percentage.

+

For example, a rule with sections: +* 0 - 100: 5% +* 100 - 500: 8% +* 500+: 10%

+

A sale of 200 would grant 200 * 8% = 16 in commission. +A sale of 600 would grant 600 * 10% = 60 in commission.

+
+
+

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

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • Madooit
  • +
+
+
+

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

+

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

+
+
+
+
+ + diff --git a/setup/sale_commission_product_criteria_sections/odoo/addons/sale_commission_product_criteria_sections b/setup/sale_commission_product_criteria_sections/odoo/addons/sale_commission_product_criteria_sections new file mode 120000 index 000000000..926718909 --- /dev/null +++ b/setup/sale_commission_product_criteria_sections/odoo/addons/sale_commission_product_criteria_sections @@ -0,0 +1 @@ +../../../../sale_commission_product_criteria_sections \ No newline at end of file diff --git a/setup/sale_commission_product_criteria_sections/setup.py b/setup/sale_commission_product_criteria_sections/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/sale_commission_product_criteria_sections/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)