-
-
Notifications
You must be signed in to change notification settings - Fork 246
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[9.0] sales_team_operating_unit #35
Merged
JordiBForgeFlow
merged 14 commits into
OCA:9.0
from
ForgeFlow:9.0-sales_team_operating_unit
Jan 23, 2017
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
75e0f82
[ADD] sales_team_operating_unit
JordiBForgeFlow 320a4ea
[FIX] add sales team as dependency of crm_operating_unit
JordiBForgeFlow 913d7e4
[FIX] Comments by @pedrobaeza. Check the team in the SO
AaronHForgeFlow 1a57ff5
[FIX] Travis issues
AaronHForgeFlow 3d46366
[FIX] It does not depend on sale
AaronHForgeFlow 831b91e
[FIX] Typo error
AaronHForgeFlow 8ca0549
[FIX] Sales team instance have to be created using registry
AaronHForgeFlow 6a0c556
[FIX] Travis + error in test_crm
AaronHForgeFlow d0ee4ea
[REV] crm_operating_unit is merged and this PR should not change it
AaronHForgeFlow 1c18486
[FIX] typo error in readme
AaronHForgeFlow da757c9
[FIX] crm_operating_unit depends on sales_team_operating_unit
AaronHForgeFlow b62e134
[IMP] Add test coverage
AaronHForgeFlow bba2ca6
[FIX] OU in the lead is related to the team
AaronHForgeFlow 51b5d05
[FIX] Improve test.
AaronHForgeFlow File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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 |
---|---|---|
@@ -1,6 +1,5 @@ | ||
# -*- coding: utf-8 -*- | ||
# © 2015 Eficent Business and IT Consulting Services S.L. - | ||
# Jordi Ballester Alomar | ||
# © 2015 Serpent Consulting Services Pvt. Ltd. - Sudhir Arya | ||
# © 2015 Eficent Business and IT Consulting Services S.L. | ||
# © 2015 Serpent Consulting Services Pvt. Ltd.a | ||
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). | ||
from . import models |
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
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 |
---|---|---|
@@ -1,6 +1,5 @@ | ||
# -*- coding: utf-8 -*- | ||
# © 2015 Eficent Business and IT Consulting Services S.L. - | ||
# Jordi Ballester Alomar | ||
# © 2015 Serpent Consulting Services Pvt. Ltd. - Sudhir Arya | ||
# © 2015 Eficent Business and IT Consulting Services S.L. | ||
# © 2015 Serpent Consulting Services Pvt. Ltd. | ||
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). | ||
from . import crm_lead |
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 |
---|---|---|
@@ -1,16 +1,23 @@ | ||
# -*- coding: utf-8 -*- | ||
# © 2015 Eficent Business and IT Consulting Services S.L. - | ||
# Jordi Ballester Alomar | ||
# © 2015 Serpent Consulting Services Pvt. Ltd. - Sudhir Arya | ||
# © 2015 Eficent Business and IT Consulting Services S.L. | ||
# © 2015 Serpent Consulting Services Pvt. Ltd. | ||
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). | ||
from openerp import fields, models | ||
from openerp import api, fields, models | ||
|
||
|
||
class CRMLead(models.Model): | ||
|
||
_inherit = 'crm.lead' | ||
|
||
@api.model | ||
def _get_default_operating_unit(self): | ||
team_id = self.env['crm.team']._get_default_team_id() | ||
team = self.env['crm.team'].sudo().browse(team_id) | ||
if team.operating_unit_id: | ||
return team.operating_unit_id | ||
else: | ||
return self.env['res.users'].operating_unit_default_get(self._uid) | ||
|
||
operating_unit_id = fields.Many2one('operating.unit', 'Operating Unit', | ||
default=lambda self: | ||
self.env['res.users']. | ||
operating_unit_default_get(self._uid)) | ||
related='team_id.operating_unit_id', | ||
default=_get_default_operating_unit) |
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 |
---|---|---|
@@ -1,6 +1,5 @@ | ||
# -*- coding: utf-8 -*- | ||
# © 2015 Eficent Business and IT Consulting Services S.L. - | ||
# Jordi Ballester Alomar | ||
# © 2015 Serpent Consulting Services Pvt. Ltd. - Sudhir Arya | ||
# © 2015 Eficent Business and IT Consulting Services S.L. | ||
# © 2015 Serpent Consulting Services Pvt. Ltd. | ||
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). | ||
from . import test_crm_operating_unit |
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
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,61 @@ | ||
.. image:: https://img.shields.io/badge/license-LGPLv3-blue.svg | ||
:target: https://www.gnu.org/licenses/lgpl.html | ||
:alt: License: LGPL-3 | ||
|
||
========================= | ||
Sales Team Operating Unit | ||
========================= | ||
|
||
This module introduces the following features: | ||
|
||
* Adds the Operating Unit (OU) to the Sales Team. | ||
|
||
* The user's default Operating Unit (OU) is proposed at the time of creating | ||
the Sales Team. | ||
|
||
* Security rules are defined to ensure that users can only see the Sales Team | ||
of that Operating Units in which they are allowed access to. | ||
|
||
|
||
Usage | ||
===== | ||
|
||
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas | ||
:alt: Try me on Runbot | ||
:target: https://runbot.odoo-community.org/runbot/213/9.0 | ||
|
||
Bug Tracker | ||
=========== | ||
|
||
Bugs are tracked on `GitHub Issues | ||
<https://github.com/OCA/operating-unit/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. | ||
|
||
Credits | ||
======= | ||
|
||
Images | ||
------ | ||
|
||
* Odoo Community Association: `Icon <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_. | ||
|
||
Contributors | ||
------------ | ||
|
||
* Jordi Ballester Alomar <jordi.ballester@eficent.com> | ||
|
||
Maintainer | ||
---------- | ||
|
||
.. image:: https://odoo-community.org/logo.png | ||
:alt: Odoo Community Association | ||
:target: https://odoo-community.org | ||
|
||
This module is maintained by the OCA. | ||
|
||
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. | ||
|
||
To contribute to this module, please visit https://odoo-community.org. |
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 -*- | ||
# © 2016 Eficent Business and IT Consulting Services S.L. | ||
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). | ||
|
||
from . import models |
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,20 @@ | ||
# -*- coding: utf-8 -*- | ||
# © 2016 Eficent Business and IT Consulting Services S.L. | ||
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). | ||
|
||
{ | ||
"name": "Sales Team Operating Unit", | ||
"version": "9.0.1.0.0", | ||
"author": "Eficent, " | ||
"Serpent Consulting Services Pvt. Ltd.," | ||
"Odoo Community Association (OCA)", | ||
"license": "LGPL-3", | ||
"website": "http://www.eficent.com", | ||
"category": "Sales", | ||
"depends": ["sales_team", "operating_unit"], | ||
"data": [ | ||
"views/crm_team_view.xml", | ||
"security/crm_security.xml", | ||
], | ||
'installable': 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 @@ | ||
# -*- coding: utf-8 -*- | ||
# © 2016 Eficent Business and IT Consulting Services S.L. | ||
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). | ||
|
||
from . import crm_team |
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,15 @@ | ||
# -*- coding: utf-8 -*- | ||
# © 2015 Eficent Business and IT Consulting Services S.L. | ||
# © 2015 Serpent Consulting Services Pvt. Ltd. | ||
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). | ||
from openerp import fields, models | ||
|
||
|
||
class CRMTeam(models.Model): | ||
|
||
_inherit = 'crm.team' | ||
|
||
operating_unit_id = fields.Many2one('operating.unit', 'Operating Unit', | ||
default=lambda self: | ||
self.env['res.users']. | ||
operating_unit_default_get(self._uid)) |
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,20 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- Copyright 2016 Eficent Business and IT Consulting Services S.L. | ||
License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl-3.0) --> | ||
<odoo> | ||
<data noupdate="0"> | ||
|
||
<record id="ir_rule_crm_team_allowed_operating_units" | ||
model="ir.rule"> | ||
<field name="model_id" ref="sales_team.model_crm_team"/> | ||
<field name="domain_force">['|',('operating_unit_id','=',False),('operating_unit_id','in',[g.id for g in user.operating_unit_ids])]</field> | ||
<field name="name">Sales Teams from allowed operating units</field> | ||
<field name="global" eval="True"/> | ||
<field eval="0" name="perm_unlink"/> | ||
<field eval="0" name="perm_write"/> | ||
<field eval="1" name="perm_read"/> | ||
<field eval="0" name="perm_create"/> | ||
</record> | ||
|
||
</data> | ||
</odoo> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 -*- | ||
# © 2016 Eficent Business and IT Consulting Services S.L. | ||
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). | ||
|
||
from . import test_crm_team_operating_unit |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can't add this code here, as there's no dependency to the other module. Do it in the proper module.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now, there's dependency. I think it's ok, isn't it?