From b1c7b43c51c670e42a0dd2399139fbd9a600f121 Mon Sep 17 00:00:00 2001 From: Miqdad Date: Thu, 24 Jul 2025 16:16:36 +0700 Subject: is disc item from web --- indoteknik_custom/models/sale_order_line.py | 14 ++++++++++++++ indoteknik_custom/views/sale_order.xml | 1 + 2 files changed, 15 insertions(+) diff --git a/indoteknik_custom/models/sale_order_line.py b/indoteknik_custom/models/sale_order_line.py index 5e9fc362..f2799319 100644 --- a/indoteknik_custom/models/sale_order_line.py +++ b/indoteknik_custom/models/sale_order_line.py @@ -1,6 +1,9 @@ from odoo import fields, models, api, _ from odoo.exceptions import UserError from datetime import datetime, timedelta +import logging + +__logger = logging.getLogger(__name__) class SaleOrderLine(models.Model): @@ -49,6 +52,17 @@ 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) + + @api.depends('discount', 'order_id.source_id') + def _compute_is_has_disc(self): + for line in self: + line.is_has_disc = ( + line.discount > 0 and + line.order_id.source_id and + line.order_id.source_id.id == 59 + ) + def _get_outgoing_incoming_moves(self): outgoing_moves = self.env['stock.move'] incoming_moves = self.env['stock.move'] diff --git a/indoteknik_custom/views/sale_order.xml b/indoteknik_custom/views/sale_order.xml index 346dc0f8..532fccc2 100755 --- a/indoteknik_custom/views/sale_order.xml +++ b/indoteknik_custom/views/sale_order.xml @@ -289,6 +289,7 @@ +