From 8df73ed96aac08d4553a6bb14253fe574838b17b Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Tue, 7 Oct 2025 21:18:41 +0200 Subject: [PATCH] purchase_usability_akretion: Revert my previous commit The field has_discount has no business interest on purchase.order reports. --- .../models/purchase_order.py | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/purchase_usability_akretion/models/purchase_order.py b/purchase_usability_akretion/models/purchase_order.py index d6c0dc9..2a33811 100644 --- a/purchase_usability_akretion/models/purchase_order.py +++ b/purchase_usability_akretion/models/purchase_order.py @@ -4,7 +4,6 @@ from odoo import api, fields, models from odoo.tools.misc import format_amount -from odoo.tools import float_is_zero class PurchaseOrder(models.Model): @@ -20,25 +19,12 @@ class PurchaseOrder(models.Model): # the compute method of that field is inherited in purchase_stock_usability delivery_partner_id = fields.Many2one( 'res.partner', compute='_compute_delivery_partner_id') - has_discount = fields.Boolean(compute='_compute_has_discount') @api.depends('dest_address_id') def _compute_delivery_partner_id(self): for order in self: order.delivery_partner_id = order.dest_address_id - @api.depends('order_line.discount') - def _compute_has_discount(self): - prec = self.env['decimal.precision'].precision_get('Discount') - for order in self: - has_discount = False - for line in order.order_line: - if not line.display_type and not float_is_zero( - line.discount, precision_digits=prec): - has_discount = True - break - order.has_discount = has_discount - # Re-write native _compute_display_name to use amount_untaxed instead of amount_total @api.depends('name', 'partner_ref', 'amount_total', 'currency_id') @api.depends_context('show_total_amount')