Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
odoo-somconnexio-python-client
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Coopdevs
Som Connexió
Odoo
odoo-somconnexio-python-client
Merge requests
!38
Add contract model
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Add contract model
add-contract-model
into
master
Overview
0
Commits
6
Pipelines
12
Changes
7
Merged
Gerard Funosas
requested to merge
add-contract-model
into
master
2 years ago
Overview
0
Commits
6
Pipelines
12
Changes
7
Expand
0
0
Merge request reports
Compare
master
version 5
cb6e00df
2 years ago
version 4
d12721ac
2 years ago
version 3
a14b579e
2 years ago
version 2
c6ef13d3
2 years ago
version 1
fac3f9cf
2 years ago
master (base)
and
latest version
latest version
3e426846
6 commits,
2 years ago
version 5
cb6e00df
5 commits,
2 years ago
version 4
d12721ac
5 commits,
2 years ago
version 3
a14b579e
4 commits,
2 years ago
version 2
c6ef13d3
3 commits,
2 years ago
version 1
fac3f9cf
3 commits,
2 years ago
7 files
+
279
−
4
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
7
Search (e.g. *.vue) (Ctrl+P)
odoo_somconnexio_python_client/resources/contract.py
0 → 100644
+
85
−
0
Options
from
odoo_somconnexio_python_client.client
import
Client
from
..exceptions
import
ResourceNotFound
class
Contract
:
_url_path
=
"
/contract
"
# TODO: Add all the needed fields in the future...
def
__init__
(
self
,
id
,
code
,
customer_firstname
,
customer_lastname
,
customer_ref
,
customer_vat
,
phone_number
,
current_tariff_product
,
technology
,
supplier
,
iban
,
ticket_number
,
date_start
,
date_end
,
is_terminated
,
**
kwargs
):
self
.
id
=
id
self
.
code
=
code
self
.
customer_firstname
=
customer_firstname
self
.
customer_lastname
=
customer_lastname
self
.
customer_ref
=
customer_ref
self
.
customer_vat
=
customer_vat
self
.
phone_number
=
phone_number
self
.
current_tariff_product
=
current_tariff_product
self
.
technology
=
technology
self
.
supplier
=
supplier
self
.
iban
=
iban
self
.
ticket_number
=
ticket_number
self
.
date_start
=
date_start
self
.
date_end
=
date_end
self
.
is_terminated
=
is_terminated
@classmethod
def
search_by_customer_vat
(
cls
,
vat
):
"""
Search Contract in Odoo by partner
'
s vat.
:return: Contract object if exists
"""
return
cls
.
_get
(
params
=
{
"
partner_vat
"
:
vat
,
}
)
@classmethod
def
search_by_phone_number
(
cls
,
phone_number
):
"""
Search Contract in Odoo by phone number.
:return: Contract object if exists
"""
return
cls
.
_get
(
params
=
{
"
phone_number
"
:
phone_number
,
}
)
@classmethod
def
_get
(
cls
,
id
=
None
,
params
=
{}):
if
id
:
url
=
"
{}/{}
"
.
format
(
cls
.
_url_path
,
id
)
else
:
url
=
cls
.
_url_path
response_data
=
Client
().
get
(
url
,
params
=
params
,
)
if
not
response_data
:
raise
ResourceNotFound
(
resource
=
cls
.
__name__
,
filter
=
params
)
return
[
cls
(
**
contract_found
)
for
contract_found
in
response_data
]
Loading