From cafd5e445b647cdb2b88ebb12def45aad0f6976a Mon Sep 17 00:00:00 2001 From: Sergi Almacellas Abellana Date: Mon, 26 Mar 2018 14:10:04 +0200 Subject: [PATCH] Use deactivable mixin issue4341 review38401002 --- carrier.py | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/carrier.py b/carrier.py index 5cf1fed26b..a9a28a25f8 100644 --- a/carrier.py +++ b/carrier.py @@ -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)