Skip to content

Commit

Permalink
Fix Odoo search function
Browse files Browse the repository at this point in the history
  • Loading branch information
dolfinus committed May 10, 2019
1 parent 38dd689 commit f4cd048
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
14 changes: 7 additions & 7 deletions src/org/camunda/latera/bss/connectors/odoo/Entity.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,23 @@ trait Entity {
return result
}

List getEntitiesBy(def type, LinkedHashMap input) {
List getEntitiesBy(def type, LinkedHashMap params) {
def result = []
def query = searchQuery(input)
def query = searchQuery(params)
try {
result = sendRequest(
'get',
path : "${type}/",
body : query
path : "${type}/",
query : query
)?.data
} catch (Exception e) {
logger.error(e)
}
return result
}

LinkedHashMap getEntityBy(def type, LinkedHashMap input) {
return getEntitiesBy(type, input)?.getAt(0)
LinkedHashMap getEntityBy(def type, LinkedHashMap params) {
return getEntitiesBy(type, params)?.getAt(0)
}

LinkedHashMap createEntity(def type, LinkedHashMap params) {
Expand All @@ -53,7 +53,7 @@ trait Entity {
logger.info("Creating ${type} with params ${params}")
result = sendRequest(
'post',
path : "${type}/",
path : "${type}",
body : params
)?.data
} catch (Exception e) {
Expand Down
4 changes: 2 additions & 2 deletions src/org/camunda/latera/bss/connectors/odoo/Main.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ trait Main {
where.each{ field, value ->
if (value instanceof LinkedHashMap) {
value.each { condition, content ->
query += """('${field}','${condition}','${content}')'"""
query += """('${field}','${condition}','${content}')"""
}
} else {
def condition = '='
Expand All @@ -39,7 +39,7 @@ trait Main {
if (DateTimeUtil.isDate(value)) {
content = DateTimeUtil.format(value, DateTimeUtil.ISO_FORMAT)
}
query += """('${field}','${condition}','${content}')'"""
query += """('${field}','${condition}','${content}')"""
}
}
}
Expand Down

0 comments on commit f4cd048

Please sign in to comment.