Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
R
red-ci-cd
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
red-group-test
red-ci-cd
Commits
a5a2486b
Commit
a5a2486b
authored
Mar 18, 2020
by
Gladys Forte
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
{devbugfix} asset type, asset, asset group, asset stocks archived list
parent
cd7ea6df
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
189 additions
and
10 deletions
+189
-10
app/applicationlayer/ams/asset/serializers.py
app/applicationlayer/ams/asset/serializers.py
+1
-2
app/applicationlayer/ams/asset/table_filters.py
app/applicationlayer/ams/asset/table_filters.py
+1
-1
app/applicationlayer/ams/asset/views.py
app/applicationlayer/ams/asset/views.py
+28
-1
app/applicationlayer/ams/asset_group/serializers.py
app/applicationlayer/ams/asset_group/serializers.py
+1
-1
app/applicationlayer/ams/asset_group/views.py
app/applicationlayer/ams/asset_group/views.py
+31
-0
app/applicationlayer/ams/asset_stock/views.py
app/applicationlayer/ams/asset_stock/views.py
+28
-0
app/applicationlayer/ams/asset_type/views.py
app/applicationlayer/ams/asset_type/views.py
+31
-0
app/entities/migrations/0010_auto_20200318_1046.py
app/entities/migrations/0010_auto_20200318_1046.py
+58
-0
app/entities/models.py
app/entities/models.py
+10
-5
No files found.
app/applicationlayer/ams/asset/serializers.py
View file @
a5a2486b
...
@@ -10,10 +10,9 @@ class AMSAssetSerializer(serializers.ModelSerializer):
...
@@ -10,10 +10,9 @@ class AMSAssetSerializer(serializers.ModelSerializer):
ret
[
'in_qty'
]
=
instance
.
ams_asset_to_assetdetail
.
filter
(
status
=
'In-Store'
)
.
count
()
ret
[
'in_qty'
]
=
instance
.
ams_asset_to_assetdetail
.
filter
(
status
=
'In-Store'
)
.
count
()
ret
[
'out_qty'
]
=
instance
.
ams_asset_to_assetdetail
.
filter
(
status
=
'Deployed'
)
.
count
()
ret
[
'out_qty'
]
=
instance
.
ams_asset_to_assetdetail
.
filter
(
status
=
'Deployed'
)
.
count
()
ret
[
'unavailable'
]
=
instance
.
ams_asset_to_assetdetail
.
filter
(
status
=
'Faulty'
)
.
count
()
ret
[
'unavailable'
]
=
instance
.
ams_asset_to_assetdetail
.
filter
(
status
=
'Faulty'
)
.
count
()
ret
[
'created_by'
]
=
instance
.
created_by
.
name
,
ret
[
'created_by'
]
=
instance
.
created_by
.
name
return
ret
return
ret
class
Meta
:
class
Meta
:
model
=
AMSAsset
model
=
AMSAsset
fields
=
'__all__'
fields
=
'__all__'
...
...
app/applicationlayer/ams/asset/table_filters.py
View file @
a5a2486b
...
@@ -6,4 +6,4 @@ class AMSAssetFilter(filters.FilterSet):
...
@@ -6,4 +6,4 @@ class AMSAssetFilter(filters.FilterSet):
class
Meta
:
class
Meta
:
model
=
AMSAsset
model
=
AMSAsset
fields
=
'__all__'
fields
=
'__all__'
\ No newline at end of file
app/applicationlayer/ams/asset/views.py
View file @
a5a2486b
...
@@ -10,6 +10,7 @@ from django.db import transaction
...
@@ -10,6 +10,7 @@ from django.db import transaction
from
app.applicationlayer.utils
import
(
from
app.applicationlayer.utils
import
(
CustomPagination
,
status_message_response
CustomPagination
,
status_message_response
)
)
from
rest_framework.decorators
import
action
class
AMSAssetViewSet
(
viewsets
.
ModelViewSet
):
class
AMSAssetViewSet
(
viewsets
.
ModelViewSet
):
...
@@ -70,7 +71,6 @@ class AMSAssetViewSet(viewsets.ModelViewSet):
...
@@ -70,7 +71,6 @@ class AMSAssetViewSet(viewsets.ModelViewSet):
message
message
)
)
def
retrieve
(
self
,
request
,
*
args
,
**
kwargs
):
def
retrieve
(
self
,
request
,
*
args
,
**
kwargs
):
instance
=
self
.
get_object
()
instance
=
self
.
get_object
()
serializer
=
self
.
get_serializer
(
instance
)
serializer
=
self
.
get_serializer
(
instance
)
...
@@ -84,5 +84,32 @@ class AMSAssetViewSet(viewsets.ModelViewSet):
...
@@ -84,5 +84,32 @@ class AMSAssetViewSet(viewsets.ModelViewSet):
return
Response
(
status
=
status
.
HTTP_204_NO_CONTENT
)
return
Response
(
status
=
status
.
HTTP_204_NO_CONTENT
)
@
action
(
methods
=
[
'GET'
],
detail
=
False
,
url_path
=
'archived'
,
url_name
=
'archived'
)
def
archived
(
self
,
request
,
*
args
,
**
kwargs
):
queryset
=
self
.
filter_queryset
(
self
.
get_queryset
())
queryset
=
queryset
.
filter
(
is_active
=
False
)
page
=
self
.
paginate_queryset
(
queryset
)
if
page
is
not
None
:
serializer
=
self
.
get_serializer
(
page
,
many
=
True
)
message
=
status_message_response
(
200
,
'success'
,
'List of Archived Assets found'
,
serializer
.
data
)
return
self
.
get_paginated_response
(
message
)
serializer
=
self
.
get_serializer
(
self
.
queryset
,
many
=
True
)
return
Response
(
serializer
.
data
,
status
=
status
.
HTTP_200_OK
)
\ No newline at end of file
app/applicationlayer/ams/asset_group/serializers.py
View file @
a5a2486b
...
@@ -9,7 +9,7 @@ class AssetGroupSerializer(serializers.ModelSerializer):
...
@@ -9,7 +9,7 @@ class AssetGroupSerializer(serializers.ModelSerializer):
ret
=
super
()
.
to_representation
(
instance
)
ret
=
super
()
.
to_representation
(
instance
)
asset_stocks
=
models
.
AMSAssetStock
.
objects
.
filter
(
asset_group
=
instance
.
code
)
asset_stocks
=
models
.
AMSAssetStock
.
objects
.
filter
(
asset_group
=
instance
.
code
)
asset_counter
=
0
asset_counter
=
0
asset_type_counter
=
0
asset_type_counter
=
0
for
asset_stock
in
asset_stocks
:
for
asset_stock
in
asset_stocks
:
...
...
app/applicationlayer/ams/asset_group/views.py
View file @
a5a2486b
...
@@ -11,6 +11,7 @@ from app.applicationlayer.utils import (
...
@@ -11,6 +11,7 @@ from app.applicationlayer.utils import (
)
)
from
app.helper
import
decorators
from
app.helper
import
decorators
from
django.db
import
transaction
from
django.db
import
transaction
from
rest_framework.decorators
import
action
class
AssetGroupViewset
(
viewsets
.
ModelViewSet
):
class
AssetGroupViewset
(
viewsets
.
ModelViewSet
):
...
@@ -82,3 +83,33 @@ class AssetGroupViewset(viewsets.ModelViewSet):
...
@@ -82,3 +83,33 @@ class AssetGroupViewset(viewsets.ModelViewSet):
self
.
perform_destroy
(
instance
)
self
.
perform_destroy
(
instance
)
return
Response
(
status
=
status
.
HTTP_204_NO_CONTENT
)
return
Response
(
status
=
status
.
HTTP_204_NO_CONTENT
)
@
action
(
methods
=
[
'GET'
],
detail
=
False
,
url_path
=
'archived'
,
url_name
=
'archived'
)
def
archived
(
self
,
request
,
*
args
,
**
kwargs
):
queryset
=
self
.
filter_queryset
(
self
.
get_queryset
())
queryset
=
queryset
.
filter
(
is_active
=
False
)
page
=
self
.
paginate_queryset
(
queryset
)
if
page
is
not
None
:
serializer
=
self
.
get_serializer
(
page
,
many
=
True
)
message
=
status_message_response
(
200
,
'success'
,
'List of Archived Asset Groups found'
,
serializer
.
data
)
return
self
.
get_paginated_response
(
message
)
serializer
=
self
.
get_serializer
(
self
.
queryset
,
many
=
True
)
return
Response
(
serializer
.
data
,
status
=
status
.
HTTP_200_OK
)
app/applicationlayer/ams/asset_stock/views.py
View file @
a5a2486b
...
@@ -10,6 +10,7 @@ from django.db import transaction
...
@@ -10,6 +10,7 @@ from django.db import transaction
from
app.applicationlayer.utils
import
(
from
app.applicationlayer.utils
import
(
CustomPagination
,
status_message_response
CustomPagination
,
status_message_response
)
)
from
rest_framework.decorators
import
action
class
AMSAssetStockViewSet
(
viewsets
.
ModelViewSet
):
class
AMSAssetStockViewSet
(
viewsets
.
ModelViewSet
):
...
@@ -86,5 +87,32 @@ class AMSAssetStockViewSet(viewsets.ModelViewSet):
...
@@ -86,5 +87,32 @@ class AMSAssetStockViewSet(viewsets.ModelViewSet):
return
Response
(
status
=
status
.
HTTP_204_NO_CONTENT
)
return
Response
(
status
=
status
.
HTTP_204_NO_CONTENT
)
@
action
(
methods
=
[
'GET'
],
detail
=
False
,
url_path
=
'archived'
,
url_name
=
'archived'
)
def
archived
(
self
,
request
,
*
args
,
**
kwargs
):
queryset
=
self
.
filter_queryset
(
self
.
get_queryset
())
queryset
=
queryset
.
filter
(
is_active
=
False
)
page
=
self
.
paginate_queryset
(
queryset
)
if
page
is
not
None
:
serializer
=
self
.
get_serializer
(
page
,
many
=
True
)
message
=
status_message_response
(
200
,
'success'
,
'List of Archived Asset Stocks found'
,
serializer
.
data
)
return
self
.
get_paginated_response
(
message
)
serializer
=
self
.
get_serializer
(
self
.
queryset
,
many
=
True
)
return
Response
(
serializer
.
data
,
status
=
status
.
HTTP_200_OK
)
app/applicationlayer/ams/asset_type/views.py
View file @
a5a2486b
...
@@ -11,6 +11,7 @@ from app.applicationlayer.utils import (
...
@@ -11,6 +11,7 @@ from app.applicationlayer.utils import (
)
)
from
app.helper
import
decorators
from
app.helper
import
decorators
from
django.db
import
transaction
from
django.db
import
transaction
from
rest_framework.decorators
import
action
class
AssetTypeViewset
(
viewsets
.
ModelViewSet
):
class
AssetTypeViewset
(
viewsets
.
ModelViewSet
):
...
@@ -90,3 +91,33 @@ class AssetTypeViewset(viewsets.ModelViewSet):
...
@@ -90,3 +91,33 @@ class AssetTypeViewset(viewsets.ModelViewSet):
self
.
perform_destroy
(
instance
)
self
.
perform_destroy
(
instance
)
return
Response
(
status
=
status
.
HTTP_204_NO_CONTENT
)
return
Response
(
status
=
status
.
HTTP_204_NO_CONTENT
)
@
action
(
methods
=
[
'GET'
],
detail
=
False
,
url_path
=
'archived'
,
url_name
=
'archived'
)
def
archived
(
self
,
request
,
*
args
,
**
kwargs
):
queryset
=
self
.
filter_queryset
(
self
.
get_queryset
())
queryset
=
queryset
.
filter
(
is_active
=
False
)
page
=
self
.
paginate_queryset
(
queryset
)
if
page
is
not
None
:
serializer
=
self
.
get_serializer
(
page
,
many
=
True
)
message
=
status_message_response
(
200
,
'success'
,
'List of Archived Asset Types found'
,
serializer
.
data
)
return
self
.
get_paginated_response
(
message
)
serializer
=
self
.
get_serializer
(
self
.
queryset
,
many
=
True
)
return
Response
(
serializer
.
data
,
status
=
status
.
HTTP_200_OK
)
\ No newline at end of file
app/entities/migrations/0010_auto_20200318_1046.py
0 → 100644
View file @
a5a2486b
# Generated by Django 2.2 on 2020-03-18 10:46
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'entities'
,
'0009_auto_20200317_1203'
),
]
operations
=
[
migrations
.
RemoveField
(
model_name
=
'amsasset'
,
name
=
'deleted_at'
,
),
migrations
.
RemoveField
(
model_name
=
'amsassetgroup'
,
name
=
'deleted_at'
,
),
migrations
.
RemoveField
(
model_name
=
'amsassetstock'
,
name
=
'deleted_at'
,
),
migrations
.
RemoveField
(
model_name
=
'amsassetstocksupport'
,
name
=
'deleted_at'
,
),
migrations
.
RemoveField
(
model_name
=
'amsassettype'
,
name
=
'deleted_at'
,
),
migrations
.
AddField
(
model_name
=
'amsasset'
,
name
=
'is_active'
,
field
=
models
.
BooleanField
(
default
=
True
),
),
migrations
.
AddField
(
model_name
=
'amsassetgroup'
,
name
=
'is_active'
,
field
=
models
.
BooleanField
(
default
=
True
),
),
migrations
.
AddField
(
model_name
=
'amsassetstock'
,
name
=
'is_active'
,
field
=
models
.
BooleanField
(
default
=
True
),
),
migrations
.
AddField
(
model_name
=
'amsassetstocksupport'
,
name
=
'is_active'
,
field
=
models
.
BooleanField
(
default
=
True
),
),
migrations
.
AddField
(
model_name
=
'amsassettype'
,
name
=
'is_active'
,
field
=
models
.
BooleanField
(
default
=
True
),
),
]
app/entities/models.py
View file @
a5a2486b
...
@@ -1286,7 +1286,8 @@ class AMSAssetGroup(models.Model):
...
@@ -1286,7 +1286,8 @@ class AMSAssetGroup(models.Model):
related_name
=
'ams_asset_group_created_by'
related_name
=
'ams_asset_group_created_by'
)
)
created
=
models
.
DateTimeField
(
auto_now_add
=
True
)
created
=
models
.
DateTimeField
(
auto_now_add
=
True
)
deleted_at
=
models
.
DateTimeField
(
null
=
True
,
blank
=
True
)
# deleted_at = models.DateTimeField(null=True, blank=True)
is_active
=
models
.
BooleanField
(
default
=
True
)
class
Meta
:
class
Meta
:
db_table
=
'ams_asset_groups'
db_table
=
'ams_asset_groups'
...
@@ -1324,7 +1325,8 @@ class AMSAssetType(models.Model):
...
@@ -1324,7 +1325,8 @@ class AMSAssetType(models.Model):
related_name
=
'ams_asset_type_created_by'
related_name
=
'ams_asset_type_created_by'
)
)
created
=
models
.
DateTimeField
(
auto_now_add
=
True
)
created
=
models
.
DateTimeField
(
auto_now_add
=
True
)
deleted_at
=
models
.
DateTimeField
(
null
=
True
,
blank
=
True
)
# deleted_at = models.DateTimeField(null=True, blank=True)
is_active
=
models
.
BooleanField
(
default
=
True
)
class
Meta
:
class
Meta
:
db_table
=
'ams_asset_types'
db_table
=
'ams_asset_types'
...
@@ -1370,7 +1372,8 @@ class AMSAsset(models.Model):
...
@@ -1370,7 +1372,8 @@ class AMSAsset(models.Model):
related_name
=
'ams_asset_created_by'
related_name
=
'ams_asset_created_by'
)
)
created
=
models
.
DateTimeField
(
auto_now_add
=
True
)
created
=
models
.
DateTimeField
(
auto_now_add
=
True
)
deleted_at
=
models
.
DateTimeField
(
null
=
True
,
blank
=
True
)
# deleted_at = models.DateTimeField(null=True, blank=True)
is_active
=
models
.
BooleanField
(
default
=
True
)
class
Meta
:
class
Meta
:
db_table
=
'ams_assets'
db_table
=
'ams_assets'
...
@@ -1440,7 +1443,8 @@ class AMSAssetStock(models.Model):
...
@@ -1440,7 +1443,8 @@ class AMSAssetStock(models.Model):
related_name
=
'ams_asset_to_assetgroup'
related_name
=
'ams_asset_to_assetgroup'
)
)
created
=
models
.
DateTimeField
(
auto_now_add
=
True
)
created
=
models
.
DateTimeField
(
auto_now_add
=
True
)
deleted_at
=
models
.
DateTimeField
(
null
=
True
,
blank
=
True
)
# deleted_at = models.DateTimeField(null=True, blank=True)
is_active
=
models
.
BooleanField
(
default
=
True
)
class
Meta
:
class
Meta
:
db_table
=
'ams_asset_stocks'
db_table
=
'ams_asset_stocks'
...
@@ -1485,7 +1489,8 @@ class AMSAssetStockSupport(models.Model):
...
@@ -1485,7 +1489,8 @@ class AMSAssetStockSupport(models.Model):
to_field
=
'code'
to_field
=
'code'
)
)
created
=
models
.
DateTimeField
(
auto_now_add
=
True
)
created
=
models
.
DateTimeField
(
auto_now_add
=
True
)
deleted_at
=
models
.
DateTimeField
(
null
=
True
,
blank
=
True
)
# deleted_at = models.DateTimeField(null=True, blank=True)
is_active
=
models
.
BooleanField
(
default
=
True
)
class
Meta
:
class
Meta
:
db_table
=
'ams_asset_stock_supports'
db_table
=
'ams_asset_stock_supports'
...
...
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