| 1 |
# -*- coding: utf-8 -*- |
| 2 |
# Part of Odoo. See LICENSE file for full copyright and licensing details. |
| 3 |
|
| 4 |
from odoo import _, api, fields, models |
| 5 |
|
| 6 |
|
| 7 |
class ProductTemplate(models.Model): |
| 8 |
_inherit = 'product.template' |
| 9 |
|
| 10 |
service_tracking = fields.Selection(selection_add=[ |
| 11 |
('course', 'Course Access'), |
| 12 |
], ondelete={'course': 'set default'}) |
| 13 |
|
| 14 |
def _prepare_service_tracking_tooltip(self): |
| 15 |
if self.service_tracking == 'course': |
| 16 |
return _("Grant access to the eLearning course linked to this product.") |
| 17 |
return super()._prepare_service_tracking_tooltip() |
| 18 |
|
| 19 |
@api.model |
| 20 |
def _get_product_types_allow_zero_price(self): |
| 21 |
return super()._get_product_types_allow_zero_price() + ["course"] |
| 22 |
|
| 23 |
def _service_tracking_blacklist(self): |
| 24 |
return super()._service_tracking_blacklist() + ['course'] |