Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
arunkelkar
gkcore
Commits
a7be348c
Commit
a7be348c
authored
Dec 13, 2016
by
Krishnakant Mane
Browse files
Merge branch 'godownwisestock' into 'inventory'
Added getProductByGodown method in product api See merge request !245
parents
63a6c7db
ddd29b7d
Changes
1
Hide whitespace changes
Inline
Side-by-side
gkcore/views/api_product.py
View file @
a7be348c
...
...
@@ -152,6 +152,33 @@ class api_product(object):
self
.
con
.
close
()
@
view_config
(
request_method
=
'GET'
,
request_param
=
'by=godown'
,
renderer
=
'json'
)
def
getProductbyGodown
(
self
):
try
:
token
=
self
.
request
.
headers
[
"gktoken"
]
except
:
return
{
"gkstatus"
:
enumdict
[
"UnauthorisedAccess"
]}
authDetails
=
authCheck
(
token
)
if
authDetails
[
"auth"
]
==
False
:
return
{
"gkstatus"
:
enumdict
[
"UnauthorisedAccess"
]}
else
:
try
:
self
.
con
=
eng
.
connect
()
goid
=
self
.
request
.
params
[
"goid"
]
productcode
=
self
.
request
.
params
[
"productcode"
]
result
=
self
.
con
.
execute
(
select
([
goprod
]).
where
(
and_
(
goprod
.
c
.
goid
==
goid
,
goprod
.
c
.
productcode
==
productcode
)))
godowns
=
[]
for
row
in
result
:
goDownDetails
=
{
"goid"
:
row
[
"goid"
],
"goopeningstock"
:
"%.2f"
%
float
(
row
[
"goopeningstock"
]),
"productcode"
:
row
[
"productcode"
]}
godowns
.
append
(
goDownDetails
)
return
{
"gkstatus"
:
enumdict
[
"Success"
],
"gkresult"
:
godowns
}
except
:
self
.
con
.
close
()
return
{
"gkstatus"
:
enumdict
[
"ConnectionFailed"
]}
finally
:
self
.
con
.
close
()
@
view_config
(
request_method
=
'POST'
,
renderer
=
'json'
)
def
addProduct
(
self
):
try
:
...
...
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