summaryrefslogtreecommitdiff
path: root/fixco_custom/models
diff options
context:
space:
mode:
Diffstat (limited to 'fixco_custom/models')
-rwxr-xr-xfixco_custom/models/detail_order.py2
-rwxr-xr-xfixco_custom/models/stock_picking.py16
2 files changed, 17 insertions, 1 deletions
diff --git a/fixco_custom/models/detail_order.py b/fixco_custom/models/detail_order.py
index f5596d7..74608b4 100755
--- a/fixco_custom/models/detail_order.py
+++ b/fixco_custom/models/detail_order.py
@@ -226,7 +226,7 @@ class DetailOrder(models.Model):
bline.variant_id,
price_bundling_bottom,
price,
- actual_price=combined_item['actualPrice']/combined_item['quantity'] # Use average price
+ actual_price=combined_item['actualPrice']
)
order_lines.append((0, 0, {
'product_id': bline.variant_id.id if bline.variant_id else product.id,
diff --git a/fixco_custom/models/stock_picking.py b/fixco_custom/models/stock_picking.py
index 9636956..3beff4a 100755
--- a/fixco_custom/models/stock_picking.py
+++ b/fixco_custom/models/stock_picking.py
@@ -38,6 +38,22 @@ class StockPicking(models.Model):
note_by_buyer = fields.Char('Note By Buyer')
carrier = fields.Char(string='Shipping Method')
shipment_group_id = fields.Many2one('shipment.group', string='Shipment Group', copy=False)
+ pdf_label_preview = fields.Binary(
+ string="PDF Preview",
+ compute="_compute_pdf_binary",
+ store=False
+ )
+
+ def _compute_pdf_binary(self):
+ for record in self:
+ record.pdf_label_preview = False
+ if record.pdf_label_url:
+ try:
+ response = requests.get(record.pdf_label_url, timeout=10)
+ if response.status_code == 200 and response.headers.get('Content-Type') == 'application/pdf':
+ record.pdf_label_preview = base64.b64encode(response.content)
+ except Exception as e:
+ _logger.warning(f"Gagal mengambil PDF dari URL: {e}")
@api.constrains('sale_id')
def _check_sale_order(self):