summaryrefslogtreecommitdiff
path: root/fixco_custom/models/stock_picking.py
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/stock_picking.py
parentaeeecacfe7b10ebbdefe5284f98e9e9f37c1b8d1 (diff)
push add lock date scheduler
Diffstat (limited to 'fixco_custom/models/stock_picking.py')
-rwxr-xr-xfixco_custom/models/stock_picking.py20
1 files changed, 20 insertions, 0 deletions
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: