summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models
diff options
context:
space:
mode:
authorFIN-IT_AndriFP <it@fixcomart.co.id>2025-10-25 13:01:34 +0700
committerFIN-IT_AndriFP <it@fixcomart.co.id>2025-10-25 13:01:34 +0700
commit526fe78f8cc9ccfad7a8d8664216c2afea55d1bd (patch)
tree516284f2948cc53360013f1db81d916af2bfa64e /indoteknik_custom/models
parente7264cf6995755f3a55e0d1eb9059354a56c552f (diff)
parentbbacaaa7fc8526a2831f9cdd890e25fb68f410ff (diff)
Merge branch 'odoo-backup' of https://bitbucket.org/altafixco/indoteknik-addons into pum-v3
Diffstat (limited to 'indoteknik_custom/models')
-rw-r--r--indoteknik_custom/models/refund_sale_order.py5
-rwxr-xr-xindoteknik_custom/models/sale_order.py29
-rw-r--r--indoteknik_custom/models/solr/apache_solr_queue.py19
-rw-r--r--indoteknik_custom/models/solr/product_product.py4
4 files changed, 31 insertions, 26 deletions
diff --git a/indoteknik_custom/models/refund_sale_order.py b/indoteknik_custom/models/refund_sale_order.py
index 47565dfc..e6547a88 100644
--- a/indoteknik_custom/models/refund_sale_order.py
+++ b/indoteknik_custom/models/refund_sale_order.py
@@ -753,10 +753,11 @@ class RefundSaleOrder(models.Model):
line_vals = []
for so in self.sale_order_ids:
for line in so.order_line:
- if line.qty_delivered == 0:
+ barang_kurang = line.product_uom_qty - line.qty_delivered
+ if line.qty_delivered == 0 or barang_kurang > 0:
line_vals.append((0, 0, {
'product_id': line.product_id.id,
- 'quantity': line.product_uom_qty,
+ 'quantity': barang_kurang,
'from_name': so.name,
'prod_id': so.id,
'reason': '',
diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py
index a5e2f7c4..5c8f34c6 100755
--- a/indoteknik_custom/models/sale_order.py
+++ b/indoteknik_custom/models/sale_order.py
@@ -399,20 +399,21 @@ class SaleOrder(models.Model):
)
def action_open_partial_delivery_wizard(self):
- self.ensure_one()
- pickings = self.picking_ids.filtered(lambda p: p.state not in ['done', 'cancel'] and p.name and 'BU/PICK/' in p.name)
- return {
- 'type': 'ir.actions.act_window',
- 'name': 'Partial Delivery',
- 'res_model': 'partial.delivery.wizard',
- 'view_mode': 'form',
- 'target': 'new',
- 'context': {
- 'default_sale_id': self.id,
- # kasih langsung list of int biar ga ribet di wizard
- 'default_picking_ids': pickings.ids,
- }
- }
+ raise UserError("Fitur ini sedang dalam pengembangan")
+ # self.ensure_one()
+ # pickings = self.picking_ids.filtered(lambda p: p.state not in ['done', 'cancel'] and p.name and 'BU/PICK/' in p.name)
+ # return {
+ # 'type': 'ir.actions.act_window',
+ # 'name': 'Partial Delivery',
+ # 'res_model': 'partial.delivery.wizard',
+ # 'view_mode': 'form',
+ # 'target': 'new',
+ # 'context': {
+ # 'default_sale_id': self.id,
+ # # kasih langsung list of int biar ga ribet di wizard
+ # 'default_picking_ids': pickings.ids,
+ # }
+ # }
@api.depends('partner_id.is_cbd_locked')
diff --git a/indoteknik_custom/models/solr/apache_solr_queue.py b/indoteknik_custom/models/solr/apache_solr_queue.py
index 1b51538f..3d6bd733 100644
--- a/indoteknik_custom/models/solr/apache_solr_queue.py
+++ b/indoteknik_custom/models/solr/apache_solr_queue.py
@@ -1,10 +1,10 @@
from odoo import models, fields
from datetime import datetime, timedelta
-import logging, time
-
+import logging, time, traceback # <-- tambah traceback
_logger = logging.getLogger(__name__)
+
class ApacheSolrQueue(models.Model):
_name = 'apache.solr.queue'
@@ -19,6 +19,7 @@ class ApacheSolrQueue(models.Model):
], 'Execute Status')
execute_date = fields.Datetime('Execute Date')
description = fields.Text('Description')
+ log = fields.Text('Log')
def _compute_display_name(self):
for rec in self:
@@ -39,7 +40,7 @@ class ApacheSolrQueue(models.Model):
if elapsed_time > max_exec_time:
break
rec.execute_queue()
-
+
def open_target_record(self):
return {
'name': '',
@@ -67,17 +68,21 @@ class ApacheSolrQueue(models.Model):
if model_instance:
getattr(model_instance, function_name)()
rec.execute_status = 'success'
+ rec.log = traceback.format_exc()
else:
rec.execute_status = 'not_found'
except Exception as e:
- rec.description = e
+ # simpan error ringkas + traceback lengkap
+ rec.description = str(e)
+ rec.log = traceback.format_exc()
rec.execute_status = 'failed'
+
rec.execute_date = datetime.utcnow()
self.env.cr.commit()
def create_unique(self, payload={}):
count = self.search_count([
- ('res_model', '=', payload['res_model']),
+ ('res_model', '=', payload['res_model']),
('res_id', '=', payload['res_id']),
('function_name', '=', payload['function_name']),
('execute_status', '=', False)
@@ -90,8 +95,6 @@ class ApacheSolrQueue(models.Model):
('execute_status', '=', 'success'),
('execute_date', '>=', (datetime.utcnow() - timedelta(days=days_after))),
], limit=limit)
-
+
for rec in solr:
rec.unlink()
-
-
diff --git a/indoteknik_custom/models/solr/product_product.py b/indoteknik_custom/models/solr/product_product.py
index d8bc3973..7260c3ca 100644
--- a/indoteknik_custom/models/solr/product_product.py
+++ b/indoteknik_custom/models/solr/product_product.py
@@ -69,9 +69,9 @@ class ProductProduct(models.Model):
'product_id_i': variant.id,
'template_id_i': variant.product_tmpl_id.id,
'image_s': ir_attachment.api_image('product.template', 'image_512', variant.product_tmpl_id.id),
- 'image_carousel_s': [ir_attachment.api_image('image.carousel', 'image', carousel.id) for carousel in variant.product_tmpl_id.image_carousel_lines],
+ 'image_carousel_ss': [ir_attachment.api_image('image.carousel', 'image', carousel.id) for carousel in variant.product_tmpl_id.image_carousel_lines],
'image_mobile_s': ir_attachment.api_image('product.template', 'image_256', variant.product_tmpl_id.id),
- 'stock_total_f': variant.qty_stock_vendor,
+ 'stock_total_f': variant.qty_free_bandengan,
'weight_f': variant.weight,
'manufacture_id_i': variant.product_tmpl_id.x_manufacture.id or 0,
'manufacture_name_s': variant.product_tmpl_id.x_manufacture.x_name or '',