Commit 06d1755d by Thibault Grandjean

clean code

parent f585a4dd
Pipeline #1858 passed with stage
in 1 minute 29 seconds
...@@ -501,7 +501,6 @@ def create_pair(request): ...@@ -501,7 +501,6 @@ def create_pair(request):
"sex", "sex",
"street", "street",
"street2", "street2",
"zip"
"zip", "zip",
"nb_associated_people" "nb_associated_people"
] ]
...@@ -517,10 +516,8 @@ def create_pair(request): ...@@ -517,10 +516,8 @@ def create_pair(request):
bbcode_rule = api.search_read("barcode.rule", [['for_associated_people', "=", True]], ['id'])[0] bbcode_rule = api.search_read("barcode.rule", [['for_associated_people', "=", True]], ['id'])[0]
child['barcode_rule_id'] = bbcode_rule["id"] child['barcode_rule_id'] = bbcode_rule["id"]
attached_account = api.create('res.partner', child) attached_account = api.create('res.partner', child)
print(attached_account) # generate_base
# generate_barcode
api.execute('res.partner', 'generate_base', [attached_account]) api.execute('res.partner', 'generate_base', [attached_account])
# api.execute('res.partner', 'generate_barcode', [attached_account])
response = JsonResponse({"message": "Succesfuly paired members"}, status=200) response = JsonResponse({"message": "Succesfuly paired members"}, status=200)
else: else:
response = JsonResponse({"message": "Unauthorized"}, status=403) response = JsonResponse({"message": "Unauthorized"}, status=403)
...@@ -541,7 +538,7 @@ def delete_pair(request): ...@@ -541,7 +538,7 @@ def delete_pair(request):
api = OdooAPI() api = OdooAPI()
data = json.loads(request.body.decode()) data = json.loads(request.body.decode())
parent_id = data['parent']['id'] parent_id = data['parent']['id']
# get attached accound # get attached account
child = api.search_read('res.partner', [['parent_id', '=', parent_id]], ['id'])[0] child = api.search_read('res.partner', [['parent_id', '=', parent_id]], ['id'])[0]
api.delete('res.partner', [child['id']]) api.delete('res.partner', [child['id']])
response = JsonResponse({"message": "Succesfuly unpaired members"}, status=200) response = JsonResponse({"message": "Succesfuly unpaired members"}, status=200)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment