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 20, 2024
1 parent 113e663 commit 1a0ce4d
Show file tree
Hide file tree
Showing 16 changed files with 733 additions and 0 deletions.
97 changes: 97 additions & 0 deletions sale_commission_delivery_partner/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
===========================
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 solves inconsistency problems between SO and invoices
regarding the selected agent commissioners.

Installing this module will make sure to use the Delivery Address' agents instead

**Table of contents**

.. contents::
:local:

Changelog
=========

14.0.1.0.0
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

* Initial release

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]>

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
20 changes: 20 additions & 0 deletions sale_commission_delivery_partner/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "Commission Delivery Partner",
"summary": "Advanced commissions rules",
"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_geo_assign",
"sale_commission_product_criteria_domain",
],
"data": [
"views/res_partner_view.xml",
],
"demo": [],
"maintainers": ["PicchiSeba"],
"application": False,
"installable": True,
}
70 changes: 70 additions & 0 deletions sale_commission_delivery_partner/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Francesco @ Ooops <[email protected]>, 2024.
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-05-14 21:41+0200\n"
"PO-Revision-Date: 2024-05-14 19:41+0000\n"
"Last-Translator: Francesco @ Ooops <[email protected]>\n"
"Language-Team: Italian <http://weblate.ops404.it/projects/"
"ooops-commission-14-0/ooops_sale_commission_delivery_partner/it/>\n"
"Language: it\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.4-dev\n"

#. module: ooops_sale_commission_delivery_partner
#: model:ir.model.fields,field_description:ooops_sale_commission_delivery_partner.field_res_partner__parent_agent_ids
#: model:ir.model.fields,field_description:ooops_sale_commission_delivery_partner.field_res_users__parent_agent_ids
msgid "Agents"
msgstr "Agenti"

#. module: ooops_sale_commission_delivery_partner
#: model:ir.model.fields,field_description:ooops_sale_commission_delivery_partner.field_res_partner__parent_commission_item_agent_ids
#: model:ir.model.fields,field_description:ooops_sale_commission_delivery_partner.field_res_users__parent_commission_item_agent_ids
msgid "Commission Items Groups"
msgstr "Gruppi di righe provvigioni"

#. module: ooops_sale_commission_delivery_partner
#: model:ir.model,name:ooops_sale_commission_delivery_partner.model_res_partner
msgid "Contact"
msgstr "Contatto"

#. module: ooops_sale_commission_delivery_partner
#: model:ir.model.fields,field_description:ooops_sale_commission_delivery_partner.field_account_move_line__display_name
#: model:ir.model.fields,field_description:ooops_sale_commission_delivery_partner.field_res_partner__display_name
#: model:ir.model.fields,field_description:ooops_sale_commission_delivery_partner.field_sale_order_line__display_name
msgid "Display Name"
msgstr "Nome visualizzato"

#. module: ooops_sale_commission_delivery_partner
#: model:ir.model.fields,field_description:ooops_sale_commission_delivery_partner.field_res_partner__parent_no_geo_assign_update
#: model:ir.model.fields,field_description:ooops_sale_commission_delivery_partner.field_res_users__parent_no_geo_assign_update
msgid "Do not allow update with Geo Assign"
msgstr "Non permettere aggiornamento con geo-assegnazione"

#. module: ooops_sale_commission_delivery_partner
#: model:ir.model.fields,field_description:ooops_sale_commission_delivery_partner.field_account_move_line__id
#: model:ir.model.fields,field_description:ooops_sale_commission_delivery_partner.field_res_partner__id
#: model:ir.model.fields,field_description:ooops_sale_commission_delivery_partner.field_sale_order_line__id
msgid "ID"
msgstr "ID"

#. module: ooops_sale_commission_delivery_partner
#: model:ir.model,name:ooops_sale_commission_delivery_partner.model_account_move_line
msgid "Journal Item"
msgstr "Movimento contabile"

#. module: ooops_sale_commission_delivery_partner
#: model:ir.model.fields,field_description:ooops_sale_commission_delivery_partner.field_account_move_line____last_update
#: model:ir.model.fields,field_description:ooops_sale_commission_delivery_partner.field_res_partner____last_update
#: model:ir.model.fields,field_description:ooops_sale_commission_delivery_partner.field_sale_order_line____last_update
msgid "Last Modified on"
msgstr "Ultima modifica il"

#. module: ooops_sale_commission_delivery_partner
#: model:ir.model,name:ooops_sale_commission_delivery_partner.model_sale_order_line
msgid "Sales Order Line"
msgstr "Riga ordine di vendita"
3 changes: 3 additions & 0 deletions sale_commission_delivery_partner/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from . import account_move_line
from . import res_partner
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 SaleOrderLine(models.Model):
_inherit = "account.move.line"

@api.depends("move_id", "move_id.partner_shipping_id")
def _compute_agent_ids(self):
self.agent_ids = False

Check warning on line 9 in sale_commission_delivery_partner/models/account_move_line.py

View check run for this annotation

Codecov / codecov/patch

sale_commission_delivery_partner/models/account_move_line.py#L9

Added line #L9 was not covered by tests
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(

Check warning on line 12 in sale_commission_delivery_partner/models/account_move_line.py

View check run for this annotation

Codecov / codecov/patch

sale_commission_delivery_partner/models/account_move_line.py#L12

Added line #L12 was not covered by tests
record.move_id.partner_shipping_id
)
17 changes: 17 additions & 0 deletions sale_commission_delivery_partner/models/res_partner.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from odoo import fields, models


class ResPartner(models.Model):
_inherit = "res.partner"

parent_agent_ids = fields.Many2many(
"res.partner",
related="parent_id.agent_ids",
)
parent_commission_item_agent_ids = fields.One2many(
"commission.item.agent",
related="parent_id.commission_item_agent_ids",
)
parent_no_geo_assign_update = fields.Boolean(
related="parent_id.no_geo_assign_update"
)
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

Check warning on line 9 in sale_commission_delivery_partner/models/sale_order_line.py

View check run for this annotation

Codecov / codecov/patch

sale_commission_delivery_partner/models/sale_order_line.py#L9

Added line #L9 was not covered by tests
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(

Check warning on line 12 in sale_commission_delivery_partner/models/sale_order_line.py

View check run for this annotation

Codecov / codecov/patch

sale_commission_delivery_partner/models/sale_order_line.py#L12

Added line #L12 was not covered by tests
record.order_id.partner_shipping_id
)
2 changes: 2 additions & 0 deletions sale_commission_delivery_partner/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* `PyTech SRL <https://www.pytech.it>`_:
* Sebastiano Picchi <[email protected]>
4 changes: 4 additions & 0 deletions sale_commission_delivery_partner/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
This module solves inconsistency problems between SO and invoices
regarding the selected agent commissioners.

Installing this module will make sure to use the Delivery Address' agents instead
4 changes: 4 additions & 0 deletions sale_commission_delivery_partner/readme/HISTORY.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
14.0.1.0.0
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

* Initial release
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 1a0ce4d

Please sign in to comment.