From ad804db879d8cf288543e6bb045ff597fe025b34 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Fri, 17 May 2024 13:43:11 +0700 Subject: deactivate function onchance on stock picking --- indoteknik_custom/models/stock_picking.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py index 22aceaf4..de234067 100644 --- a/indoteknik_custom/models/stock_picking.py +++ b/indoteknik_custom/models/stock_picking.py @@ -86,10 +86,10 @@ class StockPicking(models.Model): date_availability = fields.Datetime(string="Date Availability", copy=False, tracking=True) sale_order = fields.Char(string='Matches SO', copy=False) - @api.onchange('carrier_id') - def constrains_carrier_id(self): - if not self.env.user.is_logistic_approver: - raise UserError('Hanya Logistic yang bisa mengubah shipping method') + # @api.onchange('carrier_id') + # def constrains_carrier_id(self): + # if not self.env.user.is_logistic_approver: + # raise UserError('Hanya Logistic yang bisa mengubah shipping method') def do_unreserve(self): res = super(StockPicking, self).do_unreserve() -- cgit v1.2.3 From ea8cad6bf8158bee8d074cb5c493155a87c9b9fe Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Fri, 17 May 2024 13:53:50 +0700 Subject: fix function onchange on stock picking --- indoteknik_custom/models/stock_picking.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py index de234067..62d86911 100644 --- a/indoteknik_custom/models/stock_picking.py +++ b/indoteknik_custom/models/stock_picking.py @@ -86,10 +86,11 @@ class StockPicking(models.Model): date_availability = fields.Datetime(string="Date Availability", copy=False, tracking=True) sale_order = fields.Char(string='Matches SO', copy=False) - # @api.onchange('carrier_id') - # def constrains_carrier_id(self): - # if not self.env.user.is_logistic_approver: - # raise UserError('Hanya Logistic yang bisa mengubah shipping method') + @api.onchange('carrier_id') + def constrains_carrier_id(self): + if self.carrier_id: + if not self.env.user.is_logistic_approver: + raise UserError('Hanya Logistic yang bisa mengubah shipping method') def do_unreserve(self): res = super(StockPicking, self).do_unreserve() -- cgit v1.2.3 From 49566a406160fca5cef44f864c228ae2e8e3f1fb Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Mon, 20 May 2024 15:08:43 +0700 Subject: new branch api ged --- indoteknik_custom/models/__init__.py | 2 + indoteknik_custom/models/external_api.py | 21 ++++ indoteknik_custom/models/ged.py | 194 +++++++++++++++++++++++++++++++ 3 files changed, 217 insertions(+) create mode 100644 indoteknik_custom/models/external_api.py create mode 100644 indoteknik_custom/models/ged.py (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/__init__.py b/indoteknik_custom/models/__init__.py index 160d2af3..33aa0784 100755 --- a/indoteknik_custom/models/__init__.py +++ b/indoteknik_custom/models/__init__.py @@ -111,3 +111,5 @@ from . import report_stock_forecasted from . import web_logging from . import sales_order_fullfillment from . import res_partner_site +from . import external_api +from . import ged diff --git a/indoteknik_custom/models/external_api.py b/indoteknik_custom/models/external_api.py new file mode 100644 index 00000000..ff7281c5 --- /dev/null +++ b/indoteknik_custom/models/external_api.py @@ -0,0 +1,21 @@ +from odoo import fields, models, api +import requests +import urllib.parse +from odoo.exceptions import UserError +import json + + +class AppsStored(models.Model): + _name = 'apps.stored' + + app_name = fields.Char(string='App Name') + description = fields.Char(string='Description') + + +class TokenStorage(models.Model): + # _name = 'token.stored' + _inherit = 'token.storage' + + app_id = fields.Many2one('apps.stored', string='App') + messages = fields.Char(string='Messages') + status = fields.Char(string='Status') diff --git a/indoteknik_custom/models/ged.py b/indoteknik_custom/models/ged.py new file mode 100644 index 00000000..832fb023 --- /dev/null +++ b/indoteknik_custom/models/ged.py @@ -0,0 +1,194 @@ +from odoo import models, fields +from datetime import datetime, timedelta +import requests +import urllib.parse +from odoo.exceptions import UserError +import json + +#dev +# url_token = 'https://stagging-api.ged.co.id/api/GetToken' +# url_tracking = 'https://stagging-api.ged.co.id/api/TrackingAwb' +#production +url_token = 'https://gedapi.ged.co.id/api/GetToken' +url_tracking = 'https://gedapi.ged.co.id/api/TrackingAwb' +username = 'stephan@indoteknik.co.id' +password = 'faCE2HFFKdzhvPW' +x_ged_key = 'Indoteknikdotcom' +x_ged_password = 'Ind0t3kn1kdotc0m4p1' + +class GedTracking(models.Model): + _name = 'ged.tracking' + + status = fields.Char(string='Status') + messages = fields.Char(string='Messages') + awb_no = fields.Char(string='AWB No') + reff_no = fields.Char(string='Reff No') + consignee_name = fields.Char(string='Consignee Name') + consignee_contact = fields.Char(string='Consignee Contact') + consignee_phone = fields.Char(string='Consignee Phone') + consignee_address = fields.Char(string='Consignee Address') + moda = fields.Char(string='Moda') + service = fields.Char(string='Service') + package = fields.Char(string='Package') + height = fields.Char(string='Height') + width = fields.Char(string='Width') + length = fields.Char(string='Length') + coli = fields.Char(string='Coli') + kg = fields.Char(string='KG') + origin = fields.Char(string='Origin') + destination = fields.Char(string='Destination') + last_user_input = fields.Char(string='Last User Input') + last_created_at = fields.Char(string='Last Created At') + last_location = fields.Char(string='Last Location') + last_description = fields.Char(string='Last Description') + last_status_detail = fields.Char(string='Last Status Detail') + last_status = fields.Char(string='Last Status') + + +class GedTrackingLine(models.Model): + _name = 'ged.tracking.line' + + ged_tracking_id = fields.Many2one('ged.tracking', string='Ged Tracking ID', required=True, ondelete='cascade', + index=True, copy=False) + user_input = fields.Char(string='User Input') + created_at = fields.Char(string='Created At') + location = fields.Char(string='Location') + description = fields.Char(string='Description') + status_detail = fields.Char(string='Status Detail') + status = fields.Char(string='Status') + receiver_name = fields.Char(string='Receiver Name') + receiver_relationship = fields.Char(string='Receiver Relationship') + photo_pod = fields.Char(string='Photo POD') + photo_signature = fields.Char(string='Photo Signature') + photo_location = fields.Char(string='Photo Location') + photo_receiver = fields.Char(string='Photo Receiver') + gps = fields.Char(string='GPS') + + +class GedApi(models.Model): + _name = 'ged.api' + + def get_token(self): + #TODO check if have old active token or not + headers = { + 'Content-Type': 'application/json', + 'Accept': 'application/json', + } + json_data = { + 'data': { + 'email': username, + 'password': password, + }, + } + response = requests.post(url_token, headers=headers, json=json_data) + + status = response.json()['status'] + messages = response.json()['messages'] + token = response.json()['token'] + expired = response.json()['expired'] + date_expired = datetime.strptime(expired, '%y-%m-%d %H:%M:%S') + date_expired = date_expired.strftime('%Y-%m-%d %H:%M:%S') + + param = { + "status": status, + "messages": messages, + "access_token": token, + "expired_date": date_expired, + "app_id": 1, + "source": "GED" + } + self.env['token.storage'].create([param]) + return token + + def get_tracking_awb(self): + token = self.get_token() + headers = { + 'Content-Type': 'application/json', + 'Accept': 'application/json', + 'X-Ged-Key': x_ged_key, + 'X-Ged-Password': x_ged_password, + 'Authorization': 'Bearer '+token + } + json_data = { + 'data': { + 'awb': 19138131 + } + } + response = requests.post(url_tracking, headers=headers, json=json_data) + info_awb = response.json()['infoawb'] + last_status = response.json()['laststatus'] + + status = response.json()['status'] + messages = response.json()['messages'] + awb_no = info_awb['awb_no'] + reff_no = info_awb['reff_no'] + consignee_name = info_awb['consignee_name'] + consignee_contact = info_awb['consignee_contact'] + consignee_phone = info_awb['consignee_phone'] + consignee_address = info_awb['consignee_address'] + moda = info_awb['moda'] + service = info_awb['service'] + package = info_awb['package'] + height = info_awb['height'] + width = info_awb['width'] + length = info_awb['length'] + coli = info_awb['coli'] + kg = info_awb['kg'] + origin = info_awb['origin'] + destination = info_awb['destination'] + last_user_input = last_status['user_input'] + last_created_at = last_status['created_at'] + last_location = last_status['location'] + last_description = last_status['description'] + last_status_detail = last_status['status_detail'] + last_status = last_status['status'] + + param_header = { + 'status': status, + 'messages': messages, + 'awb_no': awb_no, + 'reff_no': reff_no, + 'consignee_name': consignee_name, + 'consignee_contact': consignee_contact, + 'consignee_phone': consignee_phone, + 'consignee_address': consignee_address, + 'moda': moda, + 'service': service, + 'package': package, + 'height': height, + 'width': width, + 'length': length, + 'coli': coli, + 'kg': kg, + 'origin': origin, + 'destination': destination, + 'last_user_input': last_user_input, + 'last_created_at': last_created_at, + 'last_location': last_location, + 'last_description': last_description, + 'last_status_detail': last_status_detail, + 'last_status': last_status + } + + ged_tracking = self.env['ged.tracking'].create(param_header) + + for line in response.json()['data']: + ged_tracking_id = ged_tracking.id + user_input = line['user_input'] + created_at = line['created_at'] + location = line['location'] + description = line['description'] + status_detail = line['status_detail'] + status = line['status'] + + param_line = { + 'ged_tracking_id': ged_tracking_id, + 'user_input': user_input, + 'created_at': created_at, + 'location': location, + 'description': description, + 'status_detail': status_detail, + 'status': status + } + self.env['ged.tracking.line'].create(param_line) + -- cgit v1.2.3 From 8cb1d5045542d120a65a610b6f9bb4b99c43adf4 Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Mon, 20 May 2024 15:43:01 +0700 Subject: add column ged api --- indoteknik_custom/models/ged.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/ged.py b/indoteknik_custom/models/ged.py index 832fb023..53bbe184 100644 --- a/indoteknik_custom/models/ged.py +++ b/indoteknik_custom/models/ged.py @@ -37,6 +37,13 @@ class GedTracking(models.Model): kg = fields.Char(string='KG') origin = fields.Char(string='Origin') destination = fields.Char(string='Destination') + receiver_name = fields.Char(string='Receiver Name') + receiver_relationship = fields.Char(string='Receiver Relationship') + delivered_date = fields.Char(string='Delivered Date') + photo_pod = fields.Char(string='Photo POD') + photo_signature = fields.Char(string='Photo Signature') + photo_location = fields.Char(string='Photo Location') + photo_receiver = fields.Char(string='Photo Receiver') last_user_input = fields.Char(string='Last User Input') last_created_at = fields.Char(string='Last Created At') last_location = fields.Char(string='Last Location') @@ -136,6 +143,13 @@ class GedApi(models.Model): kg = info_awb['kg'] origin = info_awb['origin'] destination = info_awb['destination'] + receiver_name = info_awb['receiver_name'] + receiver_relationship = info_awb['receiver_relationship'] + delivered_date = info_awb['delivered_date'] + photo_pod = info_awb['photo_pod'] + photo_signature = info_awb['photo_signature'] + photo_location = info_awb['photo_location'] + photo_receiver = info_awb['photo_receiver'] last_user_input = last_status['user_input'] last_created_at = last_status['created_at'] last_location = last_status['location'] @@ -162,6 +176,13 @@ class GedApi(models.Model): 'kg': kg, 'origin': origin, 'destination': destination, + 'receiver_name': receiver_name, + 'receiver_relationship': receiver_relationship, + 'delivered_date': delivered_date, + 'photo_pod': photo_pod, + 'photo_signature': photo_signature, + 'photo_location': photo_location, + 'photo_receiver': photo_receiver, 'last_user_input': last_user_input, 'last_created_at': last_created_at, 'last_location': last_location, -- cgit v1.2.3 From 92f33f2851a76bf391c0cfdee8fc0d4047e22a1d Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Mon, 20 May 2024 16:30:43 +0700 Subject: sync dunning to ged --- indoteknik_custom/models/dunning_run.py | 29 +++++++++++++++++++++++++++++ indoteknik_custom/models/ged.py | 28 ++++++++++++++++++++++------ 2 files changed, 51 insertions(+), 6 deletions(-) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/dunning_run.py b/indoteknik_custom/models/dunning_run.py index abfd68be..b5b8acb5 100644 --- a/indoteknik_custom/models/dunning_run.py +++ b/indoteknik_custom/models/dunning_run.py @@ -3,6 +3,7 @@ from odoo.exceptions import AccessError, UserError, ValidationError from datetime import timedelta import logging + _logger = logging.getLogger(__name__) @@ -25,6 +26,7 @@ class DunningRun(models.Model): shipper_faktur_id = fields.Many2one('delivery.carrier', string='Shipper Faktur') is_validated = fields.Boolean(string='Validated') notification = fields.Char(string='Notification') + last_status_awb = fields.Char(string='Last Status AWB') def copy_date_faktur(self): if not self.is_validated: @@ -105,6 +107,33 @@ class DunningRun(models.Model): result = super(DunningRun, self).create(vals) return result + def _get_tracking_history(self, test_awb_number): + if test_awb_number: + query = [ + ('last_status', '!=', 'POD Return'), + ('resi_tukar_faktur', '=', test_awb_number), + ('shipper_faktur_id', '=', 123) + ] + else: + query = [ + ('last_status', '!=', 'POD Return'), + ('resi_tukar_faktur', '!=', False), + ('shipper_faktur_id', '=', 123) + ] + dunnings = self.env['dunning.run'].search(query) + + for dunning in dunnings: + current_tracking = self.env['ged.tracking'].search([('awb_no', '=', dunning.resi_tukar_faktur)], limit=1) + if current_tracking: + current_tracking.unlink() + else: + ged_api = self.env['ged.api'] + last_status = ged_api.get_tracking_awb(dunning.id) + if not last_status: + dunning.last_status_awb = last_status + return + + class DunningRunLine(models.Model): _name = 'dunning.run.line' diff --git a/indoteknik_custom/models/ged.py b/indoteknik_custom/models/ged.py index 53bbe184..4502ce0b 100644 --- a/indoteknik_custom/models/ged.py +++ b/indoteknik_custom/models/ged.py @@ -8,6 +8,11 @@ import json #dev # url_token = 'https://stagging-api.ged.co.id/api/GetToken' # url_tracking = 'https://stagging-api.ged.co.id/api/TrackingAwb' +# username = 'mandiri@gmail.co.id' +# password = 'nPcWh8Up75ai5CW' +# x_ged_key = 'Mandiriind' +# x_ged_password = 'M4ndir1ind0n3si4ap1' + #production url_token = 'https://gedapi.ged.co.id/api/GetToken' url_tracking = 'https://gedapi.ged.co.id/api/TrackingAwb' @@ -75,8 +80,7 @@ class GedTrackingLine(models.Model): class GedApi(models.Model): _name = 'ged.api' - def get_token(self): - #TODO check if have old active token or not + def _get_token(self): headers = { 'Content-Type': 'application/json', 'Accept': 'application/json', @@ -107,8 +111,18 @@ class GedApi(models.Model): self.env['token.storage'].create([param]) return token - def get_tracking_awb(self): - token = self.get_token() + def get_tracking_awb(self, dunning_run): + current_time = datetime.now() + current_time = current_time.strftime('%Y-%m-%d %H:%M:%S') + query = [('app_id', '=', 1), ('expired_date', '>', current_time)] + token_data = self.env['token.storage'].search(query, order='expired_date desc', limit=1) + if not token_data: + token_data = self._get_token() + token = token_data + else: + token = token_data.access_token + + # token = self.get_token() headers = { 'Content-Type': 'application/json', 'Accept': 'application/json', @@ -118,7 +132,7 @@ class GedApi(models.Model): } json_data = { 'data': { - 'awb': 19138131 + 'awb': dunning_run.resi_tukar_faktur or 19138131 } } response = requests.post(url_tracking, headers=headers, json=json_data) @@ -155,7 +169,7 @@ class GedApi(models.Model): last_location = last_status['location'] last_description = last_status['description'] last_status_detail = last_status['status_detail'] - last_status = last_status['status'] + header_last_status = last_status = last_status['status'] param_header = { 'status': status, @@ -213,3 +227,5 @@ class GedApi(models.Model): } self.env['ged.tracking.line'].create(param_line) + return header_last_status + -- cgit v1.2.3 From b88662f880bfcc03d8de4c4e272054a35acf1e4a Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Mon, 20 May 2024 16:35:38 +0700 Subject: refactor code dunning run to ged class --- indoteknik_custom/models/dunning_run.py | 27 --------------------------- indoteknik_custom/models/ged.py | 29 +++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 27 deletions(-) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/dunning_run.py b/indoteknik_custom/models/dunning_run.py index b5b8acb5..8f17fea6 100644 --- a/indoteknik_custom/models/dunning_run.py +++ b/indoteknik_custom/models/dunning_run.py @@ -107,33 +107,6 @@ class DunningRun(models.Model): result = super(DunningRun, self).create(vals) return result - def _get_tracking_history(self, test_awb_number): - if test_awb_number: - query = [ - ('last_status', '!=', 'POD Return'), - ('resi_tukar_faktur', '=', test_awb_number), - ('shipper_faktur_id', '=', 123) - ] - else: - query = [ - ('last_status', '!=', 'POD Return'), - ('resi_tukar_faktur', '!=', False), - ('shipper_faktur_id', '=', 123) - ] - dunnings = self.env['dunning.run'].search(query) - - for dunning in dunnings: - current_tracking = self.env['ged.tracking'].search([('awb_no', '=', dunning.resi_tukar_faktur)], limit=1) - if current_tracking: - current_tracking.unlink() - else: - ged_api = self.env['ged.api'] - last_status = ged_api.get_tracking_awb(dunning.id) - if not last_status: - dunning.last_status_awb = last_status - return - - class DunningRunLine(models.Model): _name = 'dunning.run.line' diff --git a/indoteknik_custom/models/ged.py b/indoteknik_custom/models/ged.py index 4502ce0b..b63caf86 100644 --- a/indoteknik_custom/models/ged.py +++ b/indoteknik_custom/models/ged.py @@ -229,3 +229,32 @@ class GedApi(models.Model): return header_last_status + +class DunningRunGed(models.Model): + _inherit = 'dunning.run' + + def _get_tracking_history(self, test_awb_number): + if test_awb_number: + query = [ + ('last_status', '!=', 'POD Return'), + ('resi_tukar_faktur', '=', test_awb_number), + ('shipper_faktur_id', '=', 123) + ] + else: + query = [ + ('last_status', '!=', 'POD Return'), + ('resi_tukar_faktur', '!=', False), + ('shipper_faktur_id', '=', 123) + ] + dunnings = self.env['dunning.run'].search(query) + + for dunning in dunnings: + current_tracking = self.env['ged.tracking'].search([('awb_no', '=', dunning.resi_tukar_faktur)], limit=1) + if current_tracking: + current_tracking.unlink() + else: + ged_api = self.env['ged.api'] + last_status = ged_api.get_tracking_awb(dunning.id) + if not last_status: + dunning.last_status_awb = last_status + return -- cgit v1.2.3 From 777380f7346afc91189502c7f7943ce4b7b2e7f1 Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Mon, 20 May 2024 16:36:23 +0700 Subject: revert column in dunning run related with ged --- indoteknik_custom/models/dunning_run.py | 1 - indoteknik_custom/models/ged.py | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/dunning_run.py b/indoteknik_custom/models/dunning_run.py index 8f17fea6..4e04c03c 100644 --- a/indoteknik_custom/models/dunning_run.py +++ b/indoteknik_custom/models/dunning_run.py @@ -26,7 +26,6 @@ class DunningRun(models.Model): shipper_faktur_id = fields.Many2one('delivery.carrier', string='Shipper Faktur') is_validated = fields.Boolean(string='Validated') notification = fields.Char(string='Notification') - last_status_awb = fields.Char(string='Last Status AWB') def copy_date_faktur(self): if not self.is_validated: diff --git a/indoteknik_custom/models/ged.py b/indoteknik_custom/models/ged.py index b63caf86..10409130 100644 --- a/indoteknik_custom/models/ged.py +++ b/indoteknik_custom/models/ged.py @@ -233,6 +233,8 @@ class GedApi(models.Model): class DunningRunGed(models.Model): _inherit = 'dunning.run' + last_status_awb = fields.Char(string='Last Status AWB') + def _get_tracking_history(self, test_awb_number): if test_awb_number: query = [ -- cgit v1.2.3 From b75112a16554ea97fce7e8c1f23ffe6793ec7c94 Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Mon, 20 May 2024 16:41:40 +0700 Subject: chnage return of ged api --- indoteknik_custom/models/ged.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/ged.py b/indoteknik_custom/models/ged.py index 10409130..83b07568 100644 --- a/indoteknik_custom/models/ged.py +++ b/indoteknik_custom/models/ged.py @@ -227,7 +227,7 @@ class GedApi(models.Model): } self.env['ged.tracking.line'].create(param_line) - return header_last_status + return ged_tracking class DunningRunGed(models.Model): @@ -256,7 +256,7 @@ class DunningRunGed(models.Model): current_tracking.unlink() else: ged_api = self.env['ged.api'] - last_status = ged_api.get_tracking_awb(dunning.id) - if not last_status: - dunning.last_status_awb = last_status + ged_tracking = ged_api.get_tracking_awb(dunning.id) + if ged_tracking: + dunning.last_status_awb = ged_tracking.last_status return -- cgit v1.2.3 From 92413dbeda6eebc85731536dd698bb155b09d7df Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Mon, 20 May 2024 17:05:11 +0700 Subject: bug fix --- indoteknik_custom/models/ged.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/ged.py b/indoteknik_custom/models/ged.py index 83b07568..9e6facc6 100644 --- a/indoteknik_custom/models/ged.py +++ b/indoteknik_custom/models/ged.py @@ -238,13 +238,13 @@ class DunningRunGed(models.Model): def _get_tracking_history(self, test_awb_number): if test_awb_number: query = [ - ('last_status', '!=', 'POD Return'), + ('last_status_awb', '!=', 'POD Return'), ('resi_tukar_faktur', '=', test_awb_number), ('shipper_faktur_id', '=', 123) ] else: query = [ - ('last_status', '!=', 'POD Return'), + ('last_status_awb', '!=', 'POD Return'), ('resi_tukar_faktur', '!=', False), ('shipper_faktur_id', '=', 123) ] @@ -254,9 +254,9 @@ class DunningRunGed(models.Model): current_tracking = self.env['ged.tracking'].search([('awb_no', '=', dunning.resi_tukar_faktur)], limit=1) if current_tracking: current_tracking.unlink() - else: - ged_api = self.env['ged.api'] - ged_tracking = ged_api.get_tracking_awb(dunning.id) - if ged_tracking: - dunning.last_status_awb = ged_tracking.last_status + # else: + ged_api = self.env['ged.api'] + ged_tracking = ged_api.get_tracking_awb(dunning.id) + if ged_tracking: + dunning.last_status_awb = ged_tracking.last_status return -- cgit v1.2.3 From 8da2a7fe0de6f0abe4e35831e5e5560c20b5b627 Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Tue, 21 May 2024 09:21:33 +0700 Subject: bug fix total margin so, forgot deduction of delivery amount --- indoteknik_custom/models/ged.py | 26 +++++++++++++------------- indoteknik_custom/models/sale_order.py | 7 ++++++- 2 files changed, 19 insertions(+), 14 deletions(-) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/ged.py b/indoteknik_custom/models/ged.py index 9e6facc6..9ca426af 100644 --- a/indoteknik_custom/models/ged.py +++ b/indoteknik_custom/models/ged.py @@ -6,20 +6,20 @@ from odoo.exceptions import UserError import json #dev -# url_token = 'https://stagging-api.ged.co.id/api/GetToken' -# url_tracking = 'https://stagging-api.ged.co.id/api/TrackingAwb' -# username = 'mandiri@gmail.co.id' -# password = 'nPcWh8Up75ai5CW' -# x_ged_key = 'Mandiriind' -# x_ged_password = 'M4ndir1ind0n3si4ap1' +url_token = 'https://stagging-api.ged.co.id/api/GetToken' +url_tracking = 'https://stagging-api.ged.co.id/api/TrackingAwb' +username = 'mandiri@gmail.co.id' +password = 'nPcWh8Up75ai5CW' +x_ged_key = 'Mandiriind' +x_ged_password = 'M4ndir1ind0n3si4ap1' #production -url_token = 'https://gedapi.ged.co.id/api/GetToken' -url_tracking = 'https://gedapi.ged.co.id/api/TrackingAwb' -username = 'stephan@indoteknik.co.id' -password = 'faCE2HFFKdzhvPW' -x_ged_key = 'Indoteknikdotcom' -x_ged_password = 'Ind0t3kn1kdotc0m4p1' +# url_token = 'https://gedapi.ged.co.id/api/GetToken' +# url_tracking = 'https://gedapi.ged.co.id/api/TrackingAwb' +# username = 'stephan@indoteknik.co.id' +# password = 'faCE2HFFKdzhvPW' +# x_ged_key = 'Indoteknikdotcom' +# x_ged_password = 'Ind0t3kn1kdotc0m4p1' class GedTracking(models.Model): _name = 'ged.tracking' @@ -245,7 +245,7 @@ class DunningRunGed(models.Model): else: query = [ ('last_status_awb', '!=', 'POD Return'), - ('resi_tukar_faktur', '!=', False), + ('resi_tukar_faktur', '=', False), ('shipper_faktur_id', '=', 123) ] dunnings = self.env['dunning.run'].search(query) diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index aa34b0f4..fbb5e7a2 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -582,7 +582,12 @@ class SaleOrder(models.Model): if order.amount_untaxed == 0: order.total_percent_margin = 0 continue - order.total_percent_margin = round((order.total_margin / order.amount_untaxed) * 100, 2) + if order.shipping_cost_covered == 'indoteknik': + delivery_amt = order.delivery_amt + else: + delivery_amt = 0 + order.total_percent_margin = round((order.total_margin / (order.amount_untaxed-delivery_amt)) * 100, 2) + # order.total_percent_margin = round((order.total_margin / (order.amount_untaxed)) * 100, 2) @api.onchange('sales_tax_id') def onchange_sales_tax_id(self): -- cgit v1.2.3 From d6fea32f48e1214768cb56a7f27f3f3bf309e29c Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Tue, 21 May 2024 10:18:32 +0700 Subject: dont allow copy field delivery amount --- indoteknik_custom/models/sale_order.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index fbb5e7a2..d246f37f 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -20,7 +20,7 @@ class SaleOrder(models.Model): ], string='Approval Status', readonly=True, copy=False, index=True, tracking=3) carrier_id = fields.Many2one('delivery.carrier', string='Shipping Method', tracking=3) have_visit_service = fields.Boolean(string='Have Visit Service', compute='_have_visit_service', help='To compute is customer get visit service') - delivery_amt = fields.Float('Delivery Amt') + delivery_amt = fields.Float(string='Delivery Amt', copy=False) shipping_cost_covered = fields.Selection([ ('indoteknik', 'Indoteknik'), ('customer', 'Customer') -- cgit v1.2.3 From 337a3347c50637b059655e2feaff5029ecaba3cb Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Tue, 21 May 2024 10:47:42 +0700 Subject: fix error parsing parameter in API GED --- indoteknik_custom/models/ged.py | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/ged.py b/indoteknik_custom/models/ged.py index 9ca426af..9a8a6dcc 100644 --- a/indoteknik_custom/models/ged.py +++ b/indoteknik_custom/models/ged.py @@ -6,20 +6,20 @@ from odoo.exceptions import UserError import json #dev -url_token = 'https://stagging-api.ged.co.id/api/GetToken' -url_tracking = 'https://stagging-api.ged.co.id/api/TrackingAwb' -username = 'mandiri@gmail.co.id' -password = 'nPcWh8Up75ai5CW' -x_ged_key = 'Mandiriind' -x_ged_password = 'M4ndir1ind0n3si4ap1' +# url_token = 'https://stagging-api.ged.co.id/api/GetToken' +# url_tracking = 'https://stagging-api.ged.co.id/api/TrackingAwb' +# username = 'mandiri@gmail.co.id' +# password = 'nPcWh8Up75ai5CW' +# x_ged_key = 'Mandiriind' +# x_ged_password = 'M4ndir1ind0n3si4ap1' #production -# url_token = 'https://gedapi.ged.co.id/api/GetToken' -# url_tracking = 'https://gedapi.ged.co.id/api/TrackingAwb' -# username = 'stephan@indoteknik.co.id' -# password = 'faCE2HFFKdzhvPW' -# x_ged_key = 'Indoteknikdotcom' -# x_ged_password = 'Ind0t3kn1kdotc0m4p1' +url_token = 'https://gedapi.ged.co.id/api/GetToken' +url_tracking = 'https://gedapi.ged.co.id/api/TrackingAwb' +username = 'stephan@indoteknik.co.id' +password = 'faCE2HFFKdzhvPW' +x_ged_key = 'Indoteknikdotcom' +x_ged_password = 'Ind0t3kn1kdotc0m4p1' class GedTracking(models.Model): _name = 'ged.tracking' @@ -132,7 +132,7 @@ class GedApi(models.Model): } json_data = { 'data': { - 'awb': dunning_run.resi_tukar_faktur or 19138131 + 'awb': dunning_run.resi_tukar_faktur } } response = requests.post(url_tracking, headers=headers, json=json_data) @@ -169,7 +169,7 @@ class GedApi(models.Model): last_location = last_status['location'] last_description = last_status['description'] last_status_detail = last_status['status_detail'] - header_last_status = last_status = last_status['status'] + # header_last_status = last_status = last_status['status'] param_header = { 'status': status, @@ -256,7 +256,9 @@ class DunningRunGed(models.Model): current_tracking.unlink() # else: ged_api = self.env['ged.api'] - ged_tracking = ged_api.get_tracking_awb(dunning.id) + ged_tracking = ged_api.get_tracking_awb(dunning) if ged_tracking: dunning.last_status_awb = ged_tracking.last_status + if ged_tracking.last_status == 'POD Return': + dunning.copy_date_faktur() return -- cgit v1.2.3 From d9978ad05ab9a709467070fc6770af077cb38848 Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Tue, 21 May 2024 10:51:24 +0700 Subject: copy date terima faktur --- indoteknik_custom/models/ged.py | 1 + 1 file changed, 1 insertion(+) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/ged.py b/indoteknik_custom/models/ged.py index 9a8a6dcc..c380088b 100644 --- a/indoteknik_custom/models/ged.py +++ b/indoteknik_custom/models/ged.py @@ -260,5 +260,6 @@ class DunningRunGed(models.Model): if ged_tracking: dunning.last_status_awb = ged_tracking.last_status if ged_tracking.last_status == 'POD Return': + dunning.date_terima_tukar_faktur = ged_tracking.delivered_date dunning.copy_date_faktur() return -- cgit v1.2.3 From f43c3abd858b5bac2ec920e553bc6566845d2a08 Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Tue, 21 May 2024 10:53:34 +0700 Subject: add validation while query dunning run --- indoteknik_custom/models/ged.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/ged.py b/indoteknik_custom/models/ged.py index c380088b..9b949687 100644 --- a/indoteknik_custom/models/ged.py +++ b/indoteknik_custom/models/ged.py @@ -246,7 +246,8 @@ class DunningRunGed(models.Model): query = [ ('last_status_awb', '!=', 'POD Return'), ('resi_tukar_faktur', '=', False), - ('shipper_faktur_id', '=', 123) + ('shipper_faktur_id', '=', 123), + ('date_terima_tukar_faktur', '=', False) ] dunnings = self.env['dunning.run'].search(query) -- cgit v1.2.3 From 3c43dad74ebb3feef42ddb871a794ea1763e7008 Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Tue, 21 May 2024 11:00:22 +0700 Subject: fix wrong status in dunning run --- indoteknik_custom/models/ged.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/ged.py b/indoteknik_custom/models/ged.py index 9b949687..5de47a6e 100644 --- a/indoteknik_custom/models/ged.py +++ b/indoteknik_custom/models/ged.py @@ -169,7 +169,7 @@ class GedApi(models.Model): last_location = last_status['location'] last_description = last_status['description'] last_status_detail = last_status['status_detail'] - # header_last_status = last_status = last_status['status'] + header_last_status = last_status['status'] param_header = { 'status': status, @@ -202,7 +202,7 @@ class GedApi(models.Model): 'last_location': last_location, 'last_description': last_description, 'last_status_detail': last_status_detail, - 'last_status': last_status + 'last_status': header_last_status } ged_tracking = self.env['ged.tracking'].create(param_header) -- cgit v1.2.3 From b4448913dc446840c21d2403a58cd7edcc13be4a Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Tue, 21 May 2024 11:47:03 +0700 Subject: add view of ged tracking --- indoteknik_custom/models/ged.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/ged.py b/indoteknik_custom/models/ged.py index 5de47a6e..2de88a8d 100644 --- a/indoteknik_custom/models/ged.py +++ b/indoteknik_custom/models/ged.py @@ -21,8 +21,11 @@ password = 'faCE2HFFKdzhvPW' x_ged_key = 'Indoteknikdotcom' x_ged_password = 'Ind0t3kn1kdotc0m4p1' + class GedTracking(models.Model): _name = 'ged.tracking' + _order = 'awb_no desc' + _rec_name = 'awb_no' status = fields.Char(string='Status') messages = fields.Char(string='Messages') @@ -55,6 +58,7 @@ class GedTracking(models.Model): last_description = fields.Char(string='Last Description') last_status_detail = fields.Char(string='Last Status Detail') last_status = fields.Char(string='Last Status') + tracking_line = fields.One2many('ged.tracking.line', 'ged_tracking_id', string='Tracking Lines', auto_join=True) class GedTrackingLine(models.Model): @@ -77,6 +81,13 @@ class GedTrackingLine(models.Model): gps = fields.Char(string='GPS') +class GedTrackingLog(models.Model): + _name = 'ged.tracking.log' + + responses = fields.Char(string='Responses') + body = fields.Char(string='Body') + + class GedApi(models.Model): _name = 'ged.api' @@ -136,9 +147,14 @@ class GedApi(models.Model): } } response = requests.post(url_tracking, headers=headers, json=json_data) + log = { + 'body': str(json_data), + 'responses': str(response.json()) + } + self.env['ged.tracking.log'].create(log) + info_awb = response.json()['infoawb'] last_status = response.json()['laststatus'] - status = response.json()['status'] messages = response.json()['messages'] awb_no = info_awb['awb_no'] -- cgit v1.2.3 From b6a0434a4ff9fe580469cf79c30816697e36e48e Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Tue, 21 May 2024 12:06:46 +0700 Subject: add standalone button for get tracking awb in dunning run --- indoteknik_custom/models/ged.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/ged.py b/indoteknik_custom/models/ged.py index 2de88a8d..e1881c45 100644 --- a/indoteknik_custom/models/ged.py +++ b/indoteknik_custom/models/ged.py @@ -280,3 +280,6 @@ class DunningRunGed(models.Model): dunning.date_terima_tukar_faktur = ged_tracking.delivered_date dunning.copy_date_faktur() return + + def get_tracking_history_by_awb(self): + self._get_tracking_history(self.resi_tukar_faktur) \ No newline at end of file -- cgit v1.2.3 From 544e9138e8ec11326ba7ded2e0a29398182fde5b Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Tue, 21 May 2024 13:12:35 +0700 Subject: fix token --- indoteknik_custom/models/ged.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/ged.py b/indoteknik_custom/models/ged.py index e1881c45..5cf0ab79 100644 --- a/indoteknik_custom/models/ged.py +++ b/indoteknik_custom/models/ged.py @@ -123,17 +123,17 @@ class GedApi(models.Model): return token def get_tracking_awb(self, dunning_run): - current_time = datetime.now() - current_time = current_time.strftime('%Y-%m-%d %H:%M:%S') - query = [('app_id', '=', 1), ('expired_date', '>', current_time)] - token_data = self.env['token.storage'].search(query, order='expired_date desc', limit=1) - if not token_data: - token_data = self._get_token() - token = token_data - else: - token = token_data.access_token + # current_time = datetime.now() + # current_time = current_time.strftime('%Y-%m-%d %H:%M:%S') + # query = [('app_id', '=', 1), ('expired_date', '>', current_time)] + # token_data = self.env['token.storage'].search(query, order='expired_date desc', limit=1) + # if not token_data: + # token_data = self._get_token() + # token = token_data + # else: + # token = token_data.access_token - # token = self.get_token() + token = self.get_token() headers = { 'Content-Type': 'application/json', 'Accept': 'application/json', -- cgit v1.2.3 From e263ef39721022fb10c07933bc2b901d571d0771 Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Tue, 21 May 2024 13:14:41 +0700 Subject: fix typo --- indoteknik_custom/models/ged.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/ged.py b/indoteknik_custom/models/ged.py index 5cf0ab79..ef3dd94f 100644 --- a/indoteknik_custom/models/ged.py +++ b/indoteknik_custom/models/ged.py @@ -133,7 +133,7 @@ class GedApi(models.Model): # else: # token = token_data.access_token - token = self.get_token() + token = self._get_token() headers = { 'Content-Type': 'application/json', 'Accept': 'application/json', -- cgit v1.2.3 From 79eb2d852bca1d6f2a41b4649ae264fe87034e58 Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Tue, 21 May 2024 13:17:12 +0700 Subject: fix error param --- indoteknik_custom/models/ged.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/ged.py b/indoteknik_custom/models/ged.py index ef3dd94f..e4fba868 100644 --- a/indoteknik_custom/models/ged.py +++ b/indoteknik_custom/models/ged.py @@ -252,7 +252,7 @@ class DunningRunGed(models.Model): last_status_awb = fields.Char(string='Last Status AWB') def _get_tracking_history(self, test_awb_number): - if test_awb_number: + if test_awb_number > 0: query = [ ('last_status_awb', '!=', 'POD Return'), ('resi_tukar_faktur', '=', test_awb_number), -- cgit v1.2.3 From 66944c76ff475f2228c786d9057f9adbc93a1213 Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Tue, 21 May 2024 13:21:18 +0700 Subject: fix --- indoteknik_custom/models/ged.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/ged.py b/indoteknik_custom/models/ged.py index e4fba868..a175c330 100644 --- a/indoteknik_custom/models/ged.py +++ b/indoteknik_custom/models/ged.py @@ -261,7 +261,7 @@ class DunningRunGed(models.Model): else: query = [ ('last_status_awb', '!=', 'POD Return'), - ('resi_tukar_faktur', '=', False), + ('resi_tukar_faktur', '!=', False), ('shipper_faktur_id', '=', 123), ('date_terima_tukar_faktur', '=', False) ] -- cgit v1.2.3 From a40f08df72d7b1b034ba4e69bc4a80d5b3e2b87c Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Tue, 21 May 2024 13:23:49 +0700 Subject: add limit --- indoteknik_custom/models/ged.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/ged.py b/indoteknik_custom/models/ged.py index a175c330..8dc53b63 100644 --- a/indoteknik_custom/models/ged.py +++ b/indoteknik_custom/models/ged.py @@ -265,7 +265,7 @@ class DunningRunGed(models.Model): ('shipper_faktur_id', '=', 123), ('date_terima_tukar_faktur', '=', False) ] - dunnings = self.env['dunning.run'].search(query) + dunnings = self.env['dunning.run'].search(query, limit=20) for dunning in dunnings: current_tracking = self.env['ged.tracking'].search([('awb_no', '=', dunning.resi_tukar_faktur)], limit=1) -- cgit v1.2.3 From dc90b4a31e887a69b6e53dfd096313224c94c644 Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Tue, 21 May 2024 13:31:12 +0700 Subject: increase limit --- indoteknik_custom/models/ged.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/ged.py b/indoteknik_custom/models/ged.py index 8dc53b63..c6e346c0 100644 --- a/indoteknik_custom/models/ged.py +++ b/indoteknik_custom/models/ged.py @@ -265,7 +265,7 @@ class DunningRunGed(models.Model): ('shipper_faktur_id', '=', 123), ('date_terima_tukar_faktur', '=', False) ] - dunnings = self.env['dunning.run'].search(query, limit=20) + dunnings = self.env['dunning.run'].search(query, limit=50) for dunning in dunnings: current_tracking = self.env['ged.tracking'].search([('awb_no', '=', dunning.resi_tukar_faktur)], limit=1) -- cgit v1.2.3 From 04c3476f86c7499573f28aa603126481fe4e0daa Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Tue, 21 May 2024 13:59:01 +0700 Subject: add view ged tracking on dunning run --- indoteknik_custom/models/ged.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/ged.py b/indoteknik_custom/models/ged.py index c6e346c0..a2e8bc3c 100644 --- a/indoteknik_custom/models/ged.py +++ b/indoteknik_custom/models/ged.py @@ -59,6 +59,7 @@ class GedTracking(models.Model): last_status_detail = fields.Char(string='Last Status Detail') last_status = fields.Char(string='Last Status') tracking_line = fields.One2many('ged.tracking.line', 'ged_tracking_id', string='Tracking Lines', auto_join=True) + dunning_id = fields.Many2one('dunning.run', string='Dunning Run') class GedTrackingLine(models.Model): @@ -79,6 +80,7 @@ class GedTrackingLine(models.Model): photo_location = fields.Char(string='Photo Location') photo_receiver = fields.Char(string='Photo Receiver') gps = fields.Char(string='GPS') + dunning_id = fields.Many2one('dunning.run', string='Dunning Run') class GedTrackingLog(models.Model): @@ -218,7 +220,8 @@ class GedApi(models.Model): 'last_location': last_location, 'last_description': last_description, 'last_status_detail': last_status_detail, - 'last_status': header_last_status + 'last_status': header_last_status, + 'dunning_id': dunning_run.id } ged_tracking = self.env['ged.tracking'].create(param_header) @@ -239,7 +242,8 @@ class GedApi(models.Model): 'location': location, 'description': description, 'status_detail': status_detail, - 'status': status + 'status': status, + 'dunning_id': dunning_run.id } self.env['ged.tracking.line'].create(param_line) @@ -250,6 +254,8 @@ class DunningRunGed(models.Model): _inherit = 'dunning.run' last_status_awb = fields.Char(string='Last Status AWB') + ged_tracking = fields.One2many('ged.tracking', 'dunning_id', string='GED Tracking', auto_join=True) + ged_tracking_line = fields.One2many('ged.tracking.line', 'dunning_id', string='GED Tracking Line', auto_join=True) def _get_tracking_history(self, test_awb_number): if test_awb_number > 0: -- cgit v1.2.3 From 4f5594be8d73f88fbb42671525d0d2c6ed977abe Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Tue, 21 May 2024 16:00:12 +0700 Subject: create function to update internal reference variants --- indoteknik_custom/models/product_template.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'indoteknik_custom/models') diff --git a/indoteknik_custom/models/product_template.py b/indoteknik_custom/models/product_template.py index 8494e18a..97ad07a7 100755 --- a/indoteknik_custom/models/product_template.py +++ b/indoteknik_custom/models/product_template.py @@ -350,6 +350,18 @@ class ProductProduct(models.Model): is_edited = fields.Boolean(string='Is Edited') qty_sold = fields.Float(string='Sold Quantity', compute='_get_qty_sold') + def update_internal_reference_variants(self, limit=100): + variants = self.env['product.product'].search([ + ('default_code', '=', False), + ('type', '=', 'product'), + ('active', '=', True) + ], limit=limit, order='write_date desc') + for variant in variants: + if not variant.default_code: + variant.default_code = 'ITV.'+str(variant.id) + + _logger.info('Updated variant %s' % variant.name) + def _get_po_suggest(self, qty_purchase): if self.qty_available_bandengan < qty_purchase: return 'harus beli' -- cgit v1.2.3