Files
tryton/modules/sale_subscription/service.py
T

28 lines
1014 B
Python
Raw Normal View History

2017-04-02 00:40:05 +02:00
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
2021-12-11 17:58:44 +01:00
from trytond.model import DeactivableMixin, ModelSQL, ModelView, fields
2017-04-02 00:40:05 +02:00
from trytond.pyson import Eval
2019-05-24 09:23:21 +02:00
class Service(DeactivableMixin, ModelSQL, ModelView):
2017-04-02 00:40:05 +02:00
"Subscription Service"
__name__ = 'sale.subscription.service'
product = fields.Many2One(
'product.product', "Product", required=True, ondelete='CASCADE',
2017-04-02 00:40:05 +02:00
domain=[
('type', '=', 'service'),
])
consumption_recurrence = fields.Many2One(
'sale.subscription.recurrence.rule.set', "Consumption Recurrence")
consumption_delay = fields.TimeDelta("Consumption Delay",
states={
'invisible': ~Eval('consumption_recurrence'),
})
2017-04-02 00:40:05 +02:00
def get_rec_name(self, name):
return self.product.rec_name
@classmethod
2018-09-19 00:15:58 +02:00
def search_rec_name(cls, name, clause):
2017-04-02 00:40:05 +02:00
return [('product.rec_name',) + tuple(clause[1:])]