odoo-somconnexio-python-client 0.2.2__tar.gz → 0.2.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.4}/PKG-INFO +3 -1
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.4}/README.md +2 -0
- odoo_somconnexio_python_client-0.2.4/odoo_somconnexio_python_client/__init__.py +1 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.4}/odoo_somconnexio_python_client/resources/partner.py +25 -1
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.4}/odoo_somconnexio_python_client/resources/project_task.py +26 -1
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.4}/odoo_somconnexio_python_client.egg-info/PKG-INFO +3 -1
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.4}/tests/resources/test_partner.py +30 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.4}/tests/resources/test_project_task.py +29 -1
- odoo_somconnexio_python_client-0.2.2/odoo_somconnexio_python_client/__init__.py +0 -1
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.4}/LICENSE +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.4}/odoo_somconnexio_python_client/client.py +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.4}/odoo_somconnexio_python_client/exceptions.py +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.4}/odoo_somconnexio_python_client/helpers.py +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.4}/odoo_somconnexio_python_client/resources/__init__.py +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.4}/odoo_somconnexio_python_client/resources/address.py +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.4}/odoo_somconnexio_python_client/resources/broadband_isp_info.py +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.4}/odoo_somconnexio_python_client/resources/contract.py +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.4}/odoo_somconnexio_python_client/resources/coop_agreement.py +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.4}/odoo_somconnexio_python_client/resources/crm_lead.py +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.4}/odoo_somconnexio_python_client/resources/crm_lead_line.py +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.4}/odoo_somconnexio_python_client/resources/discovery_channel.py +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.4}/odoo_somconnexio_python_client/resources/documents.py +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.4}/odoo_somconnexio_python_client/resources/fiber_contracts.py +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.4}/odoo_somconnexio_python_client/resources/invoice.py +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.4}/odoo_somconnexio_python_client/resources/knowledge.py +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.4}/odoo_somconnexio_python_client/resources/mobile_isp_info.py +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.4}/odoo_somconnexio_python_client/resources/mobile_offer_catalog.py +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.4}/odoo_somconnexio_python_client/resources/multimedia_contract.py +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.4}/odoo_somconnexio_python_client/resources/odoo_paging.py +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.4}/odoo_somconnexio_python_client/resources/one_shot_catalog.py +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.4}/odoo_somconnexio_python_client/resources/product_catalog.py +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.4}/odoo_somconnexio_python_client/resources/provider.py +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.4}/odoo_somconnexio_python_client/resources/sponsees.py +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.4}/odoo_somconnexio_python_client/resources/subscription_request.py +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.4}/odoo_somconnexio_python_client.egg-info/SOURCES.txt +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.4}/odoo_somconnexio_python_client.egg-info/dependency_links.txt +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.4}/odoo_somconnexio_python_client.egg-info/not-zip-safe +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.4}/odoo_somconnexio_python_client.egg-info/requires.txt +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.4}/odoo_somconnexio_python_client.egg-info/top_level.txt +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.4}/setup.cfg +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.4}/setup.py +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.4}/tests/resources/__init__.py +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.4}/tests/resources/test_address.py +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.4}/tests/resources/test_contract.py +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.4}/tests/resources/test_coop_agreement.py +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.4}/tests/resources/test_crm_lead.py +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.4}/tests/resources/test_discovery_channel.py +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.4}/tests/resources/test_documents.py +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.4}/tests/resources/test_fiber_contracts.py +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.4}/tests/resources/test_invoice.py +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.4}/tests/resources/test_knowledge.py +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.4}/tests/resources/test_mobile_offer_catalog.py +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.4}/tests/resources/test_multimedia_contract.py +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.4}/tests/resources/test_one_shot_catalog.py +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.4}/tests/resources/test_product_catalog.py +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.4}/tests/resources/test_providers.py +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.4}/tests/resources/test_subscription_request.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: odoo_somconnexio_python_client
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.4
|
|
4
4
|
Summary: Python wrapper for SomConnexio's Odoo (using REST API)
|
|
5
5
|
Home-page: https://gitlab.com/coopdevs/odoo-somconnexio-python-client
|
|
6
6
|
Author: Coopdevs
|
|
@@ -33,6 +33,8 @@ More info about the customizations in [SomConnexio Odoo module](https://gitlab.c
|
|
|
33
33
|
* Contract - Contract information
|
|
34
34
|
* ProductCatalog - Sales product variants
|
|
35
35
|
* CoopAgreement - lit for coop agreement code
|
|
36
|
+
* ProjectTask - Odoo project task information
|
|
37
|
+
* EsimChangeProjectTask - SIM to eSIM change request
|
|
36
38
|
|
|
37
39
|
## Installation
|
|
38
40
|
|
|
@@ -16,6 +16,8 @@ More info about the customizations in [SomConnexio Odoo module](https://gitlab.c
|
|
|
16
16
|
* Contract - Contract information
|
|
17
17
|
* ProductCatalog - Sales product variants
|
|
18
18
|
* CoopAgreement - lit for coop agreement code
|
|
19
|
+
* ProjectTask - Odoo project task information
|
|
20
|
+
* EsimChangeProjectTask - SIM to eSIM change request
|
|
19
21
|
|
|
20
22
|
## Installation
|
|
21
23
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.2.4"
|
|
@@ -82,11 +82,12 @@ class Partner:
|
|
|
82
82
|
def check_sponsor(cls, vat, sponsor_code):
|
|
83
83
|
"""
|
|
84
84
|
Check if partner can sponsor new partners.
|
|
85
|
+
Check a sponsorship code against the VAT number
|
|
85
86
|
|
|
86
87
|
:return: True or False
|
|
87
88
|
"""
|
|
88
89
|
if not vat or not sponsor_code:
|
|
89
|
-
return False
|
|
90
|
+
return False, "sponsor_code and vat number are required"
|
|
90
91
|
|
|
91
92
|
url = "{}/{}".format(cls._url_path, "check_sponsor")
|
|
92
93
|
params = {
|
|
@@ -101,6 +102,29 @@ class Partner:
|
|
|
101
102
|
raise ResourceNotFound(resource=cls.__name__, filter=params)
|
|
102
103
|
return response_data["result"] == "allowed", response_data["message"]
|
|
103
104
|
|
|
105
|
+
@classmethod
|
|
106
|
+
def check_sponsor_code(cls, sponsor_code):
|
|
107
|
+
"""
|
|
108
|
+
Check if partner can sponsor new partners.
|
|
109
|
+
Check a sponsorship code
|
|
110
|
+
|
|
111
|
+
:return: True or False
|
|
112
|
+
"""
|
|
113
|
+
if not sponsor_code:
|
|
114
|
+
return False, "sponsor_code is required"
|
|
115
|
+
|
|
116
|
+
url = "{}/{}".format(cls._url_path, "check_sponsor_code")
|
|
117
|
+
params = {
|
|
118
|
+
"sponsor_code": sponsor_code,
|
|
119
|
+
}
|
|
120
|
+
response_data = Client().get(
|
|
121
|
+
url,
|
|
122
|
+
params=params,
|
|
123
|
+
)
|
|
124
|
+
if not response_data:
|
|
125
|
+
raise ResourceNotFound(resource=cls.__name__, filter=params)
|
|
126
|
+
return response_data["result"] == "allowed", response_data["message"]
|
|
127
|
+
|
|
104
128
|
@classmethod
|
|
105
129
|
def sponsees(cls, ref):
|
|
106
130
|
"""
|
|
@@ -6,6 +6,9 @@ from ..exceptions import ResourceNotFound, HTTPError
|
|
|
6
6
|
class ProjectTask:
|
|
7
7
|
_name = "project_task"
|
|
8
8
|
_url_path = "/project_tasks"
|
|
9
|
+
# Subresource appended to `_url_path` on create. Subclasses that open a
|
|
10
|
+
# specific kind of task define it to post to their own endpoint.
|
|
11
|
+
_create_path = None
|
|
9
12
|
|
|
10
13
|
def __init__(
|
|
11
14
|
self,
|
|
@@ -38,6 +41,17 @@ class ProjectTask:
|
|
|
38
41
|
self.tag_ids = tag_ids or []
|
|
39
42
|
self.sequence = sequence
|
|
40
43
|
|
|
44
|
+
@classmethod
|
|
45
|
+
def _create_url(cls):
|
|
46
|
+
"""
|
|
47
|
+
URL the `create` request is sent to: the resource path, extended with
|
|
48
|
+
`_create_path` when the subclass defines one.
|
|
49
|
+
"""
|
|
50
|
+
if cls._create_path:
|
|
51
|
+
return "{}/{}".format(cls._url_path, cls._create_path)
|
|
52
|
+
|
|
53
|
+
return cls._url_path
|
|
54
|
+
|
|
41
55
|
@classmethod
|
|
42
56
|
def get(cls, id):
|
|
43
57
|
"""
|
|
@@ -83,7 +97,7 @@ class ProjectTask:
|
|
|
83
97
|
:param kwargs: ProjectTask fields
|
|
84
98
|
:return: ProjectTask object (created)
|
|
85
99
|
"""
|
|
86
|
-
response_data = Client().post(cls.
|
|
100
|
+
response_data = Client().post(cls._create_url(), kwargs)
|
|
87
101
|
if not response_data:
|
|
88
102
|
raise HTTPError(
|
|
89
103
|
"Unexpected empty response creating {} with data: {}".format(
|
|
@@ -115,3 +129,14 @@ class ProjectTask:
|
|
|
115
129
|
)
|
|
116
130
|
|
|
117
131
|
return cls(**response_data)
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
class EsimChangeProjectTask(ProjectTask):
|
|
135
|
+
"""
|
|
136
|
+
Task opening a SIM to eSIM change. The task name, project and properties
|
|
137
|
+
are resolved in Odoo from the contract, so `create` only expects
|
|
138
|
+
`partner_ref` and `contract_code`.
|
|
139
|
+
"""
|
|
140
|
+
|
|
141
|
+
_name = "esim_change_project_task"
|
|
142
|
+
_create_path = "esim-change"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: odoo-somconnexio-python-client
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.4
|
|
4
4
|
Summary: Python wrapper for SomConnexio's Odoo (using REST API)
|
|
5
5
|
Home-page: https://gitlab.com/coopdevs/odoo-somconnexio-python-client
|
|
6
6
|
Author: Coopdevs
|
|
@@ -33,6 +33,8 @@ More info about the customizations in [SomConnexio Odoo module](https://gitlab.c
|
|
|
33
33
|
* Contract - Contract information
|
|
34
34
|
* ProductCatalog - Sales product variants
|
|
35
35
|
* CoopAgreement - lit for coop agreement code
|
|
36
|
+
* ProjectTask - Odoo project task information
|
|
37
|
+
* EsimChangeProjectTask - SIM to eSIM change request
|
|
36
38
|
|
|
37
39
|
## Installation
|
|
38
40
|
|
|
@@ -35,6 +35,16 @@ class PartnerTests(unittest.TestCase):
|
|
|
35
35
|
assert "new_service" in partner.banned_actions
|
|
36
36
|
self.assertFalse(partner.is_company)
|
|
37
37
|
|
|
38
|
+
def test_check_sponsor_ko_sponsor_code_not_informed(self):
|
|
39
|
+
result, message = Partner.check_sponsor("ES12345678X", "")
|
|
40
|
+
assert not result
|
|
41
|
+
assert message == "sponsor_code and vat number are required"
|
|
42
|
+
|
|
43
|
+
def test_check_sponsor_ko_vat_not_informed(self):
|
|
44
|
+
result, message = Partner.check_sponsor("", "XXXXX")
|
|
45
|
+
assert not result
|
|
46
|
+
assert message == "sponsor_code and vat number are required"
|
|
47
|
+
|
|
38
48
|
@pytest.mark.vcr()
|
|
39
49
|
def test_check_sponsor_ok(self):
|
|
40
50
|
sponsor_code = "cac3c"
|
|
@@ -62,6 +72,26 @@ class PartnerTests(unittest.TestCase):
|
|
|
62
72
|
assert not result
|
|
63
73
|
assert message == "invalid code or vat number"
|
|
64
74
|
|
|
75
|
+
def test_check_sponsor_code_ko_code_not_informed(self):
|
|
76
|
+
sponsor_code = ""
|
|
77
|
+
result, message = Partner.check_sponsor_code(sponsor_code)
|
|
78
|
+
assert not result
|
|
79
|
+
assert message == "sponsor_code is required"
|
|
80
|
+
|
|
81
|
+
@pytest.mark.vcr()
|
|
82
|
+
def test_check_sponsor_code_ko_code_not_found(self):
|
|
83
|
+
sponsor_code = "XXXXX"
|
|
84
|
+
result, message = Partner.check_sponsor_code(sponsor_code)
|
|
85
|
+
assert not result
|
|
86
|
+
assert message == "invalid code"
|
|
87
|
+
|
|
88
|
+
@pytest.mark.vcr()
|
|
89
|
+
def test_check_sponsor_code_ok(self):
|
|
90
|
+
sponsor_code = "KPWMO"
|
|
91
|
+
result, message = Partner.check_sponsor_code(sponsor_code)
|
|
92
|
+
assert result
|
|
93
|
+
assert message == "ok"
|
|
94
|
+
|
|
65
95
|
@pytest.mark.vcr()
|
|
66
96
|
def test_get_sponsees_not_found(self):
|
|
67
97
|
self.assertRaises(ResourceNotFound, Partner.sponsees, ref="NOT_EXISTS")
|
|
@@ -2,7 +2,10 @@ import pytest
|
|
|
2
2
|
import unittest2 as unittest
|
|
3
3
|
|
|
4
4
|
from odoo_somconnexio_python_client.exceptions import ResourceNotFound
|
|
5
|
-
from odoo_somconnexio_python_client.resources.project_task import
|
|
5
|
+
from odoo_somconnexio_python_client.resources.project_task import (
|
|
6
|
+
EsimChangeProjectTask,
|
|
7
|
+
ProjectTask,
|
|
8
|
+
)
|
|
6
9
|
|
|
7
10
|
|
|
8
11
|
def assert_model(project_task, name="Implement authentication"):
|
|
@@ -70,3 +73,28 @@ class ProjectTaskTests(unittest.TestCase):
|
|
|
70
73
|
project_task = ProjectTask.update(id=1, **update_data)
|
|
71
74
|
|
|
72
75
|
assert_model(project_task, name="Updated task name")
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
class EsimChangeProjectTaskTests(unittest.TestCase):
|
|
79
|
+
@pytest.mark.vcr()
|
|
80
|
+
def test_create(self):
|
|
81
|
+
esim_change_data = {
|
|
82
|
+
"partner_ref": "1234",
|
|
83
|
+
"contract_code": "1",
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
esim_change_task = EsimChangeProjectTask.create(**esim_change_data)
|
|
87
|
+
|
|
88
|
+
assert esim_change_task.id == 78
|
|
89
|
+
assert esim_change_task.name == "Canvi a eSIM 654987654"
|
|
90
|
+
assert esim_change_task.description is None
|
|
91
|
+
assert esim_change_task.project_id == 14
|
|
92
|
+
assert esim_change_task.partner_phone == "654987654"
|
|
93
|
+
assert esim_change_task.partner_email == "felipdata@demo.net"
|
|
94
|
+
assert esim_change_task.priority == "0"
|
|
95
|
+
assert esim_change_task.kanban_state == "normal"
|
|
96
|
+
assert esim_change_task.partner_id == 78
|
|
97
|
+
assert esim_change_task.stage_id == 35
|
|
98
|
+
assert esim_change_task.date_deadline is None
|
|
99
|
+
assert esim_change_task.tag_ids == []
|
|
100
|
+
assert esim_change_task.sequence == 10
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.2.2"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|