diff --git a/routing.py b/routing.py index 685cd7c0bb..330d86d231 100644 --- a/routing.py +++ b/routing.py @@ -1,9 +1,6 @@ # 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 sql import Null -from sql.conditionals import Case - -from trytond.model import ModelSQL, ModelView, fields +from trytond.model import ModelSQL, ModelView, fields, sequence_ordered __all__ = ['Routing', 'Operation', 'RoutingStep', 'Routing_BOM'] @@ -33,26 +30,15 @@ class Operation(ModelSQL, ModelView): return True -class RoutingStep(ModelSQL, ModelView): +class RoutingStep(sequence_ordered(), ModelSQL, ModelView): 'Route' __name__ = 'production.routing.step' _rec_name = 'operation' - sequence = fields.Integer('Sequence') operation = fields.Many2One('production.routing.operation', 'Operation', required=True) routing = fields.Many2One('production.routing', 'Routing', required=True, ondelete='CASCADE') - @classmethod - def __setup__(cls): - super(RoutingStep, cls).__setup__() - cls._order.insert(0, ('sequence', 'ASC')) - - @classmethod - def order_sequence(cls, tables): - table, _ = tables[None] - return [Case((table.sequence == Null, 0), else_=1), table.sequence] - def get_rec_name(self, name): return self.operation.rec_name