diff options
| author | Miqdad <ahmadmiqdad27@gmail.com> | 2025-07-26 21:02:52 +0700 |
|---|---|---|
| committer | Miqdad <ahmadmiqdad27@gmail.com> | 2025-07-26 21:02:52 +0700 |
| commit | aeb450314a0440806ceb300c71c5776d42289ad4 (patch) | |
| tree | befd9f6acd512f8426828350a8ad0671ca12bcc0 /indoteknik_custom/models | |
| parent | 7cea5aa18bea9b80ace297bfc36eec8db1adef6e (diff) | |
<miqdad> push
Diffstat (limited to 'indoteknik_custom/models')
| -rw-r--r-- | indoteknik_custom/models/sale_order_line.py | 28 |
1 files changed, 3 insertions, 25 deletions
diff --git a/indoteknik_custom/models/sale_order_line.py b/indoteknik_custom/models/sale_order_line.py index bc1fcd09..ff2e9009 100644 --- a/indoteknik_custom/models/sale_order_line.py +++ b/indoteknik_custom/models/sale_order_line.py @@ -2,8 +2,9 @@ from odoo import fields, models, api, _ from odoo.exceptions import UserError from datetime import datetime, timedelta import logging +from odoo.tools.float_utils import float_compare -__logger = logging.getLogger(__name__) +_logger = logging.getLogger(__name__) class SaleOrderLine(models.Model): @@ -52,31 +53,8 @@ class SaleOrderLine(models.Model): qty_free_bu = fields.Float(string='Free BU', compute='_get_qty_free_bandengan') desc_updatable = fields.Boolean(string='desc boolean', default=True, compute='_get_desc_updatable') - is_has_disc = fields.Boolean('FlashSale Item', compute='_compute_is_has_disc', default=False) + is_has_disc = fields.Boolean('FlashSale Item', default=False) - @api.depends('product_id', 'price_unit', 'order_id.source_id') - def _compute_is_has_disc(self): - website_source_id = 59 - excluded_pricelist_ids = [17022, 17027, 17026, 17025, 17024, 17023] - - for line in self: - line.is_has_disc = False # default - - # Step 1: Bukan dari website? Skip - if not line.order_id.source_id or line.order_id.source_id.id != website_source_id: - continue - - # Step 2: Ambil semua pricelist item berdasarkan produk - pricelist_items = self.env['product.pricelist.item'].search([ - ('product_id', '=', line.product_id.id), - ('pricelist_id', 'not in', excluded_pricelist_ids), - ]) - - # Step 3: Jika ada pricelist_items, tandai sebagai flashsale - if pricelist_items: - line.is_has_disc = True - elif not pricelist_items: - line.is_has_disc = False def _get_outgoing_incoming_moves(self): outgoing_moves = self.env['stock.move'] |
