Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
re2o
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nounous
re2o
Commits
42d718ae
Commit
42d718ae
authored
Oct 15, 2018
by
Gabriel Detraz
Committed by
root
Oct 15, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix display facture + room + machine_name
parent
510d7ab3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
9 deletions
+14
-9
cotisations/models.py
cotisations/models.py
+8
-6
machines/models.py
machines/models.py
+5
-1
users/models.py
users/models.py
+1
-2
No files found.
cotisations/models.py
View file @
42d718ae
...
...
@@ -194,12 +194,14 @@ class Facture(BaseInvoice):
return
True
,
None
def
can_view
(
self
,
user_request
,
*
_args
,
**
_kwargs
):
if
not
user_request
.
has_perm
(
'cotisations.view_facture'
)
and
\
self
.
user
!=
user_request
:
return
False
,
_
(
"You don't have the right to view someone else's "
"invoices history."
)
elif
not
self
.
valid
:
return
False
,
_
(
"The invoice has been invalidated."
)
if
not
user_request
.
has_perm
(
'cotisations.view_facture'
):
if
self
.
user
!=
user_request
:
return
False
,
_
(
"You don't have the right to view someone else's "
"invoices history."
)
elif
not
self
.
valid
:
return
False
,
_
(
"The invoice has been invalidated."
)
else
:
return
True
,
None
else
:
return
True
,
None
...
...
machines/models.py
View file @
42d718ae
...
...
@@ -197,7 +197,11 @@ class Machine(RevMixin, FieldPermissionModelMixin, models.Model):
def
short_name
(
self
):
"""Par defaut, renvoie le nom de la première interface
de cette machine"""
return
str
(
self
.
interface_set
.
first
().
domain
.
name
)
interfaces_set
=
self
.
interface_set
.
first
()
if
interfaces_set
:
return
str
(
interfaces_set
.
domain
.
name
)
else
:
return
"None"
@
cached_property
def
complete_name
(
self
):
...
...
users/models.py
View file @
42d718ae
...
...
@@ -845,8 +845,7 @@ class User(RevMixin, FieldPermissionModelMixin, AbstractBaseUser,
"""
return
user_request
==
self
,
None
@
staticmethod
def
can_change_room
(
user_request
,
*
_args
,
**
_kwargs
):
def
can_change_room
(
self
,
user_request
,
*
_args
,
**
_kwargs
):
""" Check if a user can change a room
:param user_request: The user who request
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment