Skip to content

Commit

Permalink
Merge pull request #468 from OCA/14.0
Browse files Browse the repository at this point in the history
Syncing from upstream OCA/commission (14.0)
  • Loading branch information
bt-admin authored Jul 11, 2024
2 parents dde7096 + 284bdb2 commit 823ecb1
Show file tree
Hide file tree
Showing 9 changed files with 62 additions and 52 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ addon | version | maintainers | summary
[sale_commission_check_deposit](sale_commission_check_deposit/) | 14.0.1.0.0 | | Sales commission check deposit
[sale_commission_delegated_partner](sale_commission_delegated_partner/) | 14.0.1.0.1 | | Allow to delegate the invoices of agent to a delegate partner
[sale_commission_formula](sale_commission_formula/) | 14.0.1.0.0 | | Sale commissions computed by formulas
[sale_commission_geo_assign](sale_commission_geo_assign/) | 14.0.1.1.2 | [![eLBati](https://github.com/eLBati.png?size=30px)](https://github.com/eLBati) [![aleuffre](https://github.com/aleuffre.png?size=30px)](https://github.com/aleuffre) [![renda-dev](https://github.com/renda-dev.png?size=30px)](https://github.com/renda-dev) [![PicchiSeba](https://github.com/PicchiSeba.png?size=30px)](https://github.com/PicchiSeba) | Assign agents to partners according to their location
[sale_commission_geo_assign_product_domain](sale_commission_geo_assign_product_domain/) | 14.0.1.3.1 | [![aleuffre](https://github.com/aleuffre.png?size=30px)](https://github.com/aleuffre) [![renda-dev](https://github.com/renda-dev.png?size=30px)](https://github.com/renda-dev) | Bridge module between sale_commission_product_criteria_domain and sale_commission_geo_assign
[sale_commission_geo_assign](sale_commission_geo_assign/) | 14.0.1.1.3 | [![eLBati](https://github.com/eLBati.png?size=30px)](https://github.com/eLBati) [![aleuffre](https://github.com/aleuffre.png?size=30px)](https://github.com/aleuffre) [![renda-dev](https://github.com/renda-dev.png?size=30px)](https://github.com/renda-dev) [![PicchiSeba](https://github.com/PicchiSeba.png?size=30px)](https://github.com/PicchiSeba) | Assign agents to partners according to their location
[sale_commission_geo_assign_product_domain](sale_commission_geo_assign_product_domain/) | 14.0.1.3.2 | [![aleuffre](https://github.com/aleuffre.png?size=30px)](https://github.com/aleuffre) [![renda-dev](https://github.com/renda-dev.png?size=30px)](https://github.com/renda-dev) | Bridge module between sale_commission_product_criteria_domain and sale_commission_geo_assign
[sale_commission_partial_settlement](sale_commission_partial_settlement/) | 14.0.1.0.0 | | Sales commissions based on paid amount
[sale_commission_pricelist](sale_commission_pricelist/) | 14.0.1.0.0 | | Sales commissions by pricelist
[sale_commission_product_criteria](sale_commission_product_criteria/) | 14.0.1.1.4 | [![ilyasProgrammer](https://github.com/ilyasProgrammer.png?size=30px)](https://github.com/ilyasProgrammer) | Advanced commissions rules
Expand Down
2 changes: 1 addition & 1 deletion sale_commission_geo_assign/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Sales commissions - Geo assignation
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:3f4d9f6a2fb00f254c60c9492c0cb4c4d65107fcd1ab6440daa3132f1abbf0f4
!! source digest: sha256:3cc728a8e6c8754d075692c10b610414b30ef5d02377f4308ddf21ed7b1c80dc
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Production%2FStable-green.png
Expand Down
2 changes: 1 addition & 1 deletion sale_commission_geo_assign/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{
"name": "Sales commissions - Geo assignation",
"summary": "Assign agents to partners according to their location",
"version": "14.0.1.1.2",
"version": "14.0.1.1.3",
"development_status": "Production/Stable",
"category": "Sales Management",
"website": "https://github.com/OCA/commission",
Expand Down
13 changes: 8 additions & 5 deletions sale_commission_geo_assign/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@

/*
:Author: David Goodger ([email protected])
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
:Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils.
Despite the name, some widely supported CSS2 features are used.
See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
customize this style sheet.
Expand Down Expand Up @@ -274,7 +275,7 @@
margin-left: 2em ;
margin-right: 2em }

pre.code .ln { color: grey; } /* line numbers */
pre.code .ln { color: gray; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
Expand All @@ -300,7 +301,7 @@
span.pre {
white-space: pre }

span.problematic {
span.problematic, pre.problematic {
color: red }

span.section-subtitle {
Expand Down Expand Up @@ -366,7 +367,7 @@ <h1 class="title">Sales commissions - Geo assignation</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:3f4d9f6a2fb00f254c60c9492c0cb4c4d65107fcd1ab6440daa3132f1abbf0f4
!! source digest: sha256:3cc728a8e6c8754d075692c10b610414b30ef5d02377f4308ddf21ed7b1c80dc
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Production/Stable" src="https://img.shields.io/badge/maturity-Production%2FStable-green.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/commission/tree/14.0/sale_commission_geo_assign"><img alt="OCA/commission" src="https://img.shields.io/badge/github-OCA%2Fcommission-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/commission-14-0/commission-14-0-sale_commission_geo_assign"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/commission&amp;target_branch=14.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>Configure sales agents assigning them to a specific geographical area.</p>
Expand Down Expand Up @@ -433,7 +434,9 @@ <h2><a class="toc-backref" href="#toc-entry-6">Contributors</a></h2>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
<a class="reference external image-reference" href="https://odoo-community.org">
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
</a>
<p>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.</p>
Expand Down
10 changes: 5 additions & 5 deletions sale_commission_geo_assign/wizard/wizard_geo_assign_partner.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ def geo_assign_partner(self):
# compatibility with 'sale_commission_product_criteria_domain'
partner.commission_item_agent_ids.unlink()

for agent in agents:
self.update_partner_data(partner, agent)
self.update_partner_data(partner, agents)

@api.model
def update_partner_data(self, partner, agent):
if agent.is_assignable(partner):
partner.agent_ids = [(4, agent.id)]
def update_partner_data(self, partner, agents):
partner.agent_ids = [
(4, agent.id) for agent in agents if agent.is_assignable(partner)
]
2 changes: 1 addition & 1 deletion sale_commission_geo_assign_product_domain/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Sale Commission Geo Assign Product Domain
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:6c8a98754ee6b4f4028ee96cf0a38416f6ad8bc5e2b74447bc9fc50f6b8012f0
!! source digest: sha256:72b3fa05299c2b7490315a9a529fdacc10b0263dd042ab240a77e9bb3bd7a456
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
Expand Down
2 changes: 1 addition & 1 deletion sale_commission_geo_assign_product_domain/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"summary": "Bridge module between "
"sale_commission_product_criteria_domain and "
"sale_commission_geo_assign",
"version": "14.0.1.3.1",
"version": "14.0.1.3.2",
"author": "PyTech SRL, Ooops404, Odoo Community Association (OCA)",
"maintainers": ["aleuffre", "renda-dev"],
"website": "https://github.com/OCA/commission",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@

/*
:Author: David Goodger ([email protected])
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
:Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils.
Despite the name, some widely supported CSS2 features are used.
See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
customize this style sheet.
Expand Down Expand Up @@ -274,7 +275,7 @@
margin-left: 2em ;
margin-right: 2em }

pre.code .ln { color: grey; } /* line numbers */
pre.code .ln { color: gray; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
Expand All @@ -300,7 +301,7 @@
span.pre {
white-space: pre }

span.problematic {
span.problematic, pre.problematic {
color: red }

span.section-subtitle {
Expand Down Expand Up @@ -366,7 +367,7 @@ <h1 class="title">Sale Commission Geo Assign Product Domain</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:6c8a98754ee6b4f4028ee96cf0a38416f6ad8bc5e2b74447bc9fc50f6b8012f0
!! source digest: sha256:72b3fa05299c2b7490315a9a529fdacc10b0263dd042ab240a77e9bb3bd7a456
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/commission/tree/14.0/sale_commission_geo_assign_product_domain"><img alt="OCA/commission" src="https://img.shields.io/badge/github-OCA%2Fcommission-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/commission-14-0/commission-14-0-sale_commission_geo_assign_product_domain"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/commission&amp;target_branch=14.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This is a bridge module between sale_commission_product_criteria_domain and sale_commission_geo_assign. It allows to address the following use case:</p>
Expand Down Expand Up @@ -423,7 +424,9 @@ <h2><a class="toc-backref" href="#toc-entry-6">Contributors</a></h2>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
<a class="reference external image-reference" href="https://odoo-community.org">
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
</a>
<p>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.</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,35 +8,39 @@ class WizardGeoAssign(models.TransientModel):
_inherit = "wizard.geo.assign.partner"

@api.model
def update_partner_data(self, partner, agent):
if agent.commission_type == "product_restricted":
def update_partner_data(self, partner, agents):
product_restricted_agents = agents.filtered(
lambda a: a.commission_type == "product_restricted"
)
partner_agent_ids = self.env["res.partner"]
for agent in product_restricted_agents:
for line in agent.commission_geo_group_ids:
if line.is_assignable(partner):
partner.agent_ids = [(4, agent.id)]

commission_item = partner.commission_item_agent_ids.filtered(
lambda x: x.agent_id == agent
)
if commission_item:
commission_item.group_ids = [
(4, x) for x in line.mapped("commission_group_ids.id")
]
else:
partner.commission_item_agent_ids = [
(
0,
0,
{
"agent_id": agent.id,
"group_ids": [
(
6,
0,
line.mapped("commission_group_ids.id"),
)
],
},
)
]
else:
super().update_partner_data(partner, agent)
if not line.is_assignable(partner):
continue
partner_agent_ids += agent
commission_item = partner.commission_item_agent_ids.filtered(
lambda x: x.agent_id == agent
)
if commission_item:
commission_item.group_ids = [
(4, x) for x in line.mapped("commission_group_ids.id")
]
else:
partner.commission_item_agent_ids = [
(
0,
0,
{
"agent_id": agent.id,
"group_ids": [
(
6,
0,
line.mapped("commission_group_ids.id"),
)
],
},
)
]
partner.agent_ids += partner_agent_ids
super().update_partner_data(partner, agents - product_restricted_agents)

0 comments on commit 823ecb1

Please sign in to comment.