diff options
Diffstat (limited to 'fixco_custom/models')
| -rwxr-xr-x | fixco_custom/models/detail_order.py | 6 | ||||
| -rwxr-xr-x | fixco_custom/models/stock_picking.py | 20 | ||||
| -rwxr-xr-x | fixco_custom/models/webhook_ginee.py | 3 |
3 files changed, 29 insertions, 0 deletions
diff --git a/fixco_custom/models/detail_order.py b/fixco_custom/models/detail_order.py index 598fb70..efb63d6 100755 --- a/fixco_custom/models/detail_order.py +++ b/fixco_custom/models/detail_order.py @@ -61,6 +61,9 @@ class DetailOrder(models.Model): raise UserError(_("Error extracting order ID: %s") % str(e)) def process_queue_item(self, limit=100): + now = time.strftime('%Y-%m-%d %H:%M:%S') + if now < '2025-12-31 00:00:00': + return domain = [('execute_status', '=', False)] records = self.search(domain, order='create_date asc', limit=limit) for rec in records: @@ -132,6 +135,9 @@ class DetailOrder(models.Model): raise UserError(_("Error extracting order ID: %s") % str(e)) def process_queue_item_detail(self, limit=100): + now = time.strftime('%Y-%m-%d %H:%M:%S') + if now < '2025-12-31 00:00:00': + return domain = [ ('execute_status', '=', 'detail_order'), '!', diff --git a/fixco_custom/models/stock_picking.py b/fixco_custom/models/stock_picking.py index 3610179..07425d2 100755 --- a/fixco_custom/models/stock_picking.py +++ b/fixco_custom/models/stock_picking.py @@ -66,6 +66,11 @@ class StockPicking(models.Model): type_sku = fields.Selection([('single', 'Single SKU'), ('multi', 'Multi SKU')], string='Type SKU') list_product = fields.Char(string='List Product') + def rts_ginee(self): + self.get_shipping_parameter() + self.ship_order() + + def create_invoices(self): so_id = self.sale_id.id if not so_id: @@ -294,8 +299,12 @@ class StockPicking(models.Model): def label_ginee(self): try: + now = time.strftime('%Y-%m-%d %H:%M:%S') order_id = self.order_reference + if not self.ginee_task_id and now > '2025-12-31 00:00:00': + raise UserError(_("Klik Ready To Ship terlebih dahulu")) + authorization = self.sign_request(0) headers = { 'Content-Type': 'application/json', @@ -329,6 +338,17 @@ class StockPicking(models.Model): self.tracking_number = logistic_info.get('logisticsTrackingNumber') or '' self.provider_name = logistic_info.get('logisticsProviderName') or '' self.invoice_number = logistic_info.get('invoiceNumber') or '' + + pdf_url = data.get('data', {}).get('pdfUrl') + + if not pdf_url: + raise UserError(_("PDF label URL tidak ditemukan")) + + return { + 'type': 'ir.actions.act_url', + 'url': pdf_url, + 'target': 'new', # buka tab baru (recommended buat PDF) + } else: raise UserError(_("API Error: %s - %s") % (data.get('code', 'UNKNOWN'), data.get('message', 'No error message'))) else: diff --git a/fixco_custom/models/webhook_ginee.py b/fixco_custom/models/webhook_ginee.py index 606bd21..65f2238 100755 --- a/fixco_custom/models/webhook_ginee.py +++ b/fixco_custom/models/webhook_ginee.py @@ -31,6 +31,9 @@ class WebhookGinee(models.Model): # rec.execute_queue() def process_queue_item(self, limit=100): + now = time.strftime('%Y-%m-%d %H:%M:%S') + if now < '2025-12-31 00:00:00': + return domain = [('execute_status', '=', False)] records = self.search(domain, order='create_date asc', limit=limit) for rec in records: |
