Use deactivable mixin
issue4341 review38401002
This commit is contained in:
+5
-9
@@ -1,7 +1,8 @@
|
||||
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
# this repository contains the full copyright notices and license terms.
|
||||
from trytond.model import ModelView, ModelSQL, MatchMixin, fields, \
|
||||
sequence_ordered
|
||||
from trytond.model import (
|
||||
ModelView, ModelSQL, DeactivableMixin, MatchMixin, fields,
|
||||
sequence_ordered)
|
||||
from trytond.transaction import Transaction
|
||||
from trytond.pool import Pool
|
||||
from trytond.cache import Cache
|
||||
@@ -64,13 +65,12 @@ class Carrier(ModelSQL, ModelView):
|
||||
CarrierSelection._get_carriers_cache.clear()
|
||||
|
||||
|
||||
class CarrierSelection(sequence_ordered(), MatchMixin, ModelSQL, ModelView):
|
||||
class CarrierSelection(
|
||||
DeactivableMixin, sequence_ordered(), MatchMixin, ModelSQL, ModelView):
|
||||
'Carrier Selection'
|
||||
__name__ = 'carrier.selection'
|
||||
_get_carriers_cache = Cache('carrier.selection.get_carriers')
|
||||
|
||||
active = fields.Boolean('Active',
|
||||
help="Uncheck to exclude the criteria from future use.")
|
||||
from_country = fields.Many2One('country.country', 'From Country',
|
||||
ondelete='RESTRICT',
|
||||
help="Apply only when shipping from this country.\n"
|
||||
@@ -82,10 +82,6 @@ class CarrierSelection(sequence_ordered(), MatchMixin, ModelSQL, ModelView):
|
||||
carrier = fields.Many2One('carrier', 'Carrier', required=True,
|
||||
ondelete='CASCADE', help="The selected carrier.")
|
||||
|
||||
@staticmethod
|
||||
def default_active():
|
||||
return True
|
||||
|
||||
@classmethod
|
||||
def create(cls, *args, **kwargs):
|
||||
selections = super(CarrierSelection, cls).create(*args, **kwargs)
|
||||
|
||||
Reference in New Issue
Block a user