1. zikzakmedia
  2. trytond-party_event

Commits

Raimon Esteve (Zikzakmedia)  committed 380749d

Add type event (email, phone,...)

  • Participants
  • Parent commits 4b1dac3
  • Branches default

Comments (0)

Files changed (3)

File party.py

View file
 class Party(Model):
     _name = 'party.party'
 
-    events = fields.One2Many('party.event', 'party', 'Events', readonly=True)
+    events = fields.One2Many('party.event', 'party', 'Events')
 
 Party()

File party_event.py

View file
 
 import datetime
 
+_TYPES = [
+    ('phone', 'Phone'),
+    ('mobile', 'Mobile'),
+    ('fax', 'Fax'),
+    ('email', 'E-Mail'),
+    ('skype', 'Skype'),
+    ('irc', 'IRC'),
+    ('jabber', 'Jabber'),
+    ('other', 'Other'),
+]
+
 class PartyEvent(ModelSQL, ModelView):
     'Party Event'
     _name = 'party.event'
     _description = __doc__
     _order_name = 'date'
 
+    type = fields.Selection(_TYPES, 'Type', required=True, states=STATES,
+        sort=False)
     event_date = fields.DateTime('Date', required=True, readonly=True)
     subject = fields.Char('Subject', required=True, readonly=True)
     description = fields.Text('Description', readonly=True)
             'no_subject': 'No subject',
         })
 
+    def default_type(self):
+        return 'email'
+
     def get_resource(self):
         '''Get Resources. Rewrite this method to add new resource references'''
         res = []

File party_event.xml

View file
           <field name="arch" type="xml">
             <![CDATA[
             <tree string="Events">
+                <field name="type"/>
                 <field name="event_date"/>
                 <field name="subject"/>
                 <field name="resource"/>
           <field name="arch" type="xml">
             <![CDATA[
             <form string="Event" col="6">
+                <label name="type"/>
+                <field name="type"/>
                 <label name="event_date"/>
                 <field name="event_date"/>
                 <label name="subject"/>