From 987310e7d0a56ead086d832b23241da4fc2d95d8 Mon Sep 17 00:00:00 2001 From: Sergi Almacellas Abellana Date: Mon, 26 Mar 2018 14:12:27 +0200 Subject: [PATCH] Use deactivable mixin issue4341 review38401002 --- view/work_center_list.xml | 1 - view/work_center_tree.xml | 1 - work.py | 11 +++-------- 3 files changed, 3 insertions(+), 10 deletions(-) diff --git a/view/work_center_list.xml b/view/work_center_list.xml index 5bae0cdfc6..c696433333 100644 --- a/view/work_center_list.xml +++ b/view/work_center_list.xml @@ -4,6 +4,5 @@ this repository contains the full copyright notices and license terms. --> - diff --git a/view/work_center_tree.xml b/view/work_center_tree.xml index b067591286..15b21107b9 100644 --- a/view/work_center_tree.xml +++ b/view/work_center_tree.xml @@ -4,6 +4,5 @@ this repository contains the full copyright notices and license terms. --> - diff --git a/work.py b/work.py index dad34cda5f..f2a31cf163 100644 --- a/work.py +++ b/work.py @@ -5,8 +5,8 @@ import random from decimal import Decimal from functools import wraps -from trytond.model import ModelSQL, ModelView, Workflow, fields, \ - sequence_ordered +from trytond.model import ( + ModelSQL, ModelView, Workflow, DeactivableMixin, fields, sequence_ordered) from trytond.pool import Pool from trytond.pyson import Eval, If, Bool from trytond.transaction import Transaction @@ -24,7 +24,7 @@ class WorkCenterCategory(ModelSQL, ModelView): name = fields.Char('Name', required=True, translate=True) -class WorkCenter(ModelSQL, ModelView): +class WorkCenter(DeactivableMixin, ModelSQL, ModelView): 'Work Center' __name__ = 'production.work.center' name = fields.Char('Name', required=True, translate=True) @@ -55,7 +55,6 @@ class WorkCenter(ModelSQL, ModelView): 'required': Bool(Eval('cost_price')), }, depends=['cost_price']) - active = fields.Boolean('Active') company = fields.Many2One('company.company', 'Company', required=True, select=True) warehouse = fields.Many2One('stock.location', 'Warehouse', required=True, @@ -74,10 +73,6 @@ class WorkCenter(ModelSQL, ModelView): }) cls._order.insert(0, ('name', 'ASC')) - @classmethod - def default_active(cls): - return True - @classmethod def default_company(cls): return Transaction().context.get('company')