summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIndoteknik . <it@fixcomart.co.id>2025-06-14 13:06:43 +0700
committerIndoteknik . <it@fixcomart.co.id>2025-06-14 13:06:43 +0700
commit819f7c2f0dfe0eaf857c44e80062dcc7e94c9828 (patch)
tree2cda0cddfe29869e3213e3ad0e0765e53ecb115f
parent60801084c9c93b3ec2d584a8a1de4af019b5fa80 (diff)
(andri) memindahkan key biteship (test&live) ke system parameter
-rwxr-xr-xindoteknik_custom/models/sale_order.py4
-rw-r--r--indoteknik_custom/models/stock_picking.py13
2 files changed, 8 insertions, 9 deletions
diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py
index 492153c0..8c8a3cc3 100755
--- a/indoteknik_custom/models/sale_order.py
+++ b/indoteknik_custom/models/sale_order.py
@@ -1101,8 +1101,8 @@ class SaleOrder(models.Model):
def _call_biteship_api(self, origin_data, destination_data, items, couriers=None):
url = "https://api.biteship.com/v1/rates/couriers"
- api_key = "biteship_test.eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoiSW5kb3Rla25payIsInVzZXJJZCI6IjY3MTViYTJkYzVkMjdkMDAxMjRjODk2MiIsImlhdCI6MTcyOTQ5ODAwMX0.L6C73couP4-cgVEfhKI2g7eMCMo3YOFSRZhS-KSuHNA"
-
+ # api_key = self.env['ir.config_parameter'].sudo().get_param('biteship.api_key_live')
+ api_key = self.env['ir.config_parameter'].sudo().get_param('biteship.api_key_test')
headers = {
'Authorization': api_key,
'Content-Type': 'application/json'
diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py
index 8b03e18d..89e7fecc 100644
--- a/indoteknik_custom/models/stock_picking.py
+++ b/indoteknik_custom/models/stock_picking.py
@@ -19,11 +19,6 @@ import re
_logger = logging.getLogger(__name__)
_biteship_url = "https://api.biteship.com/v1"
-_biteship_api_key = "biteship_test.eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoiSW5kb3Rla25payIsInVzZXJJZCI6IjY3MTViYTJkYzVkMjdkMDAxMjRjODk2MiIsImlhdCI6MTcyOTQ5ODAwMX0.L6C73couP4-cgVEfhKI2g7eMCMo3YOFSRZhS-KSuHNA"
-
-
-# _biteship_api_key = "biteship_live.eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoiaW5kb3Rla25payIsInVzZXJJZCI6IjY3MTViYTJkYzVkMjdkMDAxMjRjODk2MiIsImlhdCI6MTc0MTE1NTU4M30.pbFCai9QJv8iWhgdosf8ScVmEeP3e5blrn33CHe7Hgo"
-
class StockPicking(models.Model):
_inherit = 'stock.picking'
@@ -170,6 +165,10 @@ class StockPicking(models.Model):
area_name = fields.Char(string="Area", compute="_compute_area_name")
+ def _get_biteship_api_key(self):
+ return self.env['ir.config_parameter'].sudo().get_param('biteship.api_key_test')
+ # return self.env['ir.config_parameter'].sudo().get_param('biteship.api_key_live')
+
@api.depends('real_shipping_id.kecamatan_id', 'real_shipping_id.kota_id')
def _compute_area_name(self):
for record in self:
@@ -769,7 +768,7 @@ class StockPicking(models.Model):
_logger.info(f"Payload untuk Biteship: {payload}")
# Kirim ke Biteship
- api_key = _biteship_api_key
+ api_key = self._get_biteship_api_key()
headers = {
"Authorization": f"Bearer {api_key}",
"Content-Type": "application/json"
@@ -1712,7 +1711,7 @@ class StockPicking(models.Model):
return response
def get_manifest_biteship(self):
- api_key = _biteship_api_key
+ api_key = self._get_biteship_api_key()
headers = {
"Authorization": f"Bearer {api_key}",
"Content-Type": "application/json"