summaryrefslogtreecommitdiff
path: root/fixco_custom/models
diff options
context:
space:
mode:
authorAzka Nathan <darizkyfaz@gmail.com>2025-12-24 14:07:54 +0700
committerAzka Nathan <darizkyfaz@gmail.com>2025-12-24 14:07:54 +0700
commit5dc0eb722ba306ed2e81acad1b6ba7457717af44 (patch)
tree0cb0fddb7deef4c300d3dc5441c26fba35f11056 /fixco_custom/models
parentaeeecacfe7b10ebbdefe5284f98e9e9f37c1b8d1 (diff)
push add lock date scheduler
Diffstat (limited to 'fixco_custom/models')
-rwxr-xr-xfixco_custom/models/detail_order.py6
-rwxr-xr-xfixco_custom/models/stock_picking.py20
-rwxr-xr-xfixco_custom/models/webhook_ginee.py3
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: