Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
801be92
[ADD] sale_commission_product_criteria
ilyasProgrammer Apr 12, 2023
3b56fc6
Added translation using Weblate (Italian)
francesco-ooops May 24, 2023
6fb9a4f
[FIX] sale_commission_product_criteria: removed pricelist_id feild.
ilyasProgrammer Jun 22, 2023
c2d9201
[IMP] sale_commission_product_criteria: added commission items search…
ilyasProgrammer Jul 5, 2023
65c5cd3
[IMP] sale_commission_product_criteria: no need to order items by id
ilyasProgrammer Aug 15, 2023
b5bb932
[IMP] sale_commission_product_criteria: correct sorting in SQL
ilyasProgrammer Aug 22, 2023
109d02b
[IMP] sale_commission_product_criteria: relax access rules
HekkiMelody Sep 12, 2023
da8622d
[FIX] sale_commission_product_criteria_domain: limit view to security…
HekkiMelody Sep 12, 2023
01e1d0e
[MIG] sale_commission_product_criteria: Migration to 16.0
SirAionTech Oct 18, 2023
9fbee1a
Added translation using Weblate (Spanish)
berisoft-arg May 9, 2024
2607cab
[FIX]sale_commission_product_criteria: ignore error on create
PicchiSeba Oct 15, 2024
d512a9a
[IMP]sale_commission_product_criteria: reorder test functions, add ma…
PicchiSeba Oct 15, 2024
8c925bd
Translated using Weblate (Italian)
mymage Mar 5, 2025
39890f9
[REF] sale_commission_product_criteria: refactor sql query to be inhe…
Tisho99 May 16, 2025
6cffab0
Added translation using Weblate (Portuguese (Brazil))
marcelsavegnago Jun 28, 2025
a5fd475
Added translation using Weblate (German)
davidbeckercbl Mar 11, 2026
6fae130
[MOV] Move sale_commission_product_criteria to sale_commission_oca_pr…
david-banon-tecnativa Mar 30, 2026
9a67f2f
[IMP] sale_commission_oca_product_criteria: pre-commit auto fixes
david-banon-tecnativa Mar 30, 2026
5c917f0
[IMP] sale_commission_product_criteria: print comm value on report
HekkiMelody Oct 16, 2024
93eb59e
[IMP] sale_commission_product_criteria: Use ORM instead of SQL
CarlosRoca13 Aug 26, 2025
db2c7dc
[MIG] sale_commission_oca_product_criteria: Migration to 18.0
david-banon-tecnativa Mar 30, 2026
a44e049
[UPD] Update sale_commission_oca_product_criteria.pot
Apr 6, 2026
0326f15
[BOT] post-merge updates
OCA-git-bot Apr 6, 2026
69dbe84
Translated using Weblate (Italian)
mymage Apr 8, 2026
2ea4f5a
Translated using Weblate (Portuguese (Brazil))
rodmad85 Apr 13, 2026
2c41960
Added translation using Weblate (Arabic)
MohamedESalem May 17, 2026
5509d6a
[MIG] sale_commission_oca_product_criteria: Migration to 19.0
AungKoKoLin1997 Jul 23, 2026
ccb7cb5
[IMP] sale_commission_oca_product_criteria: add per-unit, min qty and…
AungKoKoLin1997 Jul 23, 2026
1a5ec57
[FIX] sale_commission_oca_product_criteria: fix the item matching and…
AungKoKoLin1997 Aug 14, 2026
8b29f6b
[FIX] sale_commission_oca_product_criteria: let the commission manage…
AungKoKoLin1997 Aug 26, 2026
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
174 changes: 174 additions & 0 deletions sale_commission_oca_product_criteria/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
.. 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
================================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:2b5e994b0eb028cb93b731fc19ebad3684861fda4af5403ec0f8b88d9d945f48
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |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
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fcommission-lightgray.png?logo=github
:target: https://github.com/OCA/commission/tree/19.0/sale_commission_oca_product_criteria
:alt: OCA/commission
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/commission-19-0/commission-19-0-sale_commission_oca_product_criteria
: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=19.0
:alt: Try me on Runboat

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

This module allows to set in the same Commission Type different
commission rates according to the product on SO/invoice line.

This is made possible since this module adds a new "Product criteria"
type to Commission Type and applies commission rates with the same logic
of sale pricelist items.

For example, such a Commission Type can grant:

10% on a specific Product A, 10$ on Product B, 4% on products in
Category 1 and 5$ on all other products.

In SO/invoice, system will apply different commissions based on
variant/product/category or global, applied hierarchically. This means
that for the example above, if product A is assigned to Category 1,
commission assigned is 10%, as per variant/product/category/global rule
application order.

Furthermore, these commission type items can be accessed and created by
a specific menu, to facilitate their management in environments with
lots of records.

The form for commission type item can be extended by future modules with
further conditions to decide when to apply a specific item.

**Table of contents**

.. contents::
:local:

Configuration
=============

1. Go to Commissions > Configuration > Commission Types.
2. Create a Commission Type with type = "Product criteria".
3. Create multiple rules based on variant/product/category or global.
4. On each rule, optionally set:

- **Per unit** (for fixed-amount rules): multiply the amount by the
line quantity, expressed in the default unit of measure of the
product.
- **Min. Quantity**: only apply this rule when the line quantity,
expressed in the default unit of measure of the product, is at or
above this threshold. A rule without minimum quantity always
applies; when several rules match at the same level, the one with
the highest applicable minimum quantity is used.
- **Start Date / End Date**: restrict the rule to a date range,
evaluated against the invoice date, or against the order date in
the timezone of the company.

