diff options
| author | Miqdad <ahmadmiqdad27@gmail.com> | 2025-07-24 16:16:36 +0700 |
|---|---|---|
| committer | Miqdad <ahmadmiqdad27@gmail.com> | 2025-07-24 16:16:36 +0700 |
| commit | b1c7b43c51c670e42a0dd2399139fbd9a600f121 (patch) | |
| tree | ad6d4f01dc4928c01ed40ae1b32efbe811e3ec94 | |
| parent | bdf6d7dbd8850d525809726036c6783b9113028f (diff) | |
<miqdad> is disc item from web
| -rw-r--r-- | indoteknik_custom/models/sale_order_line.py | 14 | ||||
| -rwxr-xr-x | indoteknik_custom/views/sale_order.xml | 1 |
2 files changed, 15 insertions, 0 deletions
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 @@ <field name="weight" optional="hide"/> <field name="amount_voucher_disc" string="Voucher" readonly="1" optional="hide"/> <field name="order_promotion_id" string="Promotion" readonly="1" optional="hide"/> + <field name="is_has_disc" string="FlashSale Item" readonly="1" optional="hide"/> </xpath> <xpath expr="//form/sheet/notebook/page/field[@name='order_line']/tree/field[@name='product_id']" |
