summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAzka Nathan <darizkyfaz@gmail.com>2025-06-20 16:19:34 +0700
committerAzka Nathan <darizkyfaz@gmail.com>2025-06-20 16:19:34 +0700
commit7d22bf1355720a8f571476738e0f06f580b2546c (patch)
tree4feb1ca650181cc3cdbc747d50c84f54de374458
parent361b171b83e3baed2ba240ace756bb73f1557d2a (diff)
source and pricelist item
-rwxr-xr-xfixco_custom/models/detail_order.py10
-rwxr-xr-xfixco_custom/models/webhook_ginee.py5
2 files changed, 11 insertions, 4 deletions
diff --git a/fixco_custom/models/detail_order.py b/fixco_custom/models/detail_order.py
index e2cb5cb..c9ace50 100755
--- a/fixco_custom/models/detail_order.py
+++ b/fixco_custom/models/detail_order.py
@@ -30,6 +30,10 @@ class DetailOrder(models.Model):
('already_so', 'SO Already Created'),
('processing_get_so', 'Processing Get SO'),
], 'Execute Status')
+ source = fields.Selection([
+ ('webhook', 'From Webhook'),
+ ('manual', 'Manual'),
+ ], 'source')
sale_id = fields.Many2one('sale.order', 'Sale Order')
picking_id = fields.Many2one('stock.picking', 'Picking')
invoice_id = fields.Many2one('account.move', 'Invoice')
@@ -179,11 +183,11 @@ class DetailOrder(models.Model):
bundling_lines = self.env['bundling.line'].search([('product_id', '=', product.id)])
bundling_variant_ids = bundling_lines.mapped('variant_id').ids
- sale_pricelist = self.env['sale.pricelist'].search([('product_id', 'in', bundling_variant_ids)])
+ sale_pricelist = self.env['product.pricelist.item'].search([('product_id', 'in', bundling_variant_ids), ('pricelist_id', '=', 17)])
price_bundling_bottom = sum(item.price for item in sale_pricelist)
for bline in bundling_lines:
- bottom_price = self.env['sale.pricelist'].search([('product_id', '=', bline.variant_id.id)], limit=1)
- price = bottom_price.price
+ bottom_price = self.env['product.pricelist.item'].search([('product_id', '=', bline.variant_id.id), ('pricelist_id', '=', 17)], limit=1)
+ price = bottom_price.fixed_price
price_unit = self.prorate_price_bundling(bline.variant_id,price_bundling_bottom,price,actual_price=item.get('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/webhook_ginee.py b/fixco_custom/models/webhook_ginee.py
index e1fb608..606bd21 100755
--- a/fixco_custom/models/webhook_ginee.py
+++ b/fixco_custom/models/webhook_ginee.py
@@ -37,5 +37,8 @@ class WebhookGinee(models.Model):
rec.execute_queue()
def execute_queue(self):
- detail_order = self.env['detail.order'].create({'json_ginee': self.json_ginee})
+ detail_order = self.env['detail.order'].create({
+ 'json_ginee': self.json_ginee,
+ 'source': 'webhook'
+ })
self.execute_status = 'success'