-
-
Notifications
You must be signed in to change notification settings - Fork 354
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
775 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
=================================== | ||
Sales commissions - Geo assignation | ||
=================================== | ||
|
||
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! This file is generated by oca-gen-addon-readme !! | ||
!! changes will be overwritten. !! | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
.. |badge1| image:: https://img.shields.io/badge/maturity-Production%2FStable-green.png | ||
:target: https://odoo-community.org/page/development-status | ||
:alt: Production/Stable | ||
.. |badge2| image:: https://img.shields.io/badge/licence-LGPL--3-blue.png | ||
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html | ||
:alt: License: LGPL-3 | ||
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fcommission-lightgray.png?logo=github | ||
:target: https://github.com/OCA/commission/tree/10.0/sale_commission_geo_assign | ||
:alt: OCA/commission | ||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png | ||
:target: https://translation.odoo-community.org/projects/commission-10-0/commission-10-0-sale_commission_geo_assign | ||
:alt: Translate me on Weblate | ||
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png | ||
:target: https://runbot.odoo-community.org/runbot/165/10.0 | ||
:alt: Try me on Runbot | ||
|
||
|badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
||
Configure sales agents assigning them to a specific geographical area. | ||
|
||
Then, automatically assign agents to customers, according to their geographical area. | ||
|
||
**Table of contents** | ||
|
||
.. contents:: | ||
:local: | ||
|
||
Configuration | ||
============= | ||
|
||
Go to | ||
|
||
Sales > Commissions Management > Agents | ||
|
||
For every agent, you can set Countries, States or ZIP range | ||
|
||
Usage | ||
===== | ||
|
||
Go to | ||
|
||
Sales > Customers | ||
|
||
Select the customers you want to assign agents to and click | ||
|
||
Action > Geo assign agents | ||
|
||
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 smashing it by providing a detailed and welcomed | ||
`feedback <https://github.com/OCA/commission/issues/new?body=module:%20sale_commission_geo_assign%0Aversion:%2010.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 | ||
~~~~~~~ | ||
|
||
* Agile Business Group | ||
|
||
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-eLBati| image:: https://github.com/eLBati.png?size=40px | ||
:target: https://github.com/eLBati | ||
:alt: eLBati | ||
|
||
Current `maintainer <https://odoo-community.org/page/maintainer-role>`__: | ||
|
||
|maintainer-eLBati| | ||
|
||
This module is part of the `OCA/commission <https://github.com/OCA/commission/tree/10.0/sale_commission_geo_assign>`_ project on GitHub. | ||
|
||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# -*- coding: utf-8 -*- | ||
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). | ||
|
||
from . import models | ||
from . import wizard |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2018 Lorenzo Battistini <https://github.com/eLBati> | ||
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). | ||
|
||
{ | ||
"name": "Sales commissions - Geo assignation", | ||
"summary": "Assign agents to partners according to their location", | ||
"version": "10.0.1.0.0", | ||
"development_status": "Production/Stable", | ||
"category": "Sales Management", | ||
"website": "https://github.com/OCA/commission", | ||
"author": "Agile Business Group, Odoo Community Association (OCA)", | ||
"maintainers": ["eLBati"], | ||
"license": "LGPL-3", | ||
"application": False, | ||
"installable": True, | ||
"depends": [ | ||
"sale_commission", | ||
], | ||
"data": [ | ||
"views/res_partner_view.xml", | ||
"wizard/wizard_geo_assign_partner_view.xml", | ||
], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# -*- coding: utf-8 -*- | ||
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). | ||
|
||
from . import res_partner |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# -*- coding: utf-8 -*- | ||
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). | ||
|
||
from odoo import models, fields, api | ||
|
||
|
||
class Partner(models.Model): | ||
_inherit = 'res.partner' | ||
|
||
country_ids = fields.Many2many( | ||
'res.country', string='Countries', | ||
help='Countries where this agent operates' | ||
) | ||
state_ids = fields.Many2many( | ||
'res.country.state', string='States', | ||
help='States where this agent operates' | ||
) | ||
zip_from = fields.Char( | ||
'Zip From', help='ZIP range where this agent operates') | ||
zip_to = fields.Char( | ||
'Zip To', help='ZIP range where this agent operates') | ||
|
||
@api.onchange('country_ids') | ||
def onchange_countries(self): | ||
if self.country_ids: | ||
domain = [('country_id', 'in', self.country_ids.ids)] | ||
else: | ||
domain = [] | ||
return {'domain': { | ||
'state_ids': domain | ||
}} | ||
|
||
@api.multi | ||
def verify_agent(self, partner): | ||
self.ensure_one() | ||
if ( | ||
not self.country_ids and not self.state_ids and | ||
not self.zip_from and not self.zip_to | ||
): | ||
# if no criteria set on agent, agent is excluded | ||
return False | ||
if self.country_ids and partner.country_id not in self.country_ids: | ||
return False | ||
if self.state_ids and partner.state_id not in self.state_ids: | ||
return False | ||
if self.zip_from and ( | ||
partner.zip or '' | ||
).upper() < self.zip_from.upper(): | ||
return False | ||
if self.zip_to and ( | ||
partner.zip or '' | ||
).upper() > self.zip_to.upper(): | ||
return False | ||
return True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Go to | ||
|
||
Sales > Commissions Management > Agents | ||
|
||
For every agent, you can set Countries, States or ZIP range |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Configure sales agents assigning them to a specific geographical area. | ||
|
||
Then, automatically assign agents to customers, according to their geographical area. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Go to | ||
|
||
Sales > Customers | ||
|
||
Select the customers you want to assign agents to and click | ||
|
||
Action > Geo assign agents |
Oops, something went wrong.