summaryrefslogtreecommitdiff
path: root/fixco_api
diff options
context:
space:
mode:
authorstephanchrst <stephanchrst@gmail.com>2024-05-30 13:29:10 +0700
committerstephanchrst <stephanchrst@gmail.com>2024-05-30 13:29:10 +0700
commit614ee8d9c8ba5862810a331ca67734d96ab1644e (patch)
treefed31a58788bcef89038414be88cefed34e060c2 /fixco_api
parent26fcacb9d06e6ddf7e9487a55e7b96692042d8bf (diff)
fix error sales discount
Diffstat (limited to 'fixco_api')
-rw-r--r--fixco_api/controllers/api_v1/sale.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/fixco_api/controllers/api_v1/sale.py b/fixco_api/controllers/api_v1/sale.py
index 9b855dd..fe8e38f 100644
--- a/fixco_api/controllers/api_v1/sale.py
+++ b/fixco_api/controllers/api_v1/sale.py
@@ -41,6 +41,7 @@ class Sales(controller.Controller):
data = request.jsonrequest
ginee_shop_id = data['ginee_shop_id']
ref = data['ref']
+ discount = data['discount']
lines = data['lines']
if ginee_shop_id == '0':
return {'status': 'error', 'message': 'partner not found'}
@@ -79,6 +80,17 @@ class Sales(controller.Controller):
'tax_id': [13] #tax include
})
request.env['sale.order.line'].create(param_line)
+
+ # create sales discount here
+ if discount > 0:
+ param_line = [{
+ 'order_id': sale_order.id,
+ 'product_id': 55, # diskon penjualan
+ 'name': 'Diskon Penjualan',
+ 'product_uom_qty': -1,
+ 'price_unit': discount
+ }]
+ request.env['sale.order.line'].create(param_line)
return {
'status': 'success', 'message': sale_order.name
}