A rule only applies to the orders and the invoices of its company. Leave
its **Company** empty to share it with every company.

Fixed amounts are set in the currency of the company of the rule and
converted to the currency of the order or the invoice at its date. A
rule shared by every company has no currency of its own, so its amount
is taken in the currency of the company of the order or the invoice.

Editing a rule does not recompute the commissions already computed on
existing orders and invoices, so that settled amounts stay untouched.
Use the *Regenerate agents* button on a draft order or invoice to apply
the current rules to it.

When the commission is based on the net amount, the product cost is
subtracted per unit of the default unit of measure of the product too,
and converted from the currency of the company the same way.

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

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

* Ilyas
* Ooops404

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

- `Ooops404 <https://www.ooops404.com>`__:

- Ilyas <irazor147@gmail.com>

- `Aion Tech <https://aiontech.company/>`__:

- Simone Rubino <simone.rubino@aion-tech.it>

- `Tecnativa <https://www.tecnativa.com>`__

- Carlos Roca
- David Bañón Gil

- `Quartile <https://www.quartile.co>`__

- Aung Ko Ko Lin
- Tatsuki Kanda

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.

.. |maintainer-ilyasProgrammer| image:: https://github.com/ilyasProgrammer.png?size=40px
:target: https://github.com/ilyasProgrammer
:alt: ilyasProgrammer
.. |maintainer-aleuffre| image:: https://github.com/aleuffre.png?size=40px
:target: https://github.com/aleuffre
:alt: aleuffre
.. |maintainer-renda-dev| image:: https://github.com/renda-dev.png?size=40px
:target: https://github.com/renda-dev
:alt: renda-dev
.. |maintainer-PicchiSeba| image:: https://github.com/PicchiSeba.png?size=40px
:target: https://github.com/PicchiSeba
:alt: PicchiSeba

Current `maintainers <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-ilyasProgrammer| |maintainer-aleuffre| |maintainer-renda-dev| |maintainer-PicchiSeba|

This module is part of the `OCA/commission <https://github.com/OCA/commission/tree/19.0/sale_commission_oca_product_criteria>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions sale_commission_oca_product_criteria/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
24 changes: 24 additions & 0 deletions sale_commission_oca_product_criteria/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# © 2023 ooops404
# Copyright 2023 Simone Rubino - Aion Tech
# License AGPL-3 - See https://www.gnu.org/licenses/agpl-3.0.html
{
"name": "Sale Commission Product Criteria",
"summary": "Advanced commissions rules",
"version": "19.0.1.0.0",
"author": "Ilyas, Ooops404, Odoo Community Association (OCA)",
"maintainers": ["ilyasProgrammer", "aleuffre", "renda-dev", "PicchiSeba"],
"website": "https://github.com/OCA/commission",
"category": "Sales Management",
"license": "AGPL-3",
"depends": ["sale_commission_oca"],
"data": [
"reports/report_settlement_template.xml",
"views/views.xml",
"security/ir.model.access.csv",
"security/commission_item_security.xml",
],
"demo": ["demo/sale_agent_demo.xml"],
"application": False,
"installable": True,
"auto_install": False,
}
67 changes: 67 additions & 0 deletions sale_commission_oca_product_criteria/demo/sale_agent_demo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?xml version="1.0" ?>
<!--
~ Copyright 2023 Simone Rubino - Aion Tech
~ License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
-->
<odoo>
<record id="demo_commission_rules" model="commission">
<field name="name">Based on Rules</field>
<field name="commission_type">product</field>
</record>

<record id="demo_commission_rules_item_1" model="commission.item">
<field name="commission_id" ref="demo_commission_rules" />
<field name="sequence" eval="1" />
<field name="based_on">sol</field>
<field name="applied_on">3_global</field>
<field name="commission_type">fixed</field>
<field name="fixed_amount">10</field>
</record>

<record id="demo_commission_rules_item_2" model="commission.item">
<field name="commission_id" ref="demo_commission_rules" />
<field name="sequence" eval="2" />
<field name="based_on">sol</field>
<field name="applied_on">2_product_category</field>
<field name="commission_type">fixed</field>
<field name="fixed_amount">20</field>
<field name="categ_id" ref="product.product_category_office" />
</record>

<record id="demo_commission_rules_item_3" model="commission.item">
<field name="commission_id" ref="demo_commission_rules" />
<field name="sequence" eval="3" />
<field name="based_on">sol</field>
<field name="applied_on">1_product</field>
<field name="commission_type">percentage</field>
<field name="percent_amount">5</field>
<field
name="product_tmpl_id"
ref="product.product_product_4_product_template"
/>
</record>

<record id="demo_commission_rules_item_4" model="commission.item">
<field name="commission_id" ref="demo_commission_rules" />
<field name="sequence" eval="4" />
<field name="based_on">sol</field>
<field name="applied_on">0_product_variant</field>
<field name="commission_type">percentage</field>
<field name="percent_amount">15</field>
<field name="product_id" ref="product.product_product_4" />
</record>

<record id="demo_agent_rules" model="res.partner">
<field name="name">Agent Rules</field>
<field name="is_company">True</field>
<field name="agent">True</field>
<field name="commission_id" ref="demo_commission_rules" />
</record>

<record id="base.res_partner_12" model="res.partner">
<field
name="commission_agent_ids"
eval="[Command.set([ref('sale_commission_oca_product_criteria.demo_agent_rules')])]"
/>
</record>
</odoo>
Loading
Loading