Skip to content

Commit

Permalink
[ADD] sale_commission_delivery_partner
Browse files Browse the repository at this point in the history
  • Loading branch information
toita86 committed Jun 26, 2024
1 parent 9c6a00f commit fe21548
Show file tree
Hide file tree
Showing 14 changed files with 691 additions and 0 deletions.
91 changes: 91 additions & 0 deletions sale_commission_delivery_partner/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
===========================
Commission Delivery Partner
===========================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:64fbc27f93c0a21e84b27ee30b1a1ce3713b17b3a816c677eacf1f86f8b2fb98
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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/14.0/sale_commission_delivery_partner
:alt: OCA/commission
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/commission-14-0/commission-14-0-sale_commission_delivery_partner
: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=14.0
:alt: Try me on Runboat

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

This module addresses the use case where the same customer has different agents/commissions according to SO/Invoice delivery address.

In SO and invoice, commission is calculated based on agents set in the "delivery address" contact rather than on "customer" contact's agents.

**Table of contents**

.. contents::
:local:

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_delivery_partner%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
~~~~~~~

* Ooops
* PyTech SRL

Contributors
~~~~~~~~~~~~

* `PyTech SRL <https://www.pytech.it>`_:
* Sebastiano Picchi <[email protected]>

* `Ooops404 <https://www.ooops404.com>`_:
* Eduard Brahas <[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-PicchiSeba| image:: https://github.com/PicchiSeba.png?size=40px
:target: https://github.com/PicchiSeba
:alt: PicchiSeba

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

|maintainer-PicchiSeba|

This module is part of the `OCA/commission <https://github.com/OCA/commission/tree/14.0/sale_commission_delivery_partner>`_ 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_delivery_partner/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
17 changes: 17 additions & 0 deletions sale_commission_delivery_partner/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "Commission Delivery Partner",
"summary": "Commissions based on delivery address",
"version": "14.0.1.0.0",
"author": "Ooops, " "PyTech SRL," "Odoo Community Association (OCA)",
"website": "https://github.com/OCA/commission",
"category": "Sales Management",
"license": "AGPL-3",
"depends": [
"sale_commission",
],
"data": [],
"demo": [],
"maintainers": ["PicchiSeba"],
"application": False,
"installable": True,
}
2 changes: 2 additions & 0 deletions sale_commission_delivery_partner/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import account_move_line
from . import sale_order_line
14 changes: 14 additions & 0 deletions sale_commission_delivery_partner/models/account_move_line.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from odoo import api, models


class AccountMoveLine(models.Model):
_inherit = "account.move.line"

@api.depends("move_id", "move_id.partner_shipping_id")
def _compute_agent_ids(self):
self.agent_ids = False
for record in self.filtered(lambda x: x.move_id.partner_shipping_id):
if not record.commission_free:
record.agent_ids = record._prepare_agents_vals_partner(
record.move_id.partner_shipping_id
)
14 changes: 14 additions & 0 deletions sale_commission_delivery_partner/models/sale_order_line.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from odoo import api, models


class SaleOrderLine(models.Model):
_inherit = "sale.order.line"

@api.depends("order_id", "order_id.partner_shipping_id")
def _compute_agent_ids(self):
self.agent_ids = False
for record in self.filtered(lambda x: x.order_id.partner_shipping_id):
if not record.commission_free:
record.agent_ids = record._prepare_agents_vals_partner(
record.order_id.partner_shipping_id
)
5 changes: 5 additions & 0 deletions sale_commission_delivery_partner/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
* `PyTech SRL <https://www.pytech.it>`_:
* Sebastiano Picchi <[email protected]>

* `Ooops404 <https://www.ooops404.com>`_:
* Eduard Brahas <[email protected]>
3 changes: 3 additions & 0 deletions sale_commission_delivery_partner/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This module addresses the use case where the same customer has different agents/commissions according to SO/Invoice delivery address.

In SO and invoice, commission is calculated based on agents set in the "delivery address" contact rather than on "customer" contact's agents.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit fe21548

Please sign in to comment.