Use deactivable mixin

issue4341
review38401002
This commit is contained in:
Sergi Almacellas Abellana committed 2018-03-26 14:12:27 +02:00
1 parent acfc85e473
commit 987310e7d0
3 files changed
+3 -10

No files matched your search

-1
View File
@@ -4,6 +4,5 @@ this repository contains the full copyright notices and license terms. -->
<tree>
<field name="rec_name"/>
<field name="category"/>
<field name="active" tree_invisible="1"/>
<field name="warehouse" tree_invisible="1"/>
</tree>
-1
View File
@@ -4,6 +4,5 @@ this repository contains the full copyright notices and license terms. -->
<tree>
<field name="name"/>
<field name="category"/>
<field name="active" tree_invisible="1"/>
<field name="warehouse" tree_invisible="1"/>
</tree>
+3 -8
View File
@@ -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')