Commits

Raimon Esteve (Zikzakmedia)  committed d8cd818

Active Record

  • Participants
  • Parent commits a10deb0

Comments (0)

Files changed (9)

+Version 2.6.0 - 2012-10-16
+* Active Record
+* Simplify module information with python configuration
+
 Version 2.4.0 - 2012-09-06
 * Initial release
 include COPYRIGHT
 include LICENSE
 include *.xml
-include *.odt
 include locale/*.po
 include doc/*
 =============================
 
 The electronic_mail_event module of the Tryton application platform.
-See __tryton__.py
 
 Installing
 ----------
 #This file is part electronic_mail_event module for Tryton.
 #The COPYRIGHT file at the top level of this repository contains 
 #the full copyright notices and license terms.
-
+from trytond.pool import Pool
 from .party_event import *
 from .template import *
+
+
+def register():
+    Pool.register(
+        PartyEvent,
+        Template,
+        module='electronic_mail_event', type_='model')

File __tryton__.py

-#This file is part electronic_mail_event module for Tryton.
-#The COPYRIGHT file at the top level of this repository contains 
-#the full copyright notices and license terms.
-{
-    'name': 'Electronic Mail Event',
-    'name_ca_ES': 'Esdeveniments correu electrònic',
-    'name_es_ES': 'Eventos correo electrónico',
-    'version': '2.4.0',
-    'author': 'Zikzakmedia',
-    'email': 'zikzak@zikzakmedia.com',
-    'website': 'http://www.zikzakmedia.com/',
-    'description': '''Add Party Event mail reference''',
-    'description_ca_ES': '''Afegeix als esdeveniments de la empresa la relació amb el correu electrònic''',
-    'description_es_ES': '''Añade a los eventos de la empresa la relación con el correo electrónico''',
-    'depends': [
-        'ir',
-        'res',
-        'electronic_mail_template',
-        'party_event',
-    ],
-    'xml': [
-        'template.xml',
-    ],
-    'translation': [
-        'locale/ca_ES.po',
-        'locale/es_ES.po',
-    ]
-}

File party_event.py

 #This file is part electronic_mail_event module for Tryton.
 #The COPYRIGHT file at the top level of this repository contains 
 #the full copyright notices and license terms.
+from trytond.pool import Pool, PoolMeta
 
-from trytond.model import ModelView, ModelSQL, fields
-from trytond.pool import Pool
+__all__ = ['PartyEvent']
+__metaclass__ = PoolMeta
 
-class PartyEvent(ModelSQL, ModelView):
+class PartyEvent:
     'Party Event'
-    _name = 'party.event'
+    __name__ = 'party.event'
 
-    def get_resource(self):
-        res = super(PartyEvent, self).get_resource()
-        model_obj = Pool().get('ir.model')
-        model_ids = model_obj.search([
+    @classmethod
+    def get_resource(cls):
+        res = super(PartyEvent, cls).get_resource()
+        Model = Pool().get('ir.model')
+        model_ids = Model.search([
             ('model', '=', 'electronic.mail'),
             ])
-        for model in model_obj.browse(model_ids):
+        for model in Model.browse(model_ids):
             res.append([model.model, model.name])
         return res
 
-PartyEvent()
 
 from setuptools import setup
 import re
+import os
+import ConfigParser
 
-info = eval(open('__tryton__.py').read())
+config = ConfigParser.ConfigParser()
+config.readfp(open('tryton.cfg'))
+info = dict(config.items('tryton'))
+for key in ('depends', 'extras_depend', 'xml'):
+    if key in info:
+        info[key] = info[key].strip().splitlines()
 major_version, minor_version, _ = info.get('version', '0.0.1').split('.', 2)
 major_version = int(major_version)
 minor_version = int(minor_version)
 
 setup(name='trytond_electronic_mail_event',
     version=info.get('version', '0.0.1'),
-    description=info.get('description', ''),
-    author=info.get('author', 'Zikzakmedia'),
-    author_email=info.get('email', 'zikzak@zikzakmedia.com'),
-    url=info.get('website', 'http://www.zikzakmedia.com'),
+    description='Tryton module for electronic mail event',
+    author='Zikzakmedia SL',
+    author_email='zikzak@zikzakmedia.com',
+    url='http://www.zikzakmedia.com',
     download_url="https://bitbucket.org/zikzakmedia/trytond-electronic_mail_event",
     package_dir={'trytond.modules.electronic_mail_event': '.'},
     packages=[
     ],
     package_data={
         'trytond.modules.electronic_mail_event': info.get('xml', []) \
-                + info.get('translation', []),
+            + ['tryton.cfg', 'locale/*.po'],
     },
     classifiers=[
         'Development Status :: 5 - Production/Stable',
 #This file is part electronic_mail_event module for Tryton.
 #The COPYRIGHT file at the top level of this repository contains 
 #the full copyright notices and license terms.
+from trytond.model import fields
+from trytond.pool import PoolMeta
 
-from trytond.model import ModelView, ModelSQL, fields
+__all__ = ['Template']
+__metaclass__ = PoolMeta
 
-class Template(ModelSQL, ModelView):
-    _name = 'electronic.mail.template'
+class Template:
+    'Email Template'
+    __name__ = 'electronic.mail.template'
 
     party = fields.Char('Party',
         help='Party ID who an email event is logged. Placeholders can be used here. eg. ${record.party.id}')
 
-Template()
+[tryton]
+version=2.6.0
+depends:
+    ir
+    res
+    electronic_mail_template
+    party_event
+xml:
+    template.xml