Debian Codegraph @

addons/website_event_sale/models/sale_order_line.py

raw
1 # Part of Odoo. See LICENSE file for full copyright and licensing details.
2
3 from odoo import api, models
4
5
6 class SaleOrderLine(models.Model):
7 _inherit = 'sale.order.line'
8
9 @api.depends('product_id.display_name', 'event_ticket_id.display_name')
10 def _compute_name_short(self):
11 """ Override of `website_sale` to replace the product name with the ticket name. """
12 super()._compute_name_short()
13
14 for line in self:
15 if line.event_ticket_id:
16 line.name_short = line.event_ticket_id.display_name
17
18 def _should_show_strikethrough_price(self):
19 """ Override of `website_sale` to hide the strikethrough price for events. """
20 return super()._should_show_strikethrough_price() and not self.event_id
21
22 def _is_reorder_allowed(self):
23 return not self.event_id and super()._is_reorder_allowed()