Use deactivable mixin

issue4341
review38401002
This commit is contained in:
Sergi Almacellas Abellana
2018-03-26 14:15:09 +02:00
parent 2dd7a53fda
commit 2c840d7490
3 changed files with 3 additions and 9 deletions
+3 -7
View File
@@ -4,7 +4,8 @@ import datetime
import operator
from decimal import Decimal
from trytond.model import (ModelView, ModelSQL, MatchMixin, ValueMixin, fields,
from trytond.model import (
ModelView, ModelSQL, MatchMixin, ValueMixin, DeactivableMixin, fields,
sequence_ordered)
from trytond import backend
from trytond.pyson import Eval, If
@@ -22,14 +23,13 @@ STATES = {
DEPENDS = ['active']
class Location(ModelSQL, ModelView):
class Location(DeactivableMixin, ModelSQL, ModelView):
"Stock Location"
__name__ = 'stock.location'
name = fields.Char("Name", size=None, required=True, states=STATES,
depends=DEPENDS, translate=True)
code = fields.Char("Code", size=None, states=STATES, depends=DEPENDS,
select=True)
active = fields.Boolean('Active', select=True)
address = fields.Many2One("party.address", "Address",
states={
'invisible': Eval('type') != 'warehouse',
@@ -259,10 +259,6 @@ class Location(ModelSQL, ModelView):
empty.discard(location.id)
return cls.browse(empty)
@staticmethod
def default_active():
return True
@staticmethod
def default_left():
return 0
-1
View File
@@ -5,5 +5,4 @@ this repository contains the full copyright notices and license terms. -->
<field name="name"/>
<field name="code"/>
<field name="type"/>
<field name="active" tree_invisible="1"/>
</tree>
-1
View File
@@ -8,5 +8,4 @@ this repository contains the full copyright notices and license terms. -->
<field name="forecast_quantity"/>
<field name="default_uom"/>
<field name="cost_value" sum="Cost Value"/>
<field name="active"/>
</tree>