From 5e0186bb3d9b64a36488eca05275f1272a10e116 Mon Sep 17 00:00:00 2001
From: SerpentCS
Date: Tue, 23 Aug 2016 13:57:56 +0530
Subject: [PATCH 01/26] [ADD] migrated crm-operating-unit to 9.0
---
crm_operating_unit/__init__.py | 6 ++
crm_operating_unit/__openerp__.py | 28 +++++++
crm_operating_unit/models/__init__.py | 6 ++
crm_operating_unit/models/crm_lead.py | 27 +++++++
crm_operating_unit/security/crm_security.xml | 18 +++++
crm_operating_unit/tests/__init__.py | 6 ++
.../tests/test_crm_operating_unit.py | 68 ++++++++++++++++
crm_operating_unit/views/crm_lead_view.xml | 78 +++++++++++++++++++
8 files changed, 237 insertions(+)
create mode 100644 crm_operating_unit/__init__.py
create mode 100644 crm_operating_unit/__openerp__.py
create mode 100644 crm_operating_unit/models/__init__.py
create mode 100644 crm_operating_unit/models/crm_lead.py
create mode 100644 crm_operating_unit/security/crm_security.xml
create mode 100644 crm_operating_unit/tests/__init__.py
create mode 100644 crm_operating_unit/tests/test_crm_operating_unit.py
create mode 100644 crm_operating_unit/views/crm_lead_view.xml
diff --git a/crm_operating_unit/__init__.py b/crm_operating_unit/__init__.py
new file mode 100644
index 0000000000..747d0698d4
--- /dev/null
+++ b/crm_operating_unit/__init__.py
@@ -0,0 +1,6 @@
+# -*- coding: utf-8 -*-
+# © 2015 Eficent Business and IT Consulting Services S.L. -
+# Jordi Ballester Alomar
+# © 2015 Serpent Consulting Services Pvt. Ltd. - Sudhir Arya
+# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
+from . import models
diff --git a/crm_operating_unit/__openerp__.py b/crm_operating_unit/__openerp__.py
new file mode 100644
index 0000000000..33f59bcbec
--- /dev/null
+++ b/crm_operating_unit/__openerp__.py
@@ -0,0 +1,28 @@
+# -*- coding: utf-8 -*-
+# © 2015 Eficent Business and IT Consulting Services S.L. -
+# Jordi Ballester Alomar
+# © 2015 Serpent Consulting Services Pvt. Ltd. - Sudhir Arya
+# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
+
+{
+ "name": "Operating Unit in CRM",
+ "version": "9.0.1.0.0",
+ "author": "Eficent Business and IT Consulting Services S.L., "
+ "Serpent Consulting Services Pvt. Ltd.,"
+ "Odoo Community Association (OCA)",
+ "license": "LGPL-3",
+ "website": "http://www.eficent.com",
+ "category": "Purchase Management",
+ "depends": ["crm", "operating_unit"],
+ "description": """
+Operating Unit in CRM
+=====================
+This module introduces the operating unit to CRM
+ """,
+ "data": [
+ "views/crm_lead_view.xml",
+ "security/crm_security.xml",
+ ],
+ 'installable': True,
+ 'active': False,
+}
diff --git a/crm_operating_unit/models/__init__.py b/crm_operating_unit/models/__init__.py
new file mode 100644
index 0000000000..ee8df19d0f
--- /dev/null
+++ b/crm_operating_unit/models/__init__.py
@@ -0,0 +1,6 @@
+# -*- coding: utf-8 -*-
+# © 2015 Eficent Business and IT Consulting Services S.L. -
+# Jordi Ballester Alomar
+# © 2015 Serpent Consulting Services Pvt. Ltd. - Sudhir Arya
+# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
+from . import crm_lead
diff --git a/crm_operating_unit/models/crm_lead.py b/crm_operating_unit/models/crm_lead.py
new file mode 100644
index 0000000000..69daf1ba4d
--- /dev/null
+++ b/crm_operating_unit/models/crm_lead.py
@@ -0,0 +1,27 @@
+# -*- coding: utf-8 -*-
+# © 2015 Eficent Business and IT Consulting Services S.L. -
+# Jordi Ballester Alomar
+# © 2015 Serpent Consulting Services Pvt. Ltd. - Sudhir Arya
+# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
+from openerp import api, fields, models
+from openerp.exceptions import Warning
+from openerp.tools.translate import _
+
+
+class CRMLead(models.Model):
+
+ _inherit = 'crm.lead'
+
+ operating_unit_id = fields.Many2one('operating.unit', 'Operating Unit',
+ default=lambda self:
+ self.env['res.users'].
+ operating_unit_default_get(self._uid))
+
+ @api.one
+ @api.constrains('operating_unit_id', 'company_id')
+ def _check_company_operating_unit(self):
+ if self.company_id and \
+ self.operating_unit_id and \
+ self.company_id != self.operating_unit_id.company_id:
+ raise Warning(_('Configuration error!\nThe Company in the\
+ CRM Lead and in the Operating Unit must be the same.'))
diff --git a/crm_operating_unit/security/crm_security.xml b/crm_operating_unit/security/crm_security.xml
new file mode 100644
index 0000000000..770ee5d6a2
--- /dev/null
+++ b/crm_operating_unit/security/crm_security.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+ ['|',('operating_unit_id','=',False),('operating_unit_id','in',[g.id for g in user.operating_unit_ids])]
+ Leads from allowed operating units
+
+
+
+
+
+
+
+
+
diff --git a/crm_operating_unit/tests/__init__.py b/crm_operating_unit/tests/__init__.py
new file mode 100644
index 0000000000..15a077129b
--- /dev/null
+++ b/crm_operating_unit/tests/__init__.py
@@ -0,0 +1,6 @@
+# -*- coding: utf-8 -*-
+# © 2015 Eficent Business and IT Consulting Services S.L. -
+# Jordi Ballester Alomar
+# © 2015 Serpent Consulting Services Pvt. Ltd. - Sudhir Arya
+# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
+from . import test_crm_operating_unit
diff --git a/crm_operating_unit/tests/test_crm_operating_unit.py b/crm_operating_unit/tests/test_crm_operating_unit.py
new file mode 100644
index 0000000000..686c53b689
--- /dev/null
+++ b/crm_operating_unit/tests/test_crm_operating_unit.py
@@ -0,0 +1,68 @@
+# -*- coding: utf-8 -*-
+# © 2015 Eficent Business and IT Consulting Services S.L. -
+# Jordi Ballester Alomar
+# © 2015 Serpent Consulting Services Pvt. Ltd. - Sudhir Arya
+# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
+from openerp.tests import common
+
+
+class TestPurchaseOperatingUnit(common.TransactionCase):
+
+ def setUp(self):
+ super(TestPurchaseOperatingUnit, self).setUp()
+ self.res_users_model = self.env['res.users']
+ self.crm_lead_model = self.env['crm.lead']
+ # Groups
+ self.grp_sale_mngr = self.env.ref('base.group_sale_manager')
+ self.grp_user = self.env.ref('base.group_user')
+ # Company
+ self.company = self.env.ref('base.main_company')
+ # Main Operating Unit
+ self.ou1 = self.env.ref('operating_unit.main_operating_unit')
+ # B2C Operating Unit
+ self.b2c = self.env.ref('operating_unit.b2c_operating_unit')
+ # Create User 1 with Main OU
+ self.user1 = self._create_user('user_1', [self.grp_sale_mngr,
+ self.grp_user], self.company,
+ [self.ou1])
+ # Create User 2 with B2C OU
+ self.user2 = self._create_user('user_2', [self.grp_sale_mngr,
+ self.grp_user], self.company,
+ [self.b2c])
+ # Create CRM Leads
+ self.lead1 = self._create_crm_lead(self.user1.id, self.ou1)
+ self.lead2 = self._create_crm_lead(self.user2.id, self.b2c)
+
+ def _create_user(self, login, groups, company, operating_units,
+ context=None):
+ """ Create a user. """
+ group_ids = [group.id for group in groups]
+ user = self.res_users_model.create({
+ 'name': 'Test User',
+ 'login': login,
+ 'password': 'demo',
+ 'email': 'test@yourcompany.com',
+ 'company_id': company.id,
+ 'company_ids': [(4, company.id)],
+ 'operating_unit_ids': [(4, ou.id) for ou in operating_units],
+ 'groups_id': [(6, 0, group_ids)]
+ })
+ return user
+
+ def _create_crm_lead(self, uid, operating_unit):
+ """Create a sale order."""
+ crm = self.crm_lead_model.create({
+ 'name': 'CRM LEAD',
+ 'operating_unit_id': operating_unit.id,
+ })
+ return crm
+
+ def test_crm_lead(self):
+ # User 2 is only assigned to B2C Operating Unit, and cannot
+ # access CRM leads for Main Operating Unit.
+
+ lead = self.crm_lead_model.sudo(self.user2.id).\
+ search([('id', '=', self.lead1.id),
+ ('operating_unit_id', '=', self.ou1.id)])
+ self.assertEqual(lead.ids, [], 'User 2 should not have access to '
+ 'OU %s' % self.ou1.name)
diff --git a/crm_operating_unit/views/crm_lead_view.xml b/crm_operating_unit/views/crm_lead_view.xml
new file mode 100644
index 0000000000..adc77c5a62
--- /dev/null
+++ b/crm_operating_unit/views/crm_lead_view.xml
@@ -0,0 +1,78 @@
+
+
+
+
+
+
+ CRM - Leads Form
+ crm.lead
+
+
+
+
+
+
+
+
+
+
+ Leads
+ crm.lead
+
+
+
+
+
+
+
+
+
+
+ CRM - Leads Search
+ crm.lead
+
+
+
+
+
+
+
+
+
+
+ Opportunities
+ crm.lead
+
+
+
+
+
+
+
+
+
+
+ Opportunities Tree
+ crm.lead
+
+
+
+
+
+
+
+
+
+
+ CRM - Opportunities Search
+ crm.lead
+
+
+
+
+
+
+
+
+
+
From 3638947094422299d7ab05717bbd00515d2fb6c8 Mon Sep 17 00:00:00 2001
From: SerpentCS
Date: Mon, 29 Aug 2016 18:08:40 +0530
Subject: [PATCH 02/26] [ADD] added Readme file and minor fixes
---
crm_operating_unit/README.rst | 70 ++++++++++++++++++
crm_operating_unit/__openerp__.py | 7 +-
.../static/description/icon.png | Bin 0 -> 9455 bytes
3 files changed, 71 insertions(+), 6 deletions(-)
create mode 100644 crm_operating_unit/README.rst
create mode 100644 crm_operating_unit/static/description/icon.png
diff --git a/crm_operating_unit/README.rst b/crm_operating_unit/README.rst
new file mode 100644
index 0000000000..7a29e71dee
--- /dev/null
+++ b/crm_operating_unit/README.rst
@@ -0,0 +1,70 @@
+.. image:: https://img.shields.io/badge/license-LGPLv3-blue.svg
+ :target: https://www.gnu.org/licenses/lgpl.html
+ :alt: License: LGPL-3
+
+=========================
+CRM with Operating Units
+=========================
+
+This module introduces the following features:
+
+* Adds the Operating Unit (OU) to the Lead.
+
+* The user’s default Operating Unit (OU) is proposed at the time of creating the Lead / Opportunity.
+
+* Security rules are defined to ensure that users can only see the Opportunity / Lead of that Operating Units in which they are allowed access to.
+
+
+Installation
+============
+
+No specific installation requirements.
+
+Configuration
+=============
+
+No configuration is required.
+
+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
+`_. 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 `_.
+
+Contributors
+------------
+
+* Eficent Business and IT Consulting Services S.L.
+* Serpent Consulting Services Pvt. Ltd.
+
+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.
diff --git a/crm_operating_unit/__openerp__.py b/crm_operating_unit/__openerp__.py
index 33f59bcbec..4e74b4fa3c 100644
--- a/crm_operating_unit/__openerp__.py
+++ b/crm_operating_unit/__openerp__.py
@@ -12,13 +12,8 @@
"Odoo Community Association (OCA)",
"license": "LGPL-3",
"website": "http://www.eficent.com",
- "category": "Purchase Management",
+ "category": "Sales",
"depends": ["crm", "operating_unit"],
- "description": """
-Operating Unit in CRM
-=====================
-This module introduces the operating unit to CRM
- """,
"data": [
"views/crm_lead_view.xml",
"security/crm_security.xml",
diff --git a/crm_operating_unit/static/description/icon.png b/crm_operating_unit/static/description/icon.png
new file mode 100644
index 0000000000000000000000000000000000000000..3a0328b516c4980e8e44cdb63fd945757ddd132d
GIT binary patch
literal 9455
zcmW++2RxMjAAjx~&dlBk9S+%}OXg)AGE&Cb*&}d0jUxM@u(PQx^-s)697TX`ehR4?GS^qbkof1cslKgkU)h65qZ9Oc=ml_0temigYLJfnz{IDzUf>bGs4N!v3=Z3jMq&A#7%rM5eQ#dc?k~!
zVpnB`o+K7|Al`Q_U;eD$B
zfJtP*jH`siUq~{KE)`jP2|#TUEFGRryE2`i0**z#*^6~AI|YzIWy$Cu#CSLW3q=GA
z6`?GZymC;dCPk~rBS%eCb`5OLr;RUZ;D`}um=H)BfVIq%7VhiMr)_#G0N#zrNH|__
zc+blN2UAB0=617@>_u;MPHN;P;N#YoE=)R#i$k_`UAA>WWCcEVMh~L_
zj--gtp&|K1#58Yz*AHCTMziU1Jzt_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+%Rv;b?B??gSzdp?6Uug9{
zd@V08Z$BdI?fpoCS$)t4mg4rT8Q_I}h`0d-vYZ^|dOB*Q^S|xqTV*vIg?@fVFSmMpaw0qtTRbx}
z({Pg?#{2`sc9)M5N$*N|4;^t$+QP?#mov
zGVC@I*lBVrOU-%2y!7%)fAKjpEFsgQc4{amtiHb95KQEwvf<(3T<9-Zm$xIew#P22
zc2Ix|App^>v6(3L_MCU0d3W##AB0M~3D00EWoKZqsJYT(#@w$Y_H7G22M~ApVFTRHMI_3be)Lkn#0F*V8Pq
zc}`Cjy$bE;FJ6H7p=0y#R>`}-m4(0F>%@P|?7fx{=R^uFdISRnZ2W_xQhD{YuR3t<
z{6yxu=4~JkeA;|(J6_nv#>Nvs&FuLA&PW^he@t(UwFFE8)|a!R{`E`K`i^ZnyE4$k
z;(749Ix|oi$c3QbEJ3b~D_kQsPz~fIUKym($a_7dJ?o+40*OLl^{=&oq$<#Q(yyrp
z{J-FAniyAw9tPbe&IhQ|a`DqFTVQGQ&Gq3!C2==4x{6EJwiPZ8zub-iXoUtkJiG{}
zPaR&}_fn8_z~(=;5lD-aPWD3z8PZS@AaUiomF!G8I}Mf>e~0g#BelA-5#`cj;O5>N
Xviia!U7SGha1wx#SCgwmn*{w2TRX*I
literal 0
HcmV?d00001
From a1e054be6cd79e0171539dda35640439c396a8c1 Mon Sep 17 00:00:00 2001
From: SerpentCS
Date: Wed, 14 Sep 2016 18:33:52 +0530
Subject: [PATCH 03/26] [IMP] Added Copyrights in xml files and made minor
changes.
---
crm_operating_unit/__openerp__.py | 1 -
crm_operating_unit/security/crm_security.xml | 3 +++
crm_operating_unit/tests/test_crm_operating_unit.py | 4 ++--
crm_operating_unit/views/crm_lead_view.xml | 7 +++++--
4 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/crm_operating_unit/__openerp__.py b/crm_operating_unit/__openerp__.py
index 4e74b4fa3c..332001e033 100644
--- a/crm_operating_unit/__openerp__.py
+++ b/crm_operating_unit/__openerp__.py
@@ -19,5 +19,4 @@
"security/crm_security.xml",
],
'installable': True,
- 'active': False,
}
diff --git a/crm_operating_unit/security/crm_security.xml b/crm_operating_unit/security/crm_security.xml
index 770ee5d6a2..8ed0a55aac 100644
--- a/crm_operating_unit/security/crm_security.xml
+++ b/crm_operating_unit/security/crm_security.xml
@@ -1,4 +1,7 @@
+
diff --git a/crm_operating_unit/tests/test_crm_operating_unit.py b/crm_operating_unit/tests/test_crm_operating_unit.py
index 686c53b689..e82929c141 100644
--- a/crm_operating_unit/tests/test_crm_operating_unit.py
+++ b/crm_operating_unit/tests/test_crm_operating_unit.py
@@ -51,7 +51,7 @@ def _create_user(self, login, groups, company, operating_units,
def _create_crm_lead(self, uid, operating_unit):
"""Create a sale order."""
- crm = self.crm_lead_model.create({
+ crm = self.crm_lead_model.sudo(uid).create({
'name': 'CRM LEAD',
'operating_unit_id': operating_unit.id,
})
@@ -65,4 +65,4 @@ def test_crm_lead(self):
search([('id', '=', self.lead1.id),
('operating_unit_id', '=', self.ou1.id)])
self.assertEqual(lead.ids, [], 'User 2 should not have access to '
- 'OU %s' % self.ou1.name)
+ '%s' % self.ou1.name)
diff --git a/crm_operating_unit/views/crm_lead_view.xml b/crm_operating_unit/views/crm_lead_view.xml
index adc77c5a62..e5df1da8d4 100644
--- a/crm_operating_unit/views/crm_lead_view.xml
+++ b/crm_operating_unit/views/crm_lead_view.xml
@@ -1,4 +1,7 @@
+
@@ -9,7 +12,7 @@
-
+
@@ -45,7 +48,7 @@
-
+
From 8897d8ed951aa767024aba163fce3529e1372400 Mon Sep 17 00:00:00 2001
From: ahenriquez
Date: Thu, 15 Sep 2016 09:47:47 +0200
Subject: [PATCH 04/26] [IMP]Style issues and change field position in view
---
crm_operating_unit/README.rst | 10 ----------
crm_operating_unit/security/crm_security.xml | 4 ++--
crm_operating_unit/views/crm_lead_view.xml | 2 +-
3 files changed, 3 insertions(+), 13 deletions(-)
diff --git a/crm_operating_unit/README.rst b/crm_operating_unit/README.rst
index 7a29e71dee..21b2929d6e 100644
--- a/crm_operating_unit/README.rst
+++ b/crm_operating_unit/README.rst
@@ -15,16 +15,6 @@ This module introduces the following features:
* Security rules are defined to ensure that users can only see the Opportunity / Lead of that Operating Units in which they are allowed access to.
-Installation
-============
-
-No specific installation requirements.
-
-Configuration
-=============
-
-No configuration is required.
-
Usage
=====
diff --git a/crm_operating_unit/security/crm_security.xml b/crm_operating_unit/security/crm_security.xml
index 8ed0a55aac..803e3e7276 100644
--- a/crm_operating_unit/security/crm_security.xml
+++ b/crm_operating_unit/security/crm_security.xml
@@ -2,7 +2,7 @@
-
+
-
+
diff --git a/crm_operating_unit/views/crm_lead_view.xml b/crm_operating_unit/views/crm_lead_view.xml
index e5df1da8d4..72f89f945e 100644
--- a/crm_operating_unit/views/crm_lead_view.xml
+++ b/crm_operating_unit/views/crm_lead_view.xml
@@ -11,7 +11,7 @@
crm.lead
-
+
From 397cf24e8afb0c356f50822e681c54a2d8b91e9e Mon Sep 17 00:00:00 2001
From: ahenriquez
Date: Thu, 15 Sep 2016 12:30:00 +0200
Subject: [PATCH 05/26] [IMP] added domain to see only OUs form that company.
---
crm_operating_unit/models/crm_lead.py | 9 ---------
crm_operating_unit/views/crm_lead_view.xml | 2 +-
2 files changed, 1 insertion(+), 10 deletions(-)
diff --git a/crm_operating_unit/models/crm_lead.py b/crm_operating_unit/models/crm_lead.py
index 69daf1ba4d..0530d2e3bb 100644
--- a/crm_operating_unit/models/crm_lead.py
+++ b/crm_operating_unit/models/crm_lead.py
@@ -16,12 +16,3 @@ class CRMLead(models.Model):
default=lambda self:
self.env['res.users'].
operating_unit_default_get(self._uid))
-
- @api.one
- @api.constrains('operating_unit_id', 'company_id')
- def _check_company_operating_unit(self):
- if self.company_id and \
- self.operating_unit_id and \
- self.company_id != self.operating_unit_id.company_id:
- raise Warning(_('Configuration error!\nThe Company in the\
- CRM Lead and in the Operating Unit must be the same.'))
diff --git a/crm_operating_unit/views/crm_lead_view.xml b/crm_operating_unit/views/crm_lead_view.xml
index 72f89f945e..a4c3a4ecfe 100644
--- a/crm_operating_unit/views/crm_lead_view.xml
+++ b/crm_operating_unit/views/crm_lead_view.xml
@@ -12,7 +12,7 @@
-
+
From 9d04a93917bd47e51109fc38944cf8a4600342d2 Mon Sep 17 00:00:00 2001
From: ahenriquez
Date: Thu, 15 Sep 2016 13:19:58 +0200
Subject: [PATCH 06/26] [FIX] PEP8 issues
---
crm_operating_unit/models/crm_lead.py | 4 +---
crm_operating_unit/tests/test_crm_operating_unit.py | 6 +++---
2 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/crm_operating_unit/models/crm_lead.py b/crm_operating_unit/models/crm_lead.py
index 0530d2e3bb..a59cb52232 100644
--- a/crm_operating_unit/models/crm_lead.py
+++ b/crm_operating_unit/models/crm_lead.py
@@ -3,9 +3,7 @@
# Jordi Ballester Alomar
# © 2015 Serpent Consulting Services Pvt. Ltd. - Sudhir Arya
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
-from openerp import api, fields, models
-from openerp.exceptions import Warning
-from openerp.tools.translate import _
+from openerp import fields, models
class CRMLead(models.Model):
diff --git a/crm_operating_unit/tests/test_crm_operating_unit.py b/crm_operating_unit/tests/test_crm_operating_unit.py
index e82929c141..88f9accb5c 100644
--- a/crm_operating_unit/tests/test_crm_operating_unit.py
+++ b/crm_operating_unit/tests/test_crm_operating_unit.py
@@ -61,8 +61,8 @@ def test_crm_lead(self):
# User 2 is only assigned to B2C Operating Unit, and cannot
# access CRM leads for Main Operating Unit.
- lead = self.crm_lead_model.sudo(self.user2.id).\
- search([('id', '=', self.lead1.id),
- ('operating_unit_id', '=', self.ou1.id)])
+ lead = self.crm_lead_model.sudo(self.user2.id).search(
+ [('id', '=', self.lead1.id),
+ ('operating_unit_id', '=', self.ou1.id)])
self.assertEqual(lead.ids, [], 'User 2 should not have access to '
'%s' % self.ou1.name)
From 05e2c8e52a45d97fa997d12fe961bea5da8b3dcb Mon Sep 17 00:00:00 2001
From: "Pedro M. Baeza"
Date: Thu, 6 Oct 2016 16:04:30 +0200
Subject: [PATCH 07/26] [MIG] Make modules uninstallable
---
crm_operating_unit/__openerp__.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/crm_operating_unit/__openerp__.py b/crm_operating_unit/__openerp__.py
index 332001e033..9c46b6d446 100644
--- a/crm_operating_unit/__openerp__.py
+++ b/crm_operating_unit/__openerp__.py
@@ -18,5 +18,5 @@
"views/crm_lead_view.xml",
"security/crm_security.xml",
],
- 'installable': True,
+ 'installable': False,
}
From 739efb9f889470aed5b82e45bcd1e6004af215d1 Mon Sep 17 00:00:00 2001
From: "Pedro M. Baeza"
Date: Thu, 6 Oct 2016 16:04:31 +0200
Subject: [PATCH 08/26] [MIG] Rename manifest files
---
crm_operating_unit/{__openerp__.py => __manifest__.py} | 0
1 file changed, 0 insertions(+), 0 deletions(-)
rename crm_operating_unit/{__openerp__.py => __manifest__.py} (100%)
diff --git a/crm_operating_unit/__openerp__.py b/crm_operating_unit/__manifest__.py
similarity index 100%
rename from crm_operating_unit/__openerp__.py
rename to crm_operating_unit/__manifest__.py
From dabe94791dd99a66ef5e1e2df3e54fd2052cb581 Mon Sep 17 00:00:00 2001
From: lreficent
Date: Thu, 26 Jan 2017 14:25:54 +0100
Subject: [PATCH 09/26] [MIG] crm_operating_unit to v10.0
various fixes
---
crm_operating_unit/README.rst | 2 +-
crm_operating_unit/__init__.py | 4 +-
crm_operating_unit/__manifest__.py | 14 ++--
crm_operating_unit/models/__init__.py | 4 +-
crm_operating_unit/models/crm_lead.py | 19 ++++--
crm_operating_unit/security/crm_security.xml | 28 ++++----
crm_operating_unit/tests/__init__.py | 4 +-
.../tests/test_crm_operating_unit.py | 67 +++++++++++++------
8 files changed, 85 insertions(+), 57 deletions(-)
diff --git a/crm_operating_unit/README.rst b/crm_operating_unit/README.rst
index 21b2929d6e..af2be58398 100644
--- a/crm_operating_unit/README.rst
+++ b/crm_operating_unit/README.rst
@@ -20,7 +20,7 @@ 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
+ :target: https://runbot.odoo-community.org/runbot/213/10.0
Bug Tracker
===========
diff --git a/crm_operating_unit/__init__.py b/crm_operating_unit/__init__.py
index 747d0698d4..2ac09aec86 100644
--- a/crm_operating_unit/__init__.py
+++ b/crm_operating_unit/__init__.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# © 2015 Eficent Business and IT Consulting Services S.L. -
+# © 2015-17 Eficent Business and IT Consulting Services S.L. -
# Jordi Ballester Alomar
-# © 2015 Serpent Consulting Services Pvt. Ltd. - Sudhir Arya
+# © 2015-17 Serpent Consulting Services Pvt. Ltd. - Sudhir Arya
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
from . import models
diff --git a/crm_operating_unit/__manifest__.py b/crm_operating_unit/__manifest__.py
index 9c46b6d446..b148da91fe 100644
--- a/crm_operating_unit/__manifest__.py
+++ b/crm_operating_unit/__manifest__.py
@@ -1,22 +1,22 @@
# -*- coding: utf-8 -*-
-# © 2015 Eficent Business and IT Consulting Services S.L. -
+# © 2015-17 Eficent Business and IT Consulting Services S.L. -
# Jordi Ballester Alomar
-# © 2015 Serpent Consulting Services Pvt. Ltd. - Sudhir Arya
+# © 2015-17 Serpent Consulting Services Pvt. Ltd. - Sudhir Arya
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
{
"name": "Operating Unit in CRM",
- "version": "9.0.1.0.0",
- "author": "Eficent Business and IT Consulting Services S.L., "
+ "version": "10.0.1.0.0",
+ "author": "Eficent, "
"Serpent Consulting Services Pvt. Ltd.,"
"Odoo Community Association (OCA)",
"license": "LGPL-3",
- "website": "http://www.eficent.com",
+ "website": "https://github.com/OCA/operating-unit",
"category": "Sales",
- "depends": ["crm", "operating_unit"],
+ "depends": ["crm", "sales_team_operating_unit"],
"data": [
"views/crm_lead_view.xml",
"security/crm_security.xml",
],
- 'installable': False,
+ 'installable': True,
}
diff --git a/crm_operating_unit/models/__init__.py b/crm_operating_unit/models/__init__.py
index ee8df19d0f..3fd9f5d911 100644
--- a/crm_operating_unit/models/__init__.py
+++ b/crm_operating_unit/models/__init__.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# © 2015 Eficent Business and IT Consulting Services S.L. -
+# © 2015-17 Eficent Business and IT Consulting Services S.L. -
# Jordi Ballester Alomar
-# © 2015 Serpent Consulting Services Pvt. Ltd. - Sudhir Arya
+# © 2015-17 Serpent Consulting Services Pvt. Ltd. - Sudhir Arya
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
from . import crm_lead
diff --git a/crm_operating_unit/models/crm_lead.py b/crm_operating_unit/models/crm_lead.py
index a59cb52232..4fb0913280 100644
--- a/crm_operating_unit/models/crm_lead.py
+++ b/crm_operating_unit/models/crm_lead.py
@@ -1,16 +1,23 @@
# -*- coding: utf-8 -*-
-# © 2015 Eficent Business and IT Consulting Services S.L. -
+# © 2015-17 Eficent Business and IT Consulting Services S.L. -
# Jordi Ballester Alomar
-# © 2015 Serpent Consulting Services Pvt. Ltd. - Sudhir Arya
+# © 2015-17 Serpent Consulting Services Pvt. Ltd. - Sudhir Arya
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
-from openerp import fields, models
+from odoo import api, fields, models
class CRMLead(models.Model):
_inherit = 'crm.lead'
+ @api.model
+ def _get_default_operating_unit(self):
+ team = self.env['crm.team']._get_default_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)
diff --git a/crm_operating_unit/security/crm_security.xml b/crm_operating_unit/security/crm_security.xml
index 803e3e7276..d9f9d365f1 100644
--- a/crm_operating_unit/security/crm_security.xml
+++ b/crm_operating_unit/security/crm_security.xml
@@ -1,21 +1,19 @@
-
-
-
+
-
-
- ['|',('operating_unit_id','=',False),('operating_unit_id','in',[g.id for g in user.operating_unit_ids])]
- Leads from allowed operating units
-
-
-
-
-
-
+
+
+ ['|',('operating_unit_id','=',False),('operating_unit_id','in',[g.id for g in user.operating_unit_ids])]
+ Leads from allowed operating units
+
+
+
+
+
+
-
diff --git a/crm_operating_unit/tests/__init__.py b/crm_operating_unit/tests/__init__.py
index 15a077129b..7691600421 100644
--- a/crm_operating_unit/tests/__init__.py
+++ b/crm_operating_unit/tests/__init__.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# © 2015 Eficent Business and IT Consulting Services S.L. -
+# © 2015-17 Eficent Business and IT Consulting Services S.L. -
# Jordi Ballester Alomar
-# © 2015 Serpent Consulting Services Pvt. Ltd. - Sudhir Arya
+# © 2015-17 Serpent Consulting Services Pvt. Ltd. - Sudhir Arya
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
from . import test_crm_operating_unit
diff --git a/crm_operating_unit/tests/test_crm_operating_unit.py b/crm_operating_unit/tests/test_crm_operating_unit.py
index 88f9accb5c..75d6438eec 100644
--- a/crm_operating_unit/tests/test_crm_operating_unit.py
+++ b/crm_operating_unit/tests/test_crm_operating_unit.py
@@ -1,44 +1,48 @@
# -*- coding: utf-8 -*-
-# © 2015 Eficent Business and IT Consulting Services S.L. -
+# © 2015-17 Eficent Business and IT Consulting Services S.L. -
# Jordi Ballester Alomar
-# © 2015 Serpent Consulting Services Pvt. Ltd. - Sudhir Arya
+# © 2015-17 Serpent Consulting Services Pvt. Ltd. - Sudhir Arya
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
-from openerp.tests import common
+from odoo.tests import common
-class TestPurchaseOperatingUnit(common.TransactionCase):
+class TestCrmOperatingUnit(common.TransactionCase):
def setUp(self):
- super(TestPurchaseOperatingUnit, self).setUp()
+ super(TestCrmOperatingUnit, self).setUp()
self.res_users_model = self.env['res.users']
self.crm_lead_model = self.env['crm.lead']
+ self.crm_team_model = self.env['crm.team']
# Groups
- self.grp_sale_mngr = self.env.ref('base.group_sale_manager')
+ self.grp_sale_mngr = self.env.ref('sales_team.group_sale_manager')
self.grp_user = self.env.ref('base.group_user')
# Company
self.company = self.env.ref('base.main_company')
# Main Operating Unit
- self.ou1 = self.env.ref('operating_unit.main_operating_unit')
+ self.main_OU = self.env.ref('operating_unit.main_operating_unit')
# B2C Operating Unit
- self.b2c = self.env.ref('operating_unit.b2c_operating_unit')
+ self.b2c_OU = self.env.ref('operating_unit.b2c_operating_unit')
# Create User 1 with Main OU
self.user1 = self._create_user('user_1', [self.grp_sale_mngr,
- self.grp_user], self.company,
- [self.ou1])
+ self.grp_user],
+ self.company, [self.main_OU])
# Create User 2 with B2C OU
self.user2 = self._create_user('user_2', [self.grp_sale_mngr,
- self.grp_user], self.company,
- [self.b2c])
+ self.grp_user],
+ self.company, [self.b2c_OU])
+
+ self.team1 = self._create_crm_team(self.user1.id, self.main_OU)
+ self.team2 = self._create_crm_team(self.user2.id, self.b2c_OU)
+
# Create CRM Leads
- self.lead1 = self._create_crm_lead(self.user1.id, self.ou1)
- self.lead2 = self._create_crm_lead(self.user2.id, self.b2c)
+ self.lead1 = self._create_crm_lead(self.user1.id, self.team1)
+ self.lead2 = self._create_crm_lead(self.user2.id, self.team2)
- def _create_user(self, login, groups, company, operating_units,
- context=None):
+ def _create_user(self, login, groups, company, operating_units):
""" Create a user. """
group_ids = [group.id for group in groups]
user = self.res_users_model.create({
- 'name': 'Test User',
+ 'name': login,
'login': login,
'password': 'demo',
'email': 'test@yourcompany.com',
@@ -49,11 +53,24 @@ def _create_user(self, login, groups, company, operating_units,
})
return user
- def _create_crm_lead(self, uid, operating_unit):
+ def _create_crm_team(self, uid, operating_unit):
+ """Create a sale order."""
+ crm = self.crm_team_model.with_context(
+ {'mail_create_nosubscribe': True,
+ 'mail_create_nolog': True}).create(
+ {'name': 'CRM team', 'operating_unit_id': operating_unit.id,
+ 'user_id': uid})
+ return crm
+
+ def _create_crm_lead(self, uid, team):
"""Create a sale order."""
- crm = self.crm_lead_model.sudo(uid).create({
+ operating_unit_id = self.crm_lead_model.sudo(uid).\
+ _get_default_operating_unit()
+ crm = self.crm_lead_model.create({
'name': 'CRM LEAD',
- 'operating_unit_id': operating_unit.id,
+ 'user_id': uid,
+ 'operating_unit_id': operating_unit_id.id,
+ 'team_id': team.id
})
return crm
@@ -63,6 +80,12 @@ def test_crm_lead(self):
lead = self.crm_lead_model.sudo(self.user2.id).search(
[('id', '=', self.lead1.id),
- ('operating_unit_id', '=', self.ou1.id)])
+ ('operating_unit_id', '=', self.main_OU.id)])
self.assertEqual(lead.ids, [], 'User 2 should not have access to '
- '%s' % self.ou1.name)
+ '%s' % self.main_OU.name)
+
+ def test_team_ou(self):
+ new_lead = self._create_crm_lead(self.user2.id, self.team2)
+ self.assertEqual(
+ new_lead.operating_unit_id, self.b2c_OU,
+ 'User 2 lead should have %s as operating unit' % self.b2c_OU.name)
From 2ce9ba7fb7e121ef43de7c54961e9b995d02a068 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Adri=C3=A0=20Gil=20Sorribes?=
Date: Tue, 22 Jan 2019 09:15:52 +0100
Subject: [PATCH 10/26] [MIG] Migrate crm_operating_unit to v12
---
crm_operating_unit/README.rst | 73 +--
crm_operating_unit/__init__.py | 5 +-
crm_operating_unit/__manifest__.py | 5 +-
.../i18n/crm_operating_unit.pot | 25 +
crm_operating_unit/models/__init__.py | 5 +-
crm_operating_unit/models/crm_lead.py | 6 +-
crm_operating_unit/readme/CONTRIBUTORS.rst | 2 +
crm_operating_unit/readme/DESCRIPTION.rst | 7 +
crm_operating_unit/readme/USAGE.rst | 0
crm_operating_unit/security/crm_security.xml | 4 +-
.../static/description/index.html | 426 ++++++++++++++++++
crm_operating_unit/tests/__init__.py | 5 +-
.../tests/test_crm_operating_unit.py | 3 +-
crm_operating_unit/views/crm_lead_view.xml | 28 +-
14 files changed, 533 insertions(+), 61 deletions(-)
create mode 100644 crm_operating_unit/i18n/crm_operating_unit.pot
create mode 100644 crm_operating_unit/readme/CONTRIBUTORS.rst
create mode 100644 crm_operating_unit/readme/DESCRIPTION.rst
create mode 100644 crm_operating_unit/readme/USAGE.rst
create mode 100644 crm_operating_unit/static/description/index.html
diff --git a/crm_operating_unit/README.rst b/crm_operating_unit/README.rst
index af2be58398..e2981de944 100644
--- a/crm_operating_unit/README.rst
+++ b/crm_operating_unit/README.rst
@@ -1,10 +1,29 @@
-.. image:: https://img.shields.io/badge/license-LGPLv3-blue.svg
- :target: https://www.gnu.org/licenses/lgpl.html
- :alt: License: LGPL-3
-
-=========================
-CRM with Operating Units
-=========================
+=====================
+Operating Unit in CRM
+=====================
+
+.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ !! This file is generated by oca-gen-addon-readme !!
+ !! changes will be overwritten. !!
+ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+.. |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-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%2Foperating--unit-lightgray.png?logo=github
+ :target: https://github.com/OCA/operating-unit/tree/12.0/crm_operating_unit
+ :alt: OCA/operating-unit
+.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
+ :target: https://translation.odoo-community.org/projects/operating-unit-12-0/operating-unit-12-0-crm_operating_unit
+ :alt: Translate me on Weblate
+.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
+ :target: https://runbot.odoo-community.org/runbot/213/12.0
+ :alt: Try me on Runbot
+
+|badge1| |badge2| |badge3| |badge4| |badge5|
This module introduces the following features:
@@ -14,47 +33,49 @@ This module introduces the following features:
* Security rules are defined to ensure that users can only see the Opportunity / Lead of that Operating Units in which they are allowed access to.
+**Table of contents**
-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/10.0
+.. contents::
+ :local:
Bug Tracker
===========
-Bugs are tracked on `GitHub 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.
+Bugs are tracked on `GitHub 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 `_.
+
+Do not contact contributors directly about support or help with technical issues.
Credits
=======
-Images
-------
+Authors
+~~~~~~~
-* Odoo Community Association: `Icon `_.
+* Eficent
+* Serpent Consulting Services Pvt. Ltd.
Contributors
-------------
+~~~~~~~~~~~~
* Eficent Business and IT Consulting Services S.L.
* Serpent Consulting Services Pvt. Ltd.
-Maintainer
-----------
+Maintainers
+~~~~~~~~~~~
+
+This module is maintained by the OCA.
.. 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 module is part of the `OCA/operating-unit `_ project on GitHub.
+
+You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
diff --git a/crm_operating_unit/__init__.py b/crm_operating_unit/__init__.py
index 2ac09aec86..44f9fd7c13 100644
--- a/crm_operating_unit/__init__.py
+++ b/crm_operating_unit/__init__.py
@@ -1,6 +1,3 @@
-# -*- coding: utf-8 -*-
-# © 2015-17 Eficent Business and IT Consulting Services S.L. -
-# Jordi Ballester Alomar
-# © 2015-17 Serpent Consulting Services Pvt. Ltd. - Sudhir Arya
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
+
from . import models
diff --git a/crm_operating_unit/__manifest__.py b/crm_operating_unit/__manifest__.py
index b148da91fe..a3f02084a8 100644
--- a/crm_operating_unit/__manifest__.py
+++ b/crm_operating_unit/__manifest__.py
@@ -1,12 +1,11 @@
-# -*- coding: utf-8 -*-
-# © 2015-17 Eficent Business and IT Consulting Services S.L. -
+# © 2015-19 Eficent Business and IT Consulting Services S.L. -
# Jordi Ballester Alomar
# © 2015-17 Serpent Consulting Services Pvt. Ltd. - Sudhir Arya
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
{
"name": "Operating Unit in CRM",
- "version": "10.0.1.0.0",
+ "version": "12.0.1.0.0",
"author": "Eficent, "
"Serpent Consulting Services Pvt. Ltd.,"
"Odoo Community Association (OCA)",
diff --git a/crm_operating_unit/i18n/crm_operating_unit.pot b/crm_operating_unit/i18n/crm_operating_unit.pot
new file mode 100644
index 0000000000..8572d123ae
--- /dev/null
+++ b/crm_operating_unit/i18n/crm_operating_unit.pot
@@ -0,0 +1,25 @@
+# Translation of Odoo Server.
+# This file contains the translation of the following modules:
+# * crm_operating_unit
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: Odoo Server 12.0\n"
+"Report-Msgid-Bugs-To: \n"
+"Last-Translator: <>\n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: \n"
+"Plural-Forms: \n"
+
+#. module: crm_operating_unit
+#: model:ir.model,name:crm_operating_unit.model_crm_lead
+msgid "Lead/Opportunity"
+msgstr ""
+
+#. module: crm_operating_unit
+#: model:ir.model.fields,field_description:crm_operating_unit.field_crm_lead__operating_unit_id
+msgid "Operating Unit"
+msgstr ""
+
diff --git a/crm_operating_unit/models/__init__.py b/crm_operating_unit/models/__init__.py
index 3fd9f5d911..fd2efd5252 100644
--- a/crm_operating_unit/models/__init__.py
+++ b/crm_operating_unit/models/__init__.py
@@ -1,6 +1,3 @@
-# -*- coding: utf-8 -*-
-# © 2015-17 Eficent Business and IT Consulting Services S.L. -
-# Jordi Ballester Alomar
-# © 2015-17 Serpent Consulting Services Pvt. Ltd. - Sudhir Arya
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
+
from . import crm_lead
diff --git a/crm_operating_unit/models/crm_lead.py b/crm_operating_unit/models/crm_lead.py
index 4fb0913280..77f0fa7c86 100644
--- a/crm_operating_unit/models/crm_lead.py
+++ b/crm_operating_unit/models/crm_lead.py
@@ -1,5 +1,4 @@
-# -*- coding: utf-8 -*-
-# © 2015-17 Eficent Business and IT Consulting Services S.L. -
+# © 2015-19 Eficent Business and IT Consulting Services S.L. -
# Jordi Ballester Alomar
# © 2015-17 Serpent Consulting Services Pvt. Ltd. - Sudhir Arya
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
@@ -15,8 +14,7 @@ def _get_default_operating_unit(self):
team = self.env['crm.team']._get_default_team_id()
if team.operating_unit_id:
return team.operating_unit_id
- else:
- return self.env['res.users'].operating_unit_default_get(self._uid)
+ return self.env['res.users'].operating_unit_default_get(self._uid)
operating_unit_id = fields.Many2one('operating.unit', 'Operating Unit',
related='team_id.operating_unit_id',
diff --git a/crm_operating_unit/readme/CONTRIBUTORS.rst b/crm_operating_unit/readme/CONTRIBUTORS.rst
new file mode 100644
index 0000000000..cd225d6593
--- /dev/null
+++ b/crm_operating_unit/readme/CONTRIBUTORS.rst
@@ -0,0 +1,2 @@
+* Eficent Business and IT Consulting Services S.L.
+* Serpent Consulting Services Pvt. Ltd.
\ No newline at end of file
diff --git a/crm_operating_unit/readme/DESCRIPTION.rst b/crm_operating_unit/readme/DESCRIPTION.rst
new file mode 100644
index 0000000000..3baca9e7ba
--- /dev/null
+++ b/crm_operating_unit/readme/DESCRIPTION.rst
@@ -0,0 +1,7 @@
+This module introduces the following features:
+
+* Adds the Operating Unit (OU) to the Lead.
+
+* The user’s default Operating Unit (OU) is proposed at the time of creating the Lead / Opportunity.
+
+* Security rules are defined to ensure that users can only see the Opportunity / Lead of that Operating Units in which they are allowed access to.
\ No newline at end of file
diff --git a/crm_operating_unit/readme/USAGE.rst b/crm_operating_unit/readme/USAGE.rst
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/crm_operating_unit/security/crm_security.xml b/crm_operating_unit/security/crm_security.xml
index d9f9d365f1..e0135145cb 100644
--- a/crm_operating_unit/security/crm_security.xml
+++ b/crm_operating_unit/security/crm_security.xml
@@ -1,8 +1,8 @@
-
-
+
diff --git a/crm_operating_unit/static/description/index.html b/crm_operating_unit/static/description/index.html
new file mode 100644
index 0000000000..c43c99364d
--- /dev/null
+++ b/crm_operating_unit/static/description/index.html
@@ -0,0 +1,426 @@
+
+
+
+
+
+
+Operating Unit in CRM
+
+
+
+
+
Operating Unit in CRM
+
+
+
+
This module introduces the following features:
+
+- Adds the Operating Unit (OU) to the Lead.
+- The user’s default Operating Unit (OU) is proposed at the time of creating the Lead / Opportunity.
+- Security rules are defined to ensure that users can only see the Opportunity / Lead of that Operating Units in which they are allowed access to.
+
+
Table of contents
+
+
+
+
Bugs are tracked on GitHub 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.
+
Do not contact contributors directly about support or help with technical issues.
+
+
+
+
+
+
+- Eficent
+- Serpent Consulting Services Pvt. Ltd.
+
+
+
+
+
+
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.
+
This module is part of the OCA/operating-unit project on GitHub.
+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
+
+
+
+
+
diff --git a/crm_operating_unit/tests/__init__.py b/crm_operating_unit/tests/__init__.py
index 7691600421..5a71ecc15f 100644
--- a/crm_operating_unit/tests/__init__.py
+++ b/crm_operating_unit/tests/__init__.py
@@ -1,6 +1,3 @@
-# -*- coding: utf-8 -*-
-# © 2015-17 Eficent Business and IT Consulting Services S.L. -
-# Jordi Ballester Alomar
-# © 2015-17 Serpent Consulting Services Pvt. Ltd. - Sudhir Arya
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
+
from . import test_crm_operating_unit
diff --git a/crm_operating_unit/tests/test_crm_operating_unit.py b/crm_operating_unit/tests/test_crm_operating_unit.py
index 75d6438eec..fa3d2f80db 100644
--- a/crm_operating_unit/tests/test_crm_operating_unit.py
+++ b/crm_operating_unit/tests/test_crm_operating_unit.py
@@ -1,5 +1,4 @@
-# -*- coding: utf-8 -*-
-# © 2015-17 Eficent Business and IT Consulting Services S.L. -
+# © 2015-19 Eficent Business and IT Consulting Services S.L. -
# Jordi Ballester Alomar
# © 2015-17 Serpent Consulting Services Pvt. Ltd. - Sudhir Arya
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
diff --git a/crm_operating_unit/views/crm_lead_view.xml b/crm_operating_unit/views/crm_lead_view.xml
index a4c3a4ecfe..a0808a0661 100644
--- a/crm_operating_unit/views/crm_lead_view.xml
+++ b/crm_operating_unit/views/crm_lead_view.xml
@@ -1,9 +1,8 @@
-
-
-
+
@@ -12,7 +11,8 @@
-
+
@@ -24,7 +24,8 @@
-
+
@@ -36,7 +37,8 @@
-
+
@@ -48,7 +50,8 @@
-
+
@@ -60,7 +63,8 @@
-
+
@@ -72,10 +76,10 @@
-
+
-
-
-
+
+
From ec0bb58b40e062ed5a9c10ba5841311a00d3ef2a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jes=C3=BAs=20Alan=20Ramos=20Rodr=C3=ADguez?=
Date: Wed, 12 Feb 2020 15:17:13 -0600
Subject: [PATCH 11/26] [IMP] crm_operating_unit: black, isort
---
crm_operating_unit/__manifest__.py | 11 +--
crm_operating_unit/models/crm_lead.py | 15 +--
crm_operating_unit/readme/CONTRIBUTORS.rst | 2 +-
crm_operating_unit/readme/DESCRIPTION.rst | 2 +-
.../tests/test_crm_operating_unit.py | 91 ++++++++++---------
crm_operating_unit/views/crm_lead_view.xml | 2 +-
6 files changed, 64 insertions(+), 59 deletions(-)
diff --git a/crm_operating_unit/__manifest__.py b/crm_operating_unit/__manifest__.py
index a3f02084a8..a10431a3c3 100644
--- a/crm_operating_unit/__manifest__.py
+++ b/crm_operating_unit/__manifest__.py
@@ -7,15 +7,12 @@
"name": "Operating Unit in CRM",
"version": "12.0.1.0.0",
"author": "Eficent, "
- "Serpent Consulting Services Pvt. Ltd.,"
- "Odoo Community Association (OCA)",
+ "Serpent Consulting Services Pvt. Ltd.,"
+ "Odoo Community Association (OCA)",
"license": "LGPL-3",
"website": "https://github.com/OCA/operating-unit",
"category": "Sales",
"depends": ["crm", "sales_team_operating_unit"],
- "data": [
- "views/crm_lead_view.xml",
- "security/crm_security.xml",
- ],
- 'installable': True,
+ "data": ["views/crm_lead_view.xml", "security/crm_security.xml"],
+ "installable": True,
}
diff --git a/crm_operating_unit/models/crm_lead.py b/crm_operating_unit/models/crm_lead.py
index 77f0fa7c86..c8060025e9 100644
--- a/crm_operating_unit/models/crm_lead.py
+++ b/crm_operating_unit/models/crm_lead.py
@@ -7,15 +7,18 @@
class CRMLead(models.Model):
- _inherit = 'crm.lead'
+ _inherit = "crm.lead"
@api.model
def _get_default_operating_unit(self):
- team = self.env['crm.team']._get_default_team_id()
+ team = self.env["crm.team"]._get_default_team_id()
if team.operating_unit_id:
return team.operating_unit_id
- return self.env['res.users'].operating_unit_default_get(self._uid)
+ return self.env["res.users"].operating_unit_default_get(self._uid)
- operating_unit_id = fields.Many2one('operating.unit', 'Operating Unit',
- related='team_id.operating_unit_id',
- default=_get_default_operating_unit)
+ operating_unit_id = fields.Many2one(
+ "operating.unit",
+ "Operating Unit",
+ related="team_id.operating_unit_id",
+ default=_get_default_operating_unit,
+ )
diff --git a/crm_operating_unit/readme/CONTRIBUTORS.rst b/crm_operating_unit/readme/CONTRIBUTORS.rst
index cd225d6593..6f26312176 100644
--- a/crm_operating_unit/readme/CONTRIBUTORS.rst
+++ b/crm_operating_unit/readme/CONTRIBUTORS.rst
@@ -1,2 +1,2 @@
* Eficent Business and IT Consulting Services S.L.
-* Serpent Consulting Services Pvt. Ltd.
\ No newline at end of file
+* Serpent Consulting Services Pvt. Ltd.
diff --git a/crm_operating_unit/readme/DESCRIPTION.rst b/crm_operating_unit/readme/DESCRIPTION.rst
index 3baca9e7ba..e07bcd1108 100644
--- a/crm_operating_unit/readme/DESCRIPTION.rst
+++ b/crm_operating_unit/readme/DESCRIPTION.rst
@@ -4,4 +4,4 @@ This module introduces the following features:
* The user’s default Operating Unit (OU) is proposed at the time of creating the Lead / Opportunity.
-* Security rules are defined to ensure that users can only see the Opportunity / Lead of that Operating Units in which they are allowed access to.
\ No newline at end of file
+* Security rules are defined to ensure that users can only see the Opportunity / Lead of that Operating Units in which they are allowed access to.
diff --git a/crm_operating_unit/tests/test_crm_operating_unit.py b/crm_operating_unit/tests/test_crm_operating_unit.py
index fa3d2f80db..c40f840538 100644
--- a/crm_operating_unit/tests/test_crm_operating_unit.py
+++ b/crm_operating_unit/tests/test_crm_operating_unit.py
@@ -6,29 +6,28 @@
class TestCrmOperatingUnit(common.TransactionCase):
-
def setUp(self):
super(TestCrmOperatingUnit, self).setUp()
- self.res_users_model = self.env['res.users']
- self.crm_lead_model = self.env['crm.lead']
- self.crm_team_model = self.env['crm.team']
+ self.res_users_model = self.env["res.users"]
+ self.crm_lead_model = self.env["crm.lead"]
+ self.crm_team_model = self.env["crm.team"]
# Groups
- self.grp_sale_mngr = self.env.ref('sales_team.group_sale_manager')
- self.grp_user = self.env.ref('base.group_user')
+ self.grp_sale_mngr = self.env.ref("sales_team.group_sale_manager")
+ self.grp_user = self.env.ref("base.group_user")
# Company
- self.company = self.env.ref('base.main_company')
+ self.company = self.env.ref("base.main_company")
# Main Operating Unit
- self.main_OU = self.env.ref('operating_unit.main_operating_unit')
+ self.main_OU = self.env.ref("operating_unit.main_operating_unit")
# B2C Operating Unit
- self.b2c_OU = self.env.ref('operating_unit.b2c_operating_unit')
+ self.b2c_OU = self.env.ref("operating_unit.b2c_operating_unit")
# Create User 1 with Main OU
- self.user1 = self._create_user('user_1', [self.grp_sale_mngr,
- self.grp_user],
- self.company, [self.main_OU])
+ self.user1 = self._create_user(
+ "user_1", [self.grp_sale_mngr, self.grp_user], self.company, [self.main_OU]
+ )
# Create User 2 with B2C OU
- self.user2 = self._create_user('user_2', [self.grp_sale_mngr,
- self.grp_user],
- self.company, [self.b2c_OU])
+ self.user2 = self._create_user(
+ "user_2", [self.grp_sale_mngr, self.grp_user], self.company, [self.b2c_OU]
+ )
self.team1 = self._create_crm_team(self.user1.id, self.main_OU)
self.team2 = self._create_crm_team(self.user2.id, self.b2c_OU)
@@ -40,37 +39,40 @@ def setUp(self):
def _create_user(self, login, groups, company, operating_units):
""" Create a user. """
group_ids = [group.id for group in groups]
- user = self.res_users_model.create({
- 'name': login,
- 'login': login,
- 'password': 'demo',
- 'email': 'test@yourcompany.com',
- 'company_id': company.id,
- 'company_ids': [(4, company.id)],
- 'operating_unit_ids': [(4, ou.id) for ou in operating_units],
- 'groups_id': [(6, 0, group_ids)]
- })
+ user = self.res_users_model.create(
+ {
+ "name": login,
+ "login": login,
+ "password": "demo",
+ "email": "test@yourcompany.com",
+ "company_id": company.id,
+ "company_ids": [(4, company.id)],
+ "operating_unit_ids": [(4, ou.id) for ou in operating_units],
+ "groups_id": [(6, 0, group_ids)],
+ }
+ )
return user
def _create_crm_team(self, uid, operating_unit):
"""Create a sale order."""
crm = self.crm_team_model.with_context(
- {'mail_create_nosubscribe': True,
- 'mail_create_nolog': True}).create(
- {'name': 'CRM team', 'operating_unit_id': operating_unit.id,
- 'user_id': uid})
+ {"mail_create_nosubscribe": True, "mail_create_nolog": True}
+ ).create(
+ {"name": "CRM team", "operating_unit_id": operating_unit.id, "user_id": uid}
+ )
return crm
def _create_crm_lead(self, uid, team):
"""Create a sale order."""
- operating_unit_id = self.crm_lead_model.sudo(uid).\
- _get_default_operating_unit()
- crm = self.crm_lead_model.create({
- 'name': 'CRM LEAD',
- 'user_id': uid,
- 'operating_unit_id': operating_unit_id.id,
- 'team_id': team.id
- })
+ operating_unit_id = self.crm_lead_model.sudo(uid)._get_default_operating_unit()
+ crm = self.crm_lead_model.create(
+ {
+ "name": "CRM LEAD",
+ "user_id": uid,
+ "operating_unit_id": operating_unit_id.id,
+ "team_id": team.id,
+ }
+ )
return crm
def test_crm_lead(self):
@@ -78,13 +80,16 @@ def test_crm_lead(self):
# access CRM leads for Main Operating Unit.
lead = self.crm_lead_model.sudo(self.user2.id).search(
- [('id', '=', self.lead1.id),
- ('operating_unit_id', '=', self.main_OU.id)])
- self.assertEqual(lead.ids, [], 'User 2 should not have access to '
- '%s' % self.main_OU.name)
+ [("id", "=", self.lead1.id), ("operating_unit_id", "=", self.main_OU.id)]
+ )
+ self.assertEqual(
+ lead.ids, [], "User 2 should not have access to " "%s" % self.main_OU.name
+ )
def test_team_ou(self):
new_lead = self._create_crm_lead(self.user2.id, self.team2)
self.assertEqual(
- new_lead.operating_unit_id, self.b2c_OU,
- 'User 2 lead should have %s as operating unit' % self.b2c_OU.name)
+ new_lead.operating_unit_id,
+ self.b2c_OU,
+ "User 2 lead should have %s as operating unit" % self.b2c_OU.name,
+ )
diff --git a/crm_operating_unit/views/crm_lead_view.xml b/crm_operating_unit/views/crm_lead_view.xml
index a0808a0661..216fac1eab 100644
--- a/crm_operating_unit/views/crm_lead_view.xml
+++ b/crm_operating_unit/views/crm_lead_view.xml
@@ -81,5 +81,5 @@
-
+
From 1b1e7d298011afbfbd66d44bbe29a91617034da1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jes=C3=BAs=20Alan=20Ramos=20Rodr=C3=ADguez?=
Date: Wed, 12 Feb 2020 15:40:36 -0600
Subject: [PATCH 12/26] [MIG] crm_operating_unit: Migration to V13
---
crm_operating_unit/README.rst | 11 +++++----
crm_operating_unit/__manifest__.py | 2 +-
.../i18n/crm_operating_unit.pot | 7 +++---
crm_operating_unit/readme/CONTRIBUTORS.rst | 1 +
.../static/description/index.html | 7 +++---
.../tests/test_crm_operating_unit.py | 6 +++--
crm_operating_unit/views/crm_lead_view.xml | 23 ++++---------------
7 files changed, 24 insertions(+), 33 deletions(-)
diff --git a/crm_operating_unit/README.rst b/crm_operating_unit/README.rst
index e2981de944..535c7ef690 100644
--- a/crm_operating_unit/README.rst
+++ b/crm_operating_unit/README.rst
@@ -14,13 +14,13 @@ Operating Unit in CRM
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
:alt: License: LGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Foperating--unit-lightgray.png?logo=github
- :target: https://github.com/OCA/operating-unit/tree/12.0/crm_operating_unit
+ :target: https://github.com/OCA/operating-unit/tree/13.0/crm_operating_unit
:alt: OCA/operating-unit
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
- :target: https://translation.odoo-community.org/projects/operating-unit-12-0/operating-unit-12-0-crm_operating_unit
+ :target: https://translation.odoo-community.org/projects/operating-unit-13-0/operating-unit-13-0-crm_operating_unit
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
- :target: https://runbot.odoo-community.org/runbot/213/12.0
+ :target: https://runbot.odoo-community.org/runbot/213/13.0
:alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -44,7 +44,7 @@ Bug Tracker
Bugs are tracked on `GitHub 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 `_.
+`feedback `_.
Do not contact contributors directly about support or help with technical issues.
@@ -62,6 +62,7 @@ Contributors
* Eficent Business and IT Consulting Services S.L.
* Serpent Consulting Services Pvt. Ltd.
+* Jarsa Sistemas, S.A. de C.V.
Maintainers
~~~~~~~~~~~
@@ -76,6 +77,6 @@ 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.
-This module is part of the `OCA/operating-unit `_ project on GitHub.
+This module is part of the `OCA/operating-unit `_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
diff --git a/crm_operating_unit/__manifest__.py b/crm_operating_unit/__manifest__.py
index a10431a3c3..fc47023c43 100644
--- a/crm_operating_unit/__manifest__.py
+++ b/crm_operating_unit/__manifest__.py
@@ -5,7 +5,7 @@
{
"name": "Operating Unit in CRM",
- "version": "12.0.1.0.0",
+ "version": "13.0.1.0.0",
"author": "Eficent, "
"Serpent Consulting Services Pvt. Ltd.,"
"Odoo Community Association (OCA)",
diff --git a/crm_operating_unit/i18n/crm_operating_unit.pot b/crm_operating_unit/i18n/crm_operating_unit.pot
index 8572d123ae..ef35a7ae92 100644
--- a/crm_operating_unit/i18n/crm_operating_unit.pot
+++ b/crm_operating_unit/i18n/crm_operating_unit.pot
@@ -1,12 +1,12 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
-# * crm_operating_unit
+# * crm_operating_unit
#
msgid ""
msgstr ""
-"Project-Id-Version: Odoo Server 12.0\n"
+"Project-Id-Version: Odoo Server 13.0\n"
"Report-Msgid-Bugs-To: \n"
-"Last-Translator: <>\n"
+"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@@ -22,4 +22,3 @@ msgstr ""
#: model:ir.model.fields,field_description:crm_operating_unit.field_crm_lead__operating_unit_id
msgid "Operating Unit"
msgstr ""
-
diff --git a/crm_operating_unit/readme/CONTRIBUTORS.rst b/crm_operating_unit/readme/CONTRIBUTORS.rst
index 6f26312176..a0b3a1f803 100644
--- a/crm_operating_unit/readme/CONTRIBUTORS.rst
+++ b/crm_operating_unit/readme/CONTRIBUTORS.rst
@@ -1,2 +1,3 @@
* Eficent Business and IT Consulting Services S.L.
* Serpent Consulting Services Pvt. Ltd.
+* Jarsa Sistemas, S.A. de C.V.
diff --git a/crm_operating_unit/static/description/index.html b/crm_operating_unit/static/description/index.html
index c43c99364d..dd252372ea 100644
--- a/crm_operating_unit/static/description/index.html
+++ b/crm_operating_unit/static/description/index.html
@@ -367,7 +367,7 @@ Operating Unit in CRM
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
-
+
This module introduces the following features:
- Adds the Operating Unit (OU) to the Lead.
@@ -391,7 +391,7 @@
Bugs are tracked on GitHub 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.
+feedback.
Do not contact contributors directly about support or help with technical issues.
@@ -417,7 +418,7 @@
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.
-
This module is part of the OCA/operating-unit project on GitHub.
+
This module is part of the OCA/operating-unit project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
diff --git a/crm_operating_unit/tests/test_crm_operating_unit.py b/crm_operating_unit/tests/test_crm_operating_unit.py
index c40f840538..62469f6d24 100644
--- a/crm_operating_unit/tests/test_crm_operating_unit.py
+++ b/crm_operating_unit/tests/test_crm_operating_unit.py
@@ -64,7 +64,9 @@ def _create_crm_team(self, uid, operating_unit):
def _create_crm_lead(self, uid, team):
"""Create a sale order."""
- operating_unit_id = self.crm_lead_model.sudo(uid)._get_default_operating_unit()
+ operating_unit_id = self.crm_lead_model.with_user(
+ uid
+ )._get_default_operating_unit()
crm = self.crm_lead_model.create(
{
"name": "CRM LEAD",
@@ -79,7 +81,7 @@ def test_crm_lead(self):
# User 2 is only assigned to B2C Operating Unit, and cannot
# access CRM leads for Main Operating Unit.
- lead = self.crm_lead_model.sudo(self.user2.id).search(
+ lead = self.crm_lead_model.with_user(self.user2.id).search(
[("id", "=", self.lead1.id), ("operating_unit_id", "=", self.main_OU.id)]
)
self.assertEqual(
diff --git a/crm_operating_unit/views/crm_lead_view.xml b/crm_operating_unit/views/crm_lead_view.xml
index 216fac1eab..02c5a7139d 100644
--- a/crm_operating_unit/views/crm_lead_view.xml
+++ b/crm_operating_unit/views/crm_lead_view.xml
@@ -4,16 +4,16 @@
License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl-3.0) -->
-
-
+
+
CRM - Leads Form
crm.lead
-
+
-
+
-
+
@@ -43,19 +43,6 @@
-
-
- Opportunities
- crm.lead
-
-
-
-
-
-
-
-
Opportunities Tree
From 0a7bc9774b046135cc697a7f4c1e1794337d7283 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jes=C3=BAs=20Alan=20Ramos=20Rodr=C3=ADguez?=
Date: Sat, 15 Feb 2020 11:56:29 +0000
Subject: [PATCH 13/26] Added translation using Weblate (Spanish)
---
crm_operating_unit/i18n/es.po | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
create mode 100644 crm_operating_unit/i18n/es.po
diff --git a/crm_operating_unit/i18n/es.po b/crm_operating_unit/i18n/es.po
new file mode 100644
index 0000000000..0623243ef8
--- /dev/null
+++ b/crm_operating_unit/i18n/es.po
@@ -0,0 +1,25 @@
+# Translation of Odoo Server.
+# This file contains the translation of the following modules:
+# * crm_operating_unit
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: Odoo Server 13.0\n"
+"Report-Msgid-Bugs-To: \n"
+"Last-Translator: Automatically generated\n"
+"Language-Team: none\n"
+"Language: es\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: \n"
+"Plural-Forms: nplurals=2; plural=n != 1;\n"
+
+#. module: crm_operating_unit
+#: model:ir.model,name:crm_operating_unit.model_crm_lead
+msgid "Lead/Opportunity"
+msgstr ""
+
+#. module: crm_operating_unit
+#: model:ir.model.fields,field_description:crm_operating_unit.field_crm_lead__operating_unit_id
+msgid "Operating Unit"
+msgstr ""
From 3eadb605868e1d7f7c6dd4ce78d29bcf246320f4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jes=C3=BAs=20Alan=20Ramos=20Rodr=C3=ADguez?=
Date: Sat, 15 Feb 2020 11:57:30 +0000
Subject: [PATCH 14/26] Added translation using Weblate (Spanish (Mexico))
---
crm_operating_unit/i18n/es_MX.po | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
create mode 100644 crm_operating_unit/i18n/es_MX.po
diff --git a/crm_operating_unit/i18n/es_MX.po b/crm_operating_unit/i18n/es_MX.po
new file mode 100644
index 0000000000..64239a3653
--- /dev/null
+++ b/crm_operating_unit/i18n/es_MX.po
@@ -0,0 +1,25 @@
+# Translation of Odoo Server.
+# This file contains the translation of the following modules:
+# * crm_operating_unit
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: Odoo Server 13.0\n"
+"Report-Msgid-Bugs-To: \n"
+"Last-Translator: Automatically generated\n"
+"Language-Team: none\n"
+"Language: es_MX\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: \n"
+"Plural-Forms: nplurals=2; plural=n != 1;\n"
+
+#. module: crm_operating_unit
+#: model:ir.model,name:crm_operating_unit.model_crm_lead
+msgid "Lead/Opportunity"
+msgstr ""
+
+#. module: crm_operating_unit
+#: model:ir.model.fields,field_description:crm_operating_unit.field_crm_lead__operating_unit_id
+msgid "Operating Unit"
+msgstr ""
From 4b9e360c0cd1c68c96faffa271020a50f51f774c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jes=C3=BAs=20Alan=20Ramos=20Rodr=C3=ADguez?=
Date: Sat, 15 Feb 2020 11:58:01 +0000
Subject: [PATCH 15/26] Translated using Weblate (Spanish (Mexico))
Currently translated at 100.0% (2 of 2 strings)
Translation: operating-unit-13.0/operating-unit-13.0-crm_operating_unit
Translate-URL: https://translation.odoo-community.org/projects/operating-unit-13-0/operating-unit-13-0-crm_operating_unit/es_MX/
---
crm_operating_unit/i18n/es_MX.po | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/crm_operating_unit/i18n/es_MX.po b/crm_operating_unit/i18n/es_MX.po
index 64239a3653..6a4d4caa90 100644
--- a/crm_operating_unit/i18n/es_MX.po
+++ b/crm_operating_unit/i18n/es_MX.po
@@ -6,20 +6,22 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 13.0\n"
"Report-Msgid-Bugs-To: \n"
-"Last-Translator: Automatically generated\n"
+"PO-Revision-Date: 2020-02-15 14:13+0000\n"
+"Last-Translator: Jesús Alan Ramos Rodríguez \n"
"Language-Team: none\n"
"Language: es_MX\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
+"X-Generator: Weblate 3.10\n"
#. module: crm_operating_unit
#: model:ir.model,name:crm_operating_unit.model_crm_lead
msgid "Lead/Opportunity"
-msgstr ""
+msgstr "Iniciativa/Oportunidad"
#. module: crm_operating_unit
#: model:ir.model.fields,field_description:crm_operating_unit.field_crm_lead__operating_unit_id
msgid "Operating Unit"
-msgstr ""
+msgstr "Unidad Operativa"
From a3d2f6fb758f596282ed7580a64e2a9b110f3bbb Mon Sep 17 00:00:00 2001
From: OCA-git-bot
Date: Sat, 14 Mar 2020 12:14:59 +0100
Subject: [PATCH 16/26] pre-commit update
---
crm_operating_unit/README.rst | 4 +-
crm_operating_unit/__manifest__.py | 5 +-
crm_operating_unit/models/crm_lead.py | 3 +-
crm_operating_unit/readme/CONTRIBUTORS.rst | 2 +-
crm_operating_unit/security/crm_security.xml | 25 ++--
.../static/description/index.html | 4 +-
.../tests/test_crm_operating_unit.py | 3 +-
crm_operating_unit/views/crm_lead_view.xml | 126 ++++++++++--------
8 files changed, 89 insertions(+), 83 deletions(-)
diff --git a/crm_operating_unit/README.rst b/crm_operating_unit/README.rst
index 535c7ef690..48b8d57d1f 100644
--- a/crm_operating_unit/README.rst
+++ b/crm_operating_unit/README.rst
@@ -54,13 +54,13 @@ Credits
Authors
~~~~~~~
-* Eficent
+* ForgeFlow
* Serpent Consulting Services Pvt. Ltd.
Contributors
~~~~~~~~~~~~
-* Eficent Business and IT Consulting Services S.L.
+* ForgeFlow S.L.
* Serpent Consulting Services Pvt. Ltd.
* Jarsa Sistemas, S.A. de C.V.
diff --git a/crm_operating_unit/__manifest__.py b/crm_operating_unit/__manifest__.py
index fc47023c43..7ce4a43215 100644
--- a/crm_operating_unit/__manifest__.py
+++ b/crm_operating_unit/__manifest__.py
@@ -1,12 +1,11 @@
-# © 2015-19 Eficent Business and IT Consulting Services S.L. -
-# Jordi Ballester Alomar
+# © 2015-19 ForgeFlow S.L. - Jordi Ballester Alomar
# © 2015-17 Serpent Consulting Services Pvt. Ltd. - Sudhir Arya
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
{
"name": "Operating Unit in CRM",
"version": "13.0.1.0.0",
- "author": "Eficent, "
+ "author": "ForgeFlow, "
"Serpent Consulting Services Pvt. Ltd.,"
"Odoo Community Association (OCA)",
"license": "LGPL-3",
diff --git a/crm_operating_unit/models/crm_lead.py b/crm_operating_unit/models/crm_lead.py
index c8060025e9..408b96e4e8 100644
--- a/crm_operating_unit/models/crm_lead.py
+++ b/crm_operating_unit/models/crm_lead.py
@@ -1,5 +1,4 @@
-# © 2015-19 Eficent Business and IT Consulting Services S.L. -
-# Jordi Ballester Alomar
+# © 2015-19 ForgeFlow S.L. - Jordi Ballester Alomar
# © 2015-17 Serpent Consulting Services Pvt. Ltd. - Sudhir Arya
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
from odoo import api, fields, models
diff --git a/crm_operating_unit/readme/CONTRIBUTORS.rst b/crm_operating_unit/readme/CONTRIBUTORS.rst
index a0b3a1f803..64e59c2a29 100644
--- a/crm_operating_unit/readme/CONTRIBUTORS.rst
+++ b/crm_operating_unit/readme/CONTRIBUTORS.rst
@@ -1,3 +1,3 @@
-* Eficent Business and IT Consulting Services S.L.
+* ForgeFlow S.L.
* Serpent Consulting Services Pvt. Ltd.
* Jarsa Sistemas, S.A. de C.V.
diff --git a/crm_operating_unit/security/crm_security.xml b/crm_operating_unit/security/crm_security.xml
index e0135145cb..a2313cbbe6 100644
--- a/crm_operating_unit/security/crm_security.xml
+++ b/crm_operating_unit/security/crm_security.xml
@@ -1,19 +1,18 @@
-
-
-
-
-
- ['|',('operating_unit_id','=',False),('operating_unit_id','in',[g.id for g in user.operating_unit_ids])]
+
+
+ ['|',('operating_unit_id','=',False),('operating_unit_id','in',[g.id for g in user.operating_unit_ids])]
Leads from allowed operating units
-
-
-
-
-
+
+
+
+
+
-
diff --git a/crm_operating_unit/static/description/index.html b/crm_operating_unit/static/description/index.html
index dd252372ea..274d8b432e 100644
--- a/crm_operating_unit/static/description/index.html
+++ b/crm_operating_unit/static/description/index.html
@@ -399,14 +399,14 @@
-- Eficent
+- ForgeFlow
- Serpent Consulting Services Pvt. Ltd.
diff --git a/crm_operating_unit/tests/test_crm_operating_unit.py b/crm_operating_unit/tests/test_crm_operating_unit.py
index 62469f6d24..3916516e5e 100644
--- a/crm_operating_unit/tests/test_crm_operating_unit.py
+++ b/crm_operating_unit/tests/test_crm_operating_unit.py
@@ -1,5 +1,4 @@
-# © 2015-19 Eficent Business and IT Consulting Services S.L. -
-# Jordi Ballester Alomar
+# © 2015-19 ForgeFlow S.L. - Jordi Ballester Alomar
# © 2015-17 Serpent Consulting Services Pvt. Ltd. - Sudhir Arya
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
from odoo.tests import common
diff --git a/crm_operating_unit/views/crm_lead_view.xml b/crm_operating_unit/views/crm_lead_view.xml
index 02c5a7139d..8628437424 100644
--- a/crm_operating_unit/views/crm_lead_view.xml
+++ b/crm_operating_unit/views/crm_lead_view.xml
@@ -1,72 +1,82 @@
-
-
-
-
-
+
+
CRM - Leads Form
crm.lead
-
+
-
+
-
-
-
-
- Leads
- crm.lead
-
-
-
-
-
+
+
+
+ Leads
+ crm.lead
+
+
+
+
-
-
-
-
- CRM - Leads Search
- crm.lead
-
-
-
-
-
+
+
+
+
+ CRM - Leads Search
+ crm.lead
+
+
+
+
-
-
-
-
- Opportunities Tree
- crm.lead
-
-
-
-
-
+
+
+
+
+ Opportunities Tree
+ crm.lead
+
+
+
+
-
-
-
-
- CRM - Opportunities Search
- crm.lead
-
-
-
-
-
+
+
+
+
+ CRM - Opportunities Search
+ crm.lead
+
+
+
+
-
-
+
+
From 317d07780a0182e0e99a636a1a94142f0e6f4f5e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jes=C3=BAs=20Alan=20Ramos=20Rodr=C3=ADguez?=
Date: Sat, 10 Oct 2020 10:12:33 -0500
Subject: [PATCH 17/26] [IMP] crm_operating_unit: black, isort, prettier
---
crm_operating_unit/security/crm_security.xml | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/crm_operating_unit/security/crm_security.xml b/crm_operating_unit/security/crm_security.xml
index a2313cbbe6..f15928e212 100644
--- a/crm_operating_unit/security/crm_security.xml
+++ b/crm_operating_unit/security/crm_security.xml
@@ -5,9 +5,10 @@
- ['|',('operating_unit_id','=',False),('operating_unit_id','in',[g.id for g in user.operating_unit_ids])]
+
+ ['|',('operating_unit_id','=',False),('operating_unit_id','in',[g.id for g
+ in user.operating_unit_ids])]
+
Leads from allowed operating units
From db811c3b83c47458c2fbc0b7b6a454323a09cd76 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jes=C3=BAs=20Alan=20Ramos=20Rodr=C3=ADguez?=
Date: Sat, 10 Oct 2020 10:14:15 -0500
Subject: [PATCH 18/26] [MIG] crm_operating_unit: Migration to 14.0
---
crm_operating_unit/README.rst | 10 +++++-----
crm_operating_unit/__manifest__.py | 2 +-
crm_operating_unit/i18n/crm_operating_unit.pot | 17 ++++++++++++++++-
.../static/description/index.html | 6 +++---
4 files changed, 25 insertions(+), 10 deletions(-)
diff --git a/crm_operating_unit/README.rst b/crm_operating_unit/README.rst
index 48b8d57d1f..7d97540e7f 100644
--- a/crm_operating_unit/README.rst
+++ b/crm_operating_unit/README.rst
@@ -14,13 +14,13 @@ Operating Unit in CRM
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
:alt: License: LGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Foperating--unit-lightgray.png?logo=github
- :target: https://github.com/OCA/operating-unit/tree/13.0/crm_operating_unit
+ :target: https://github.com/OCA/operating-unit/tree/14.0/crm_operating_unit
:alt: OCA/operating-unit
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
- :target: https://translation.odoo-community.org/projects/operating-unit-13-0/operating-unit-13-0-crm_operating_unit
+ :target: https://translation.odoo-community.org/projects/operating-unit-14-0/operating-unit-14-0-crm_operating_unit
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
- :target: https://runbot.odoo-community.org/runbot/213/13.0
+ :target: https://runbot.odoo-community.org/runbot/213/14.0
:alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -44,7 +44,7 @@ Bug Tracker
Bugs are tracked on `GitHub 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 `_.
+`feedback `_.
Do not contact contributors directly about support or help with technical issues.
@@ -77,6 +77,6 @@ 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.
-This module is part of the `OCA/operating-unit `_ project on GitHub.
+This module is part of the `OCA/operating-unit `_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
diff --git a/crm_operating_unit/__manifest__.py b/crm_operating_unit/__manifest__.py
index 7ce4a43215..badf72cf26 100644
--- a/crm_operating_unit/__manifest__.py
+++ b/crm_operating_unit/__manifest__.py
@@ -4,7 +4,7 @@
{
"name": "Operating Unit in CRM",
- "version": "13.0.1.0.0",
+ "version": "14.0.1.0.0",
"author": "ForgeFlow, "
"Serpent Consulting Services Pvt. Ltd.,"
"Odoo Community Association (OCA)",
diff --git a/crm_operating_unit/i18n/crm_operating_unit.pot b/crm_operating_unit/i18n/crm_operating_unit.pot
index ef35a7ae92..2c2e69cf43 100644
--- a/crm_operating_unit/i18n/crm_operating_unit.pot
+++ b/crm_operating_unit/i18n/crm_operating_unit.pot
@@ -4,7 +4,7 @@
#
msgid ""
msgstr ""
-"Project-Id-Version: Odoo Server 13.0\n"
+"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: \n"
"Language-Team: \n"
@@ -13,6 +13,21 @@ msgstr ""
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
+#. module: crm_operating_unit
+#: model:ir.model.fields,field_description:crm_operating_unit.field_crm_lead__display_name
+msgid "Display Name"
+msgstr ""
+
+#. module: crm_operating_unit
+#: model:ir.model.fields,field_description:crm_operating_unit.field_crm_lead__id
+msgid "ID"
+msgstr ""
+
+#. module: crm_operating_unit
+#: model:ir.model.fields,field_description:crm_operating_unit.field_crm_lead____last_update
+msgid "Last Modified on"
+msgstr ""
+
#. module: crm_operating_unit
#: model:ir.model,name:crm_operating_unit.model_crm_lead
msgid "Lead/Opportunity"
diff --git a/crm_operating_unit/static/description/index.html b/crm_operating_unit/static/description/index.html
index 274d8b432e..a4f52175f4 100644
--- a/crm_operating_unit/static/description/index.html
+++ b/crm_operating_unit/static/description/index.html
@@ -367,7 +367,7 @@ Operating Unit in CRM
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
-
+
This module introduces the following features:
- Adds the Operating Unit (OU) to the Lead.
@@ -391,7 +391,7 @@
Bugs are tracked on GitHub 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.
+feedback.
Do not contact contributors directly about support or help with technical issues.
@@ -418,7 +418,7 @@
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.
-
This module is part of the OCA/operating-unit project on GitHub.
+
This module is part of the OCA/operating-unit project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
From 54adb5ab297e354a000397e3f235c7be1d5875b9 Mon Sep 17 00:00:00 2001
From: oca-git-bot
Date: Thu, 31 Mar 2022 17:01:52 +0200
Subject: [PATCH 19/26] [IMP] update dotfiles [ci skip]
---
crm_operating_unit/tests/test_crm_operating_unit.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/crm_operating_unit/tests/test_crm_operating_unit.py b/crm_operating_unit/tests/test_crm_operating_unit.py
index 3916516e5e..4275c5ab24 100644
--- a/crm_operating_unit/tests/test_crm_operating_unit.py
+++ b/crm_operating_unit/tests/test_crm_operating_unit.py
@@ -36,7 +36,7 @@ def setUp(self):
self.lead2 = self._create_crm_lead(self.user2.id, self.team2)
def _create_user(self, login, groups, company, operating_units):
- """ Create a user. """
+ """Create a user."""
group_ids = [group.id for group in groups]
user = self.res_users_model.create(
{
From 513d61fc1048bf7852e8d2b2df346e05fc501c30 Mon Sep 17 00:00:00 2001
From: Khalid Hazam
Date: Tue, 28 Jun 2022 08:26:07 +0000
Subject: [PATCH 20/26] Added translation using Weblate (French)
---
crm_operating_unit/i18n/fr.po | 40 +++++++++++++++++++++++++++++++++++
1 file changed, 40 insertions(+)
create mode 100644 crm_operating_unit/i18n/fr.po
diff --git a/crm_operating_unit/i18n/fr.po b/crm_operating_unit/i18n/fr.po
new file mode 100644
index 0000000000..338e9c1c94
--- /dev/null
+++ b/crm_operating_unit/i18n/fr.po
@@ -0,0 +1,40 @@
+# Translation of Odoo Server.
+# This file contains the translation of the following modules:
+# * crm_operating_unit
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: Odoo Server 14.0\n"
+"Report-Msgid-Bugs-To: \n"
+"Last-Translator: Automatically generated\n"
+"Language-Team: none\n"
+"Language: fr\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: \n"
+"Plural-Forms: nplurals=2; plural=n > 1;\n"
+
+#. module: crm_operating_unit
+#: model:ir.model.fields,field_description:crm_operating_unit.field_crm_lead__display_name
+msgid "Display Name"
+msgstr ""
+
+#. module: crm_operating_unit
+#: model:ir.model.fields,field_description:crm_operating_unit.field_crm_lead__id
+msgid "ID"
+msgstr ""
+
+#. module: crm_operating_unit
+#: model:ir.model.fields,field_description:crm_operating_unit.field_crm_lead____last_update
+msgid "Last Modified on"
+msgstr ""
+
+#. module: crm_operating_unit
+#: model:ir.model,name:crm_operating_unit.model_crm_lead
+msgid "Lead/Opportunity"
+msgstr ""
+
+#. module: crm_operating_unit
+#: model:ir.model.fields,field_description:crm_operating_unit.field_crm_lead__operating_unit_id
+msgid "Operating Unit"
+msgstr ""
From 78dfae6b42faf861b35fbc3c101248a6c95539b8 Mon Sep 17 00:00:00 2001
From: Khalid Hazam
Date: Tue, 28 Jun 2022 08:27:19 +0000
Subject: [PATCH 21/26] Translated using Weblate (French)
Currently translated at 100.0% (5 of 5 strings)
Translation: operating-unit-14.0/operating-unit-14.0-crm_operating_unit
Translate-URL: https://translation.odoo-community.org/projects/operating-unit-14-0/operating-unit-14-0-crm_operating_unit/fr/
---
crm_operating_unit/i18n/fr.po | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/crm_operating_unit/i18n/fr.po b/crm_operating_unit/i18n/fr.po
index 338e9c1c94..397740a72b 100644
--- a/crm_operating_unit/i18n/fr.po
+++ b/crm_operating_unit/i18n/fr.po
@@ -6,35 +6,37 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
-"Last-Translator: Automatically generated\n"
+"PO-Revision-Date: 2022-06-28 11:05+0000\n"
+"Last-Translator: Khalid Hazam \n"
"Language-Team: none\n"
"Language: fr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n > 1;\n"
+"X-Generator: Weblate 4.3.2\n"
#. module: crm_operating_unit
#: model:ir.model.fields,field_description:crm_operating_unit.field_crm_lead__display_name
msgid "Display Name"
-msgstr ""
+msgstr "Nom affiché"
#. module: crm_operating_unit
#: model:ir.model.fields,field_description:crm_operating_unit.field_crm_lead__id
msgid "ID"
-msgstr ""
+msgstr "Id"
#. module: crm_operating_unit
#: model:ir.model.fields,field_description:crm_operating_unit.field_crm_lead____last_update
msgid "Last Modified on"
-msgstr ""
+msgstr "Dernière modification le"
#. module: crm_operating_unit
#: model:ir.model,name:crm_operating_unit.model_crm_lead
msgid "Lead/Opportunity"
-msgstr ""
+msgstr "Piste/Opportunité"
#. module: crm_operating_unit
#: model:ir.model.fields,field_description:crm_operating_unit.field_crm_lead__operating_unit_id
msgid "Operating Unit"
-msgstr ""
+msgstr "Unité opérationnelle"
From 00e3a31d2e860576f5c660e0e41ac25aa6004396 Mon Sep 17 00:00:00 2001
From: Rajan Soni
Date: Fri, 13 Jan 2023 22:02:32 +0100
Subject: [PATCH 22/26] [MIG] Migreted crm_operating_unit in v15
---
crm_operating_unit/README.rst | 23 ++++++-----
crm_operating_unit/__manifest__.py | 2 +-
.../i18n/crm_operating_unit.pot | 17 +--------
.../static/description/index.html | 38 ++++++++++---------
.../tests/test_crm_operating_unit.py | 2 +-
5 files changed, 36 insertions(+), 46 deletions(-)
diff --git a/crm_operating_unit/README.rst b/crm_operating_unit/README.rst
index 7d97540e7f..3180bc49c7 100644
--- a/crm_operating_unit/README.rst
+++ b/crm_operating_unit/README.rst
@@ -2,10 +2,13 @@
Operating Unit in CRM
=====================
-.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+..
+ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ !! source digest: sha256:4d330965e116d2f84bc1078025e9bdef627786ca6406c2f2e93f21c3929d946a
+ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
@@ -14,16 +17,16 @@ Operating Unit in CRM
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
:alt: License: LGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Foperating--unit-lightgray.png?logo=github
- :target: https://github.com/OCA/operating-unit/tree/14.0/crm_operating_unit
+ :target: https://github.com/OCA/operating-unit/tree/15.0/crm_operating_unit
:alt: OCA/operating-unit
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
- :target: https://translation.odoo-community.org/projects/operating-unit-14-0/operating-unit-14-0-crm_operating_unit
+ :target: https://translation.odoo-community.org/projects/operating-unit-15-0/operating-unit-15-0-crm_operating_unit
:alt: Translate me on Weblate
-.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
- :target: https://runbot.odoo-community.org/runbot/213/14.0
- :alt: Try me on Runbot
+.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
+ :target: https://runboat.odoo-community.org/builds?repo=OCA/operating-unit&target_branch=15.0
+ :alt: Try me on Runboat
-|badge1| |badge2| |badge3| |badge4| |badge5|
+|badge1| |badge2| |badge3| |badge4| |badge5|
This module introduces the following features:
@@ -43,8 +46,8 @@ Bug Tracker
Bugs are tracked on `GitHub 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 `_.
+If you spotted it first, help us to smash it by providing a detailed and welcomed
+`feedback `_.
Do not contact contributors directly about support or help with technical issues.
@@ -77,6 +80,6 @@ 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.
-This module is part of the `OCA/operating-unit `_ project on GitHub.
+This module is part of the `OCA/operating-unit `_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
diff --git a/crm_operating_unit/__manifest__.py b/crm_operating_unit/__manifest__.py
index badf72cf26..423562147c 100644
--- a/crm_operating_unit/__manifest__.py
+++ b/crm_operating_unit/__manifest__.py
@@ -4,7 +4,7 @@
{
"name": "Operating Unit in CRM",
- "version": "14.0.1.0.0",
+ "version": "15.0.1.0.0",
"author": "ForgeFlow, "
"Serpent Consulting Services Pvt. Ltd.,"
"Odoo Community Association (OCA)",
diff --git a/crm_operating_unit/i18n/crm_operating_unit.pot b/crm_operating_unit/i18n/crm_operating_unit.pot
index 2c2e69cf43..52da42954b 100644
--- a/crm_operating_unit/i18n/crm_operating_unit.pot
+++ b/crm_operating_unit/i18n/crm_operating_unit.pot
@@ -4,7 +4,7 @@
#
msgid ""
msgstr ""
-"Project-Id-Version: Odoo Server 14.0\n"
+"Project-Id-Version: Odoo Server 15.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: \n"
"Language-Team: \n"
@@ -13,21 +13,6 @@ msgstr ""
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
-#. module: crm_operating_unit
-#: model:ir.model.fields,field_description:crm_operating_unit.field_crm_lead__display_name
-msgid "Display Name"
-msgstr ""
-
-#. module: crm_operating_unit
-#: model:ir.model.fields,field_description:crm_operating_unit.field_crm_lead__id
-msgid "ID"
-msgstr ""
-
-#. module: crm_operating_unit
-#: model:ir.model.fields,field_description:crm_operating_unit.field_crm_lead____last_update
-msgid "Last Modified on"
-msgstr ""
-
#. module: crm_operating_unit
#: model:ir.model,name:crm_operating_unit.model_crm_lead
msgid "Lead/Opportunity"
diff --git a/crm_operating_unit/static/description/index.html b/crm_operating_unit/static/description/index.html
index a4f52175f4..64d83592ee 100644
--- a/crm_operating_unit/static/description/index.html
+++ b/crm_operating_unit/static/description/index.html
@@ -1,20 +1,20 @@
-
+
-
+
Operating Unit in CRM