Use deactivable mixin
issue4341 review38401002
This commit is contained in:
+3
-7
@@ -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
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user