diff --git a/__init__.py b/__init__.py
index b21e6e1..4391a2a 100644
--- a/__init__.py
+++ b/__init__.py
@@ -15,6 +15,7 @@ def register():
equipment.OpticalEquipment,
configuration_equipment.Configuration,
maintenance.Maintenance,
+ maintenance.MaintenanceLine,
subscription.Subscription,
subscription.SubscriptionEquipment,
module='optical_equipment', type_='model')
diff --git a/maintenance.py b/maintenance.py
index 585a3f3..6678ef6 100644
--- a/maintenance.py
+++ b/maintenance.py
@@ -1,7 +1,7 @@
from trytond.model import (
Workflow, ModelSQL, ModelView, Unique, fields)
from trytond.transaction import Transaction
-from trytond.pyson import Eval
+from trytond.pyson import Eval, If
class Maintenance(Workflow, ModelSQL, ModelView):
'Equipment Maintenance'
@@ -53,7 +53,10 @@ class Maintenance(Workflow, ModelSQL, ModelView):
def default_company():
return Transaction().context.get('company')
-
+ @classmethod
+ def default_state(cls):
+ return 'draft'
+
@classmethod
@ModelView.button
@Workflow.transition('draft')
@@ -81,3 +84,13 @@ class Maintenance(Workflow, ModelSQL, ModelView):
class MaintenanceLine(ModelSQL, ModelView):
'Maintenance Line'
__name__ = 'optical_equipment.maintenance.line'
+
+ maintenance_acitivity = fields.Many2One('product.product', 'Product',
+ ondelete='RESTRICT',
+ domain=[If(Eval('state').in_(['draft']),
+ ('maintenance_activity', '=', True),()),])
+
+ maintenance_acitivity = fields.Many2One('product.product', 'Product',
+ ondelete='RESTRICT',
+ domain=[If(Eval('state').in_(['draft']),
+ ('replacement', '=', True),()),])
diff --git a/view/maintenance_form.xml b/view/maintenance_form.xml
index 2424aaf..28b2986 100644
--- a/view/maintenance_form.xml
+++ b/view/maintenance_form.xml
@@ -15,14 +15,14 @@
-
-
-
-
+
+
+
+