Odoo18-Base/addons/loyalty_delivery/models/sale_order.py

14 lines
485 B
Python
Raw Permalink Normal View History

2025-03-10 11:12:23 +07:00
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import models
class SaleOrder(models.Model):
_inherit = "sale.order"
def _compute_amount_total_without_delivery(self):
self.ensure_one()
lines = self.order_line.filtered(lambda l: l.coupon_id and l.coupon_id.program_type in ['ewallet', 'gift_card'])
return super()._compute_amount_total_without_delivery() - sum(lines.mapped('price_unit'))