# -*- coding: utf-8 -*-
from trytond.pool import PoolMeta
from trytond.model import ModelView, ModelSQL, fields


__metaclass__ = PoolMeta
__all__ = [
    'SaleChannelCarrier',
]


class SaleChannelCarrier(ModelSQL, ModelView):
    """
    Shipping Carriers

    This model stores the carriers / shipping methods, each record
    here can be mapped to a carrier in tryton which will then be
    used for managing export of tracking info.
    """
    __name__ = 'sale.channel.carrier'
    _rec_name = 'name'

    name = fields.Char('Name', readonly=True)
    code = fields.Char("Code", readonly=True)
    carrier = fields.Many2One('carrier', 'Carrier')
    channel = fields.Many2One(
        'sale.channel', 'Channel', readonly=True
    )

@@ -105,16 +105,47 @@
  fields%0A
+from trytond.pyson import Eval%0A
 %0A%0A__meta
@@ -204,16 +204,107 @@
 er',%0A%5D%0A%0A
+CARRIER_STATES = %7B%0A    'readonly': (Eval('id', default=0) %3E 0)%0A%7D%0ACARRIER_DEPENDS = %5B'id'%5D%0A%0A
 %0Aclass S
@@ -658,67 +658,133 @@
 e', 
-readonly=True)%0A    code = fields.Char(%22Code%22, readonly=True
+states=CARRIER_STATES, depends=CARRIER_DEPENDS)%0A    code = fields.Char(%22Code%22, states=CARRIER_STATES, depends=CARRIER_DEPENDS
 )%0A  

Fix states on channel carrier