Skip to content

Commit

Permalink
Merge pull request #411 from OCA/16.0
Browse files Browse the repository at this point in the history
Syncing from upstream OCA/commission (16.0)
  • Loading branch information
bt-admin authored Feb 21, 2024
2 parents b396457 + c60b8ee commit 0468f39
Show file tree
Hide file tree
Showing 26 changed files with 2,409 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ addon | version | maintainers | summary
[commission_formula](commission_formula/) | 16.0.1.0.0 | | Commissions computed by formulas
[hr_commission](hr_commission/) | 16.0.1.0.0 | | HR commissions
[sale_commission](sale_commission/) | 16.0.1.0.1 | [![pedrobaeza](https://github.com/pedrobaeza.png?size=30px)](https://github.com/pedrobaeza) | Sales commissions
[sale_commission_product_criteria](sale_commission_product_criteria/) | 16.0.1.0.0 | [![ilyasProgrammer](https://github.com/ilyasProgrammer.png?size=30px)](https://github.com/ilyasProgrammer) | Advanced commissions rules
[sale_commission_salesman](sale_commission_salesman/) | 16.0.1.0.0 | | Sales commissions from salesman

[//]: # (end addons)
Expand Down
116 changes: 116 additions & 0 deletions sale_commission_product_criteria/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
================================
Sale Commission Product Criteria
================================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:679118d6039b7893a5538b753c6809a13130884e390fb913b1a83cb29c0a0dd4
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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%2Fcommission-lightgray.png?logo=github
:target: https://github.com/OCA/commission/tree/16.0/sale_commission_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-16-0/commission-16-0-sale_commission_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=16.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:

Usage
=====

To use features of this module, you need to:

#. Go to Commissions > Configuration > Commission Types.
#. Create a Commission Type with type = "Product criteria".
#. Create multiple rules based on variant/product/category or global
#. These rules will be sorted according to the same logic of sale pricelist.
#. Rest flow is according to OCA sale_commission module.

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_product_criteria%0Aversion:%2016.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 <[email protected]>
* `Aion Tech <https://aiontech.company/>`_:

* Simone Rubino <[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.

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

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

|maintainer-ilyasProgrammer|

This module is part of the `OCA/commission <https://github.com/OCA/commission/tree/16.0/sale_commission_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_product_criteria/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
22 changes: 22 additions & 0 deletions sale_commission_product_criteria/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# © 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": "16.0.1.0.0",
"author": "Ilyas, Ooops404, Odoo Community Association (OCA)",
"maintainers": ["ilyasProgrammer"],
"website": "https://github.com/OCA/commission",
"category": "Sales Management",
"license": "AGPL-3",
"depends": ["sale_commission"],
"data": [
"views/views.xml",
"security/ir.model.access.csv",
],
"demo": ["demo/sale_agent_demo.xml"],
"application": False,
"installable": True,
"auto_install": False,
}
69 changes: 69 additions & 0 deletions sale_commission_product_criteria/demo/sale_agent_demo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<?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_5" />
</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="agent_ids"
eval="[(6, 0, [ref('sale_commission_product_criteria.demo_agent_rules')])]"
/>
</record>

</odoo>
Loading

0 comments on commit 0468f39

Please sign in to comment.