[tryton-debian-vcs] tryton-modules-company branch upstream updated. upstream/3.0.0-1-gb27f566

Mathias Behrle tryton-debian-vcs at alioth.debian.org
Tue Apr 22 13:07:15 UTC 2014


The following commit has been merged in the upstream branch:
https://alioth.debian.org/plugins/scmgit/cgi-bin/gitweb.cgi/?p=tryton/tryton-modules-company.git;a=commitdiff;h=upstream/3.0.0-1-gb27f566

commit b27f56632dcf922526d99b5f0565d6f3aa5fa7e6
Author: Mathias Behrle <mathiasb at m9s.biz>
Date:   Tue Apr 22 14:21:45 2014 +0200

    Adding upstream version 3.2.0.

diff --git a/CHANGELOG b/CHANGELOG
index b97ad05..783d149 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,8 @@
+Version 3.2.0 - 2014-04-21
+* Bug fixes (see mercurial logs for details)
+* Read employee according to the context
+* Add timezone on company to compute today
+
 Version 3.0.0 - 2013-10-21
 * Bug fixes (see mercurial logs for details)
 
diff --git a/COPYRIGHT b/COPYRIGHT
index 9192c97..5134c09 100644
--- a/COPYRIGHT
+++ b/COPYRIGHT
@@ -1,6 +1,6 @@
-Copyright (C) 2008-2013 Cédric Krier.
+Copyright (C) 2008-2014 Cédric Krier.
 Copyright (C) 2008-2013 Bertrand Chenal.
-Copyright (C) 2008-2013 B2CK SPRL.
+Copyright (C) 2008-2014 B2CK SPRL.
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
diff --git a/INSTALL b/INSTALL
index 8266cc9..3b0d612 100644
--- a/INSTALL
+++ b/INSTALL
@@ -4,7 +4,7 @@ Installing trytond_company
 Prerequisites
 -------------
 
- * Python 2.6 or later (http://www.python.org/)
+ * Python 2.7 or later (http://www.python.org/)
  * trytond (http://www.tryton.org/)
  * trytond_party (http://www.tryton.org/)
  * trytond_currency (http://www.tryton.org/)
diff --git a/MANIFEST.in b/MANIFEST.in
index 99c60a7..325b079 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -1,6 +1,5 @@
 include INSTALL
 include README
-include TODO
 include CHANGELOG
 include COPYRIGHT
 include LICENSE
diff --git a/PKG-INFO b/PKG-INFO
index 0ec3ec4..90fb81b 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,12 +1,12 @@
 Metadata-Version: 1.1
 Name: trytond_company
-Version: 3.0.0
+Version: 3.2.0
 Summary: Tryton module with companies and employees
 Home-page: http://www.tryton.org/
 Author: Tryton
-Author-email: UNKNOWN
+Author-email: issue_tracker at tryton.org
 License: GPL-3
-Download-URL: http://downloads.tryton.org/3.0/
+Download-URL: http://downloads.tryton.org/3.2/
 Description: trytond_company
         ===============
         
@@ -43,6 +43,7 @@ Description: trytond_company
         
           http://www.tryton.org/
         
+Keywords: tryton company employee
 Platform: UNKNOWN
 Classifier: Development Status :: 5 - Production/Stable
 Classifier: Environment :: Plugins
@@ -63,6 +64,5 @@ Classifier: Natural Language :: Russian
 Classifier: Natural Language :: Slovenian
 Classifier: Natural Language :: Spanish
 Classifier: Operating System :: OS Independent
-Classifier: Programming Language :: Python :: 2.6
 Classifier: Programming Language :: Python :: 2.7
 Classifier: Topic :: Office/Business
diff --git a/__init__.py b/__init__.py
index 294bc15..16ad20c 100644
--- a/__init__.py
+++ b/__init__.py
@@ -16,6 +16,7 @@ def register():
         Property,
         Sequence,
         SequenceStrict,
+        Date,
         CompanyConfigStart,
         Cron,
         CronCompany,
diff --git a/company.py b/company.py
index a39897a..3456529 100644
--- a/company.py
+++ b/company.py
@@ -8,9 +8,16 @@ from trytond.pyson import Eval, If
 from trytond.transaction import Transaction
 from trytond.pool import Pool, PoolMeta
 
+try:
+    import pytz
+    TIMEZONES = [(x, x) for x in pytz.common_timezones]
+except ImportError:
+    TIMEZONES = []
+TIMEZONES += [(None, '')]
+
 __all__ = ['Company', 'Employee', 'UserEmployee', 'User', 'Property',
-    'Sequence', 'SequenceStrict', 'CompanyConfigStart', 'CompanyConfig',
-    'CompanyReport', 'LetterReport']
+    'Sequence', 'SequenceStrict', 'Date', 'CompanyConfigStart',
+    'CompanyConfig', 'CompanyReport', 'LetterReport']
 __metaclass__ = PoolMeta
 
 
@@ -25,6 +32,7 @@ class Company(ModelSQL, ModelView):
     header = fields.Text('Header')
     footer = fields.Text('Footer')
     currency = fields.Many2One('currency.currency', 'Currency', required=True)
+    timezone = fields.Selection(TIMEZONES, 'Timezone', translate=False)
     employees = fields.One2Many('company.employee', 'company', 'Employees')
 
     @classmethod
@@ -40,8 +48,8 @@ class Company(ModelSQL, ModelView):
         return self.party.rec_name
 
     @classmethod
-    def write(cls, companies, vals):
-        super(Company, cls).write(companies, vals)
+    def write(cls, companies, values, *args):
+        super(Company, cls).write(companies, values, *args)
         # Restart the cache on the domain_get method
         Pool().get('ir.rule')._domain_get_cache.clear()
 
@@ -68,18 +76,17 @@ class UserEmployee(ModelSQL):
 
 class User:
     __name__ = 'res.user'
-    main_company = fields.Many2One('company.company', 'Main Company',
-        on_change=['main_company'])
+    main_company = fields.Many2One('company.company', 'Main Company')
     company = fields.Many2One('company.company', 'Current Company',
         domain=[('parent', 'child_of', [Eval('main_company')], 'parent')],
-        depends=['main_company'], on_change=['company', 'employees'])
+        depends=['main_company'])
     companies = fields.Function(fields.One2Many('company.company', None,
         'Current Companies'), 'get_companies')
     employees = fields.Many2Many('res.user-company.employee', 'user',
         'employee', 'Employees')
     employee = fields.Many2One('company.employee', 'Current Employee',
         domain=[
-            ('company', '=', Eval('company')),
+            ('company', '=', Eval('company', -1)),
             ('id', 'in', Eval('employees', [])),
             ],
         depends=['company', 'employees'])
@@ -129,12 +136,14 @@ class User:
                 self.company.currency.name)
         return status
 
+    @fields.depends('main_company')
     def on_change_main_company(self):
         return {
             'company': self.main_company.id if self.main_company else None,
             'employee': None,
             }
 
+    @fields.depends('company', 'employees')
     def on_change_company(self):
         Employee = Pool().get('company.employee')
         result = {
@@ -160,10 +169,11 @@ class User:
                 res['main_company.rec_name'] = user.main_company.rec_name
             res['employees'] = [e.id for e in user.employees]
         if user.employee:
-            res['employee'] = None
-            if user.employee:
-                res['employee'] = user.employee.id
-                res['employee.rec_name'] = user.employee.rec_name
+            res['employee'] = user.employee.id
+            res['employee.rec_name'] = user.employee.rec_name
+        if user.company:
+            res['company'] = user.company.id
+            res['company.rec_name'] = user.company.rec_name
         return res
 
     @classmethod
@@ -183,6 +193,7 @@ class User:
 
         if 'company' in res['fields']:
             selection = convert2selection(res['fields'], 'company')
+            selection.append((None, ''))
             user = cls(Transaction().user)
             if user.main_company:
                 companies = Company.search([
@@ -201,8 +212,10 @@ class User:
             user_id = Transaction().context['user']
         result = super(User, cls).read(ids, fields_names=fields_names)
         if (fields_names
-                and 'company' in fields_names
-                and 'company' in Transaction().context):
+                and (('company' in fields_names
+                        and 'company' in Transaction().context)
+                    or ('employee' in fields_names
+                        and 'employee' in Transaction().context))):
             values = None
             if int(user_id) in ids:
                 for vals in result:
@@ -210,17 +223,28 @@ class User:
                         values = vals
                         break
             if values:
-                main_company_id = values.get('main_company')
-                if not main_company_id:
-                    main_company_id = cls.read([user_id],
-                        ['main_company'])[0]['main_company']
-                companies = Company.search([
-                        ('parent', 'child_of', [main_company_id]),
-                        ])
-                company_id = Transaction().context['company']
-                if ((company_id and company_id in map(int, companies))
-                        or not company_id):
-                    values['company'] = company_id
+                if ('company' in fields_names
+                        and 'company' in Transaction().context):
+                    main_company_id = values.get('main_company')
+                    if not main_company_id:
+                        main_company_id = cls.read([user_id],
+                            ['main_company'])[0]['main_company']
+                    companies = Company.search([
+                            ('parent', 'child_of', [main_company_id]),
+                            ])
+                    company_id = Transaction().context['company']
+                    if ((company_id and company_id in map(int, companies))
+                            or not company_id):
+                        values['company'] = company_id
+                if ('employee' in fields_names
+                        and 'employee' in Transaction().context):
+                    employees = values.get('employees')
+                    if not employees:
+                        employees = cls.read([user_id],
+                            ['employees'])[0]['employees']
+                    employee_id = Transaction().context['employee']
+                    if employee_id and employee_id in employees:
+                        values['employee'] = employee_id
         return result
 
 
@@ -275,6 +299,21 @@ class SequenceStrict(Sequence):
     __name__ = 'ir.sequence.strict'
 
 
+class Date:
+    __name__ = 'ir.date'
+
+    @classmethod
+    def today(cls, timezone=None):
+        pool = Pool()
+        Company = pool.get('company.company')
+        company_id = Transaction().context.get('company')
+        if timezone is None and company_id:
+            company = Company(company_id)
+            if company.timezone:
+                timezone = pytz.timezone(company.timezone)
+        return super(Date, cls).today(timezone=timezone)
+
+
 class CompanyConfigStart(ModelView):
     'Company Config'
     __name__ = 'company.company.config.start'
diff --git a/locale/bg_BG.po b/locale/bg_BG.po
index 8d5d990..6ac1974 100644
--- a/locale/bg_BG.po
+++ b/locale/bg_BG.po
@@ -46,6 +46,11 @@ msgctxt "field:company.company,rec_name:"
 msgid "Name"
 msgstr "Име"
 
+#, fuzzy
+msgctxt "field:company.company,timezone:"
+msgid "Timezone"
+msgstr "Времева зона"
+
 msgctxt "field:company.company,write_date:"
 msgid "Write Date"
 msgstr "Променено на"
diff --git a/locale/ca_ES.po b/locale/ca_ES.po
index c34f3c9..8da6277 100644
--- a/locale/ca_ES.po
+++ b/locale/ca_ES.po
@@ -12,7 +12,7 @@ msgstr "Sufix \"%(sufix)s\" de la seqüència \"%(sequence)s\" no és correcte."
 
 msgctxt "error:ir.sequence.strict:"
 msgid "Last Timestamp cannot be in the future on sequence \"%s\"."
-msgstr "La darrera data-hora no pot ser del futur a la seqüència \"%s\"."
+msgstr "L'última data-hora no pot ser del futur a la seqüència \"%s\"."
 
 msgctxt "error:ir.sequence.strict:"
 msgid "Missing sequence."
@@ -28,7 +28,7 @@ msgstr "Sufix \"%(sufix)s\" de la seqüència \"%(sequence)s\" no és correcte."
 
 msgctxt "error:ir.sequence:"
 msgid "Last Timestamp cannot be in the future on sequence \"%s\"."
-msgstr "La darrera data-hora no pot ser del futur a la seqüència \"%s\"."
+msgstr "L'última data-hora no pot ser del futur a la seqüència \"%s\"."
 
 msgctxt "error:ir.sequence:"
 msgid "Missing sequence."
@@ -36,7 +36,7 @@ msgstr "No es troba la seqüència."
 
 msgctxt "error:res.user:"
 msgid "You can not set the password of ldap user \"%s\"."
-msgstr "No podeu establir la contrasenya de l'usuari \"%s\" d'ldap."
+msgstr "No podeu canviar la contrasenya de l'usuari \"%s\" d'LDAP."
 
 msgctxt "field:company.company,childs:"
 msgid "Children"
@@ -82,6 +82,10 @@ msgctxt "field:company.company,rec_name:"
 msgid "Name"
 msgstr "Nom"
 
+msgctxt "field:company.company,timezone:"
+msgid "Timezone"
+msgstr "Zona horària"
+
 msgctxt "field:company.company,write_date:"
 msgid "Write Date"
 msgstr "Data modificació"
@@ -228,7 +232,7 @@ msgstr "Usuari modificació"
 
 msgctxt "help:ir.cron,companies:"
 msgid "Companies registered for this cron"
-msgstr "Empreses registrades en aquest planificador"
+msgstr "Empreses registrades en aquest planificador."
 
 msgctxt "model:company.company,name:"
 msgid "Company"
@@ -264,7 +268,7 @@ msgstr "Carta"
 
 msgctxt "model:ir.cron-company.company,name:"
 msgid "Cron - Company"
-msgstr "Cron - Empresa"
+msgstr "Planificador - Empresa"
 
 msgctxt "model:ir.ui.menu,name:menu_company_list"
 msgid "Companies"
diff --git a/locale/cs_CZ.po b/locale/cs_CZ.po
index 6638d2e..e607e36 100644
--- a/locale/cs_CZ.po
+++ b/locale/cs_CZ.po
@@ -46,6 +46,10 @@ msgctxt "field:company.company,rec_name:"
 msgid "Name"
 msgstr ""
 
+msgctxt "field:company.company,timezone:"
+msgid "Timezone"
+msgstr ""
+
 msgctxt "field:company.company,write_date:"
 msgid "Write Date"
 msgstr ""
diff --git a/locale/de_DE.po b/locale/de_DE.po
index 765370d..8ff23ed 100644
--- a/locale/de_DE.po
+++ b/locale/de_DE.po
@@ -46,6 +46,10 @@ msgctxt "field:company.company,rec_name:"
 msgid "Name"
 msgstr "Name"
 
+msgctxt "field:company.company,timezone:"
+msgid "Timezone"
+msgstr "Zeitzone"
+
 msgctxt "field:company.company,write_date:"
 msgid "Write Date"
 msgstr "Zuletzt geändert"
diff --git a/locale/es_AR.po b/locale/es_AR.po
index 70b00f2..f37fb39 100644
--- a/locale/es_AR.po
+++ b/locale/es_AR.po
@@ -46,6 +46,10 @@ msgctxt "field:company.company,rec_name:"
 msgid "Name"
 msgstr "Nombre"
 
+msgctxt "field:company.company,timezone:"
+msgid "Timezone"
+msgstr "Zona horaria"
+
 msgctxt "field:company.company,write_date:"
 msgid "Write Date"
 msgstr "Fecha modificación"
@@ -176,7 +180,7 @@ msgstr "ID"
 
 msgctxt "field:res.user-company.employee,rec_name:"
 msgid "Name"
-msgstr "Nombre campo"
+msgstr "Nombre"
 
 msgctxt "field:res.user-company.employee,user:"
 msgid "User"
diff --git a/locale/es_CO.po b/locale/es_CO.po
index 011e792..4d3cf82 100644
--- a/locale/es_CO.po
+++ b/locale/es_CO.po
@@ -46,6 +46,11 @@ msgctxt "field:company.company,rec_name:"
 msgid "Name"
 msgstr "Nombre"
 
+#, fuzzy
+msgctxt "field:company.company,timezone:"
+msgid "Timezone"
+msgstr "Zona Horaria"
+
 msgctxt "field:company.company,write_date:"
 msgid "Write Date"
 msgstr "Fecha de Modificación"
diff --git a/locale/es_ES.po b/locale/es_ES.po
index 8134100..5b9e4f9 100644
--- a/locale/es_ES.po
+++ b/locale/es_ES.po
@@ -36,7 +36,7 @@ msgstr "Falta la secuencia."
 
 msgctxt "error:res.user:"
 msgid "You can not set the password of ldap user \"%s\"."
-msgstr "No puede establecer la contraseña del usuario \"%s\" de ldap."
+msgstr "No puede cambiar la contraseña del usuario \"%s\" de LDAP."
 
 msgctxt "field:company.company,childs:"
 msgid "Children"
@@ -82,6 +82,10 @@ msgctxt "field:company.company,rec_name:"
 msgid "Name"
 msgstr "Nombre"
 
+msgctxt "field:company.company,timezone:"
+msgid "Timezone"
+msgstr "Zona horaria"
+
 msgctxt "field:company.company,write_date:"
 msgid "Write Date"
 msgstr "Fecha modificación"
diff --git a/locale/fr_FR.po b/locale/fr_FR.po
index 0a3486b..e434bdc 100644
--- a/locale/fr_FR.po
+++ b/locale/fr_FR.po
@@ -46,6 +46,10 @@ msgctxt "field:company.company,rec_name:"
 msgid "Name"
 msgstr "Nom"
 
+msgctxt "field:company.company,timezone:"
+msgid "Timezone"
+msgstr "Fuseau Horaire"
+
 msgctxt "field:company.company,write_date:"
 msgid "Write Date"
 msgstr "Date de mise à jour"
diff --git a/locale/nl_NL.po b/locale/nl_NL.po
index f6ddb2f..5364cdd 100644
--- a/locale/nl_NL.po
+++ b/locale/nl_NL.po
@@ -46,6 +46,10 @@ msgctxt "field:company.company,rec_name:"
 msgid "Name"
 msgstr "Naam"
 
+msgctxt "field:company.company,timezone:"
+msgid "Timezone"
+msgstr ""
+
 msgctxt "field:company.company,write_date:"
 msgid "Write Date"
 msgstr ""
diff --git a/locale/ru_RU.po b/locale/ru_RU.po
index fb165ea..1a936c0 100644
--- a/locale/ru_RU.po
+++ b/locale/ru_RU.po
@@ -46,6 +46,11 @@ msgctxt "field:company.company,rec_name:"
 msgid "Name"
 msgstr "Наименование"
 
+#, fuzzy
+msgctxt "field:company.company,timezone:"
+msgid "Timezone"
+msgstr "Зона времени"
+
 msgctxt "field:company.company,write_date:"
 msgid "Write Date"
 msgstr "Дата изменения"
diff --git a/locale/sl_SI.po b/locale/sl_SI.po
index 2a18c36..16fbf42 100644
--- a/locale/sl_SI.po
+++ b/locale/sl_SI.po
@@ -4,7 +4,7 @@ msgstr "Content-Type: text/plain; charset=utf-8\n"
 
 msgctxt "field:company.company,childs:"
 msgid "Children"
-msgstr "Hčerinska podjetja"
+msgstr "Hčerinske družbe"
 
 msgctxt "field:company.company,create_date:"
 msgid "Create Date"
@@ -36,16 +36,20 @@ msgstr "ID"
 
 msgctxt "field:company.company,parent:"
 msgid "Parent"
-msgstr "Matično podjetje"
+msgstr "Matična družba"
 
 msgctxt "field:company.company,party:"
 msgid "Party"
-msgstr "Stranka"
+msgstr "Partner"
 
 msgctxt "field:company.company,rec_name:"
 msgid "Name"
 msgstr "Ime"
 
+msgctxt "field:company.company,timezone:"
+msgid "Timezone"
+msgstr "Časovni pas"
+
 msgctxt "field:company.company,write_date:"
 msgid "Write Date"
 msgstr "Zapisano"
@@ -60,7 +64,7 @@ msgstr "ID"
 
 msgctxt "field:company.employee,company:"
 msgid "Company"
-msgstr "Podjetje"
+msgstr "Družba"
 
 msgctxt "field:company.employee,create_date:"
 msgid "Create Date"
@@ -76,7 +80,7 @@ msgstr "ID"
 
 msgctxt "field:company.employee,party:"
 msgid "Party"
-msgstr "Stranka"
+msgstr "Partner"
 
 msgctxt "field:company.employee,rec_name:"
 msgid "Name"
@@ -92,11 +96,11 @@ msgstr "Zapisal"
 
 msgctxt "field:ir.cron,companies:"
 msgid "Companies"
-msgstr "Podjetja"
+msgstr "Družbe"
 
 msgctxt "field:ir.cron-company.company,company:"
 msgid "Company"
-msgstr "Podjetje"
+msgstr "Družba"
 
 msgctxt "field:ir.cron-company.company,create_date:"
 msgid "Create Date"
@@ -128,23 +132,23 @@ msgstr "Zapisal"
 
 msgctxt "field:ir.property,company:"
 msgid "Company"
-msgstr "Podjetje"
+msgstr "Družba"
 
 msgctxt "field:ir.sequence,company:"
 msgid "Company"
-msgstr "Podjetje"
+msgstr "Družba"
 
 msgctxt "field:ir.sequence.strict,company:"
 msgid "Company"
-msgstr "Podjetje"
+msgstr "Družba"
 
 msgctxt "field:res.user,companies:"
 msgid "Current Companies"
-msgstr "Trenutna podjetja"
+msgstr "Trenutne družbe"
 
 msgctxt "field:res.user,company:"
 msgid "Current Company"
-msgstr "Trenutno podjetje"
+msgstr "Trenutno družba"
 
 msgctxt "field:res.user,employee:"
 msgid "Current Employee"
@@ -156,7 +160,7 @@ msgstr "Zaposlenci"
 
 msgctxt "field:res.user,main_company:"
 msgid "Main Company"
-msgstr "Glavno podjetje"
+msgstr "Glavno družba"
 
 msgctxt "field:res.user-company.employee,create_date:"
 msgid "Create Date"
@@ -192,15 +196,15 @@ msgstr "Zapisal"
 
 msgctxt "help:ir.cron,companies:"
 msgid "Companies registered for this cron"
-msgstr "Podjetja, registrirana na ta razporejevalnik"
+msgstr "Družbe, registrirana na ta razporejevalnik"
 
 msgctxt "model:company.company,name:"
 msgid "Company"
-msgstr "Podjetje"
+msgstr "Družba"
 
 msgctxt "model:company.company.config.start,name:"
 msgid "Company Config"
-msgstr "Konfiguracija podjetja"
+msgstr "Konfiguracija družbe"
 
 msgctxt "model:company.employee,name:"
 msgid "Employee"
@@ -208,15 +212,15 @@ msgstr "Zaposlenec"
 
 msgctxt "model:ir.action,name:act_company_config"
 msgid "Configure Company"
-msgstr "Konfiguracija podjetja"
+msgstr "Konfiguracija družbe"
 
 msgctxt "model:ir.action,name:act_company_list"
 msgid "Companies"
-msgstr "Podjetja"
+msgstr "Družbe"
 
 msgctxt "model:ir.action,name:act_company_tree"
 msgid "Companies"
-msgstr "Podjetja"
+msgstr "Družbe"
 
 msgctxt "model:ir.action,name:act_employee_form"
 msgid "Employees"
@@ -228,15 +232,15 @@ msgstr "Pismo"
 
 msgctxt "model:ir.cron-company.company,name:"
 msgid "Cron - Company"
-msgstr "Razporejevalnik - Podjetje"
+msgstr "Razporejevalnik - Družba"
 
 msgctxt "model:ir.ui.menu,name:menu_company_list"
 msgid "Companies"
-msgstr "Podjetja"
+msgstr "Družbe"
 
 msgctxt "model:ir.ui.menu,name:menu_company_tree"
 msgid "Companies"
-msgstr "Podjetja"
+msgstr "Družbe"
 
 msgctxt "model:ir.ui.menu,name:menu_employee_form"
 msgid "Employees"
@@ -276,19 +280,19 @@ msgstr "DDV številka:"
 
 msgctxt "view:company.company.config.start:"
 msgid "Create Company"
-msgstr "Ustvari podjetje"
+msgstr "Ustvari družbo"
 
 msgctxt "view:company.company.config.start:"
 msgid "You can now add your company into the system."
-msgstr "Zdaj je možno v sistem dodati podjetje."
+msgstr "Zdaj je možno v sistem dodati družbo."
 
 msgctxt "view:company.company:"
 msgid "Companies"
-msgstr "Podjetja"
+msgstr "Družbe"
 
 msgctxt "view:company.company:"
 msgid "Company"
-msgstr "Podjetje"
+msgstr "Družba"
 
 msgctxt "view:company.company:"
 msgid "Reports"
diff --git a/setup.py b/setup.py
index 750b6fd..3001f8f 100644
--- a/setup.py
+++ b/setup.py
@@ -11,33 +11,51 @@ import ConfigParser
 def read(fname):
     return open(os.path.join(os.path.dirname(__file__), fname)).read()
 
+
+def get_require_version(name):
+    if minor_version % 2:
+        require = '%s >= %s.%s.dev0, < %s.%s'
+    else:
+        require = '%s >= %s.%s, < %s.%s'
+    require %= (name, major_version, minor_version,
+        major_version, minor_version + 1)
+    return require
+
 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)
+version = info.get('version', '0.0.1')
+major_version, minor_version, _ = version.split('.', 2)
 major_version = int(major_version)
 minor_version = int(minor_version)
+name = 'trytond_company'
+
+download_url = 'http://downloads.tryton.org/%s.%s/' % (
+    major_version, minor_version)
+if minor_version % 2:
+    version = '%s.%s.dev0' % (major_version, minor_version)
+    download_url = (
+        'hg+http://hg.tryton.org/modules/%s#egg=%s-%s' % (
+            name[8:], name, version))
 
 requires = []
 for dep in info.get('depends', []):
     if not re.match(r'(ir|res|webdav)(\W|$)', dep):
-        requires.append('trytond_%s >= %s.%s, < %s.%s' %
-            (dep, major_version, minor_version, major_version,
-                minor_version + 1))
-requires.append('trytond >= %s.%s, < %s.%s' %
-    (major_version, minor_version, major_version, minor_version + 1))
+        requires.append(get_require_version('trytond_%s' % dep))
+requires.append(get_require_version('trytond'))
 
-setup(name='trytond_company',
-    version=info.get('version', '0.0.1'),
+setup(name=name,
+    version=version,
     description='Tryton module with companies and employees',
     long_description=read('README'),
     author='Tryton',
+    author_email='issue_tracker at tryton.org',
     url='http://www.tryton.org/',
-    download_url=("http://downloads.tryton.org/" +
-        info.get('version', '0.0.1').rsplit('.', 1)[0] + '/'),
+    download_url=download_url,
+    keywords='tryton company employee',
     package_dir={'trytond.modules.company': '.'},
     packages=[
         'trytond.modules.company',
@@ -68,12 +86,14 @@ setup(name='trytond_company',
         'Natural Language :: Slovenian',
         'Natural Language :: Spanish',
         'Operating System :: OS Independent',
-        'Programming Language :: Python :: 2.6',
         'Programming Language :: Python :: 2.7',
         'Topic :: Office/Business',
         ],
     license='GPL-3',
     install_requires=requires,
+    extras_require={
+        'timezone': ['pytz'],
+        },
     zip_safe=False,
     entry_points="""
     [trytond.modules]
diff --git a/tests/test_company.py b/tests/test_company.py
index face119..b7f5e33 100644
--- a/tests/test_company.py
+++ b/tests/test_company.py
@@ -1,13 +1,5 @@
-#!/usr/bin/env python
 #This file is part of Tryton.  The COPYRIGHT file at the top level of
 #this repository contains the full copyright notices and license terms.
-import sys
-import os
-DIR = os.path.abspath(os.path.normpath(os.path.join(__file__,
-    '..', '..', '..', '..', '..', 'trytond')))
-if os.path.isdir(DIR):
-    sys.path.insert(0, os.path.dirname(DIR))
-
 import unittest
 import trytond.tests.test_tryton
 from trytond.tests.test_tryton import POOL, DB_NAME, USER, CONTEXT, test_view,\
@@ -16,9 +8,7 @@ from trytond.transaction import Transaction
 
 
 class CompanyTestCase(unittest.TestCase):
-    '''
-    Test Company module.
-    '''
+    'Test Company module'
 
     def setUp(self):
         trytond.tests.test_tryton.install_module('company')
@@ -29,21 +19,15 @@ class CompanyTestCase(unittest.TestCase):
         self.user = POOL.get('res.user')
 
     def test0005views(self):
-        '''
-        Test views.
-        '''
+        'Test views'
         test_view('company')
 
     def test0006depends(self):
-        '''
-        Test depends.
-        '''
+        'Test depends'
         test_depends()
 
     def test0010company(self):
-        '''
-        Create company.
-        '''
+        'Create company'
         with Transaction().start(DB_NAME, USER,
                 context=CONTEXT) as transaction:
             currency1, = self.currency.search([
@@ -51,7 +35,7 @@ class CompanyTestCase(unittest.TestCase):
                     ], 0, 1, None)
 
             party1, = self.party.create([{
-                        'name': 'B2CK',
+                        'name': 'Dunder Mifflin',
                         }])
             company1, = self.company.create([{
                         'party': party1.id,
@@ -61,20 +45,18 @@ class CompanyTestCase(unittest.TestCase):
             transaction.cursor.commit()
 
     def test0020company_recursion(self):
-        '''
-        Test company recursion.
-        '''
+        'Test company recursion'
         with Transaction().start(DB_NAME, USER, context=CONTEXT):
             currency1, = self.currency.search([
                 ('code', '=', 'cu1'),
                 ], 0, 1, None)
 
             company1, = self.company.search([
-                    ('rec_name', '=', 'B2CK'),
+                    ('rec_name', '=', 'Dunder Mifflin'),
                     ], 0, 1, None)
 
             party2, = self.party.create([{
-                        'name': 'B2CK Branch',
+                        'name': 'Michael Scott Paper Company',
                         }])
             company2, = self.company.create([{
                         'party': party2.id,
@@ -89,17 +71,15 @@ class CompanyTestCase(unittest.TestCase):
                     })
 
     def test0030employe(self):
-        '''
-        Create employee.
-        '''
+        'Create employee'
         with Transaction().start(DB_NAME, USER,
                 context=CONTEXT) as transaction:
             company1, = self.company.search([
-                    ('rec_name', '=', 'B2CK'),
+                    ('rec_name', '=', 'Dunder Mifflin'),
                     ], 0, 1, None)
 
             party, = self.party.create([{
-                        'name': 'Employee1',
+                        'name': 'Pam Beesly',
                         }])
             self.employee.create([{
                         'party': party.id,
@@ -108,9 +88,7 @@ class CompanyTestCase(unittest.TestCase):
             transaction.cursor.commit()
 
     def test0040user(self):
-        '''
-        Test user company
-        '''
+        'Test user company'
         with Transaction().start(DB_NAME, USER,
                 context=CONTEXT) as transaction:
             currency1, = self.currency.search([
@@ -118,11 +96,11 @@ class CompanyTestCase(unittest.TestCase):
                     ], 0, 1, None)
 
             company1, = self.company.search([
-                    ('rec_name', '=', 'B2CK'),
+                    ('rec_name', '=', 'Dunder Mifflin'),
                     ], 0, 1, None)
 
             party2, = self.party.create([{
-                        'name': 'B2CK Branch',
+                        'name': 'Michael Scott Paper Company',
                         }])
             company2, = self.company.create([{
                         'party': party2.id,
@@ -130,13 +108,13 @@ class CompanyTestCase(unittest.TestCase):
                         'currency': currency1.id,
                         }])
             user1, user2 = self.user.create([{
-                        'name': 'Test 1',
-                        'login': 'test1',
+                        'name': 'Jim Halper',
+                        'login': 'jim',
                         'main_company': company1.id,
                         'company': company1.id,
                         }, {
-                        'name': 'Test 2',
-                        'login': 'test2',
+                        'name': 'Pam Beesly',
+                        'login': 'pam',
                         'main_company': company2.id,
                         'company': company2.id,
                         }])
@@ -167,6 +145,3 @@ def suite():
     suite.addTests(unittest.TestLoader().loadTestsFromTestCase(
             CompanyTestCase))
     return suite
-
-if __name__ == '__main__':
-    unittest.TextTestRunner(verbosity=2).run(suite())
diff --git a/tryton.cfg b/tryton.cfg
index 12e126d..b26414e 100644
--- a/tryton.cfg
+++ b/tryton.cfg
@@ -1,5 +1,5 @@
 [tryton]
-version=3.0.0
+version=3.2.0
 depends:
     currency
     ir
diff --git a/trytond_company.egg-info/PKG-INFO b/trytond_company.egg-info/PKG-INFO
index deec5e1..0a001cb 100644
--- a/trytond_company.egg-info/PKG-INFO
+++ b/trytond_company.egg-info/PKG-INFO
@@ -1,12 +1,12 @@
 Metadata-Version: 1.1
 Name: trytond-company
-Version: 3.0.0
+Version: 3.2.0
 Summary: Tryton module with companies and employees
 Home-page: http://www.tryton.org/
 Author: Tryton
-Author-email: UNKNOWN
+Author-email: issue_tracker at tryton.org
 License: GPL-3
-Download-URL: http://downloads.tryton.org/3.0/
+Download-URL: http://downloads.tryton.org/3.2/
 Description: trytond_company
         ===============
         
@@ -43,6 +43,7 @@ Description: trytond_company
         
           http://www.tryton.org/
         
+Keywords: tryton company employee
 Platform: UNKNOWN
 Classifier: Development Status :: 5 - Production/Stable
 Classifier: Environment :: Plugins
@@ -63,6 +64,5 @@ Classifier: Natural Language :: Russian
 Classifier: Natural Language :: Slovenian
 Classifier: Natural Language :: Spanish
 Classifier: Operating System :: OS Independent
-Classifier: Programming Language :: Python :: 2.6
 Classifier: Programming Language :: Python :: 2.7
 Classifier: Topic :: Office/Business
diff --git a/trytond_company.egg-info/requires.txt b/trytond_company.egg-info/requires.txt
index a342ffb..b984ff7 100644
--- a/trytond_company.egg-info/requires.txt
+++ b/trytond_company.egg-info/requires.txt
@@ -1,3 +1,6 @@
-trytond_currency >= 3.0, < 3.1
-trytond_party >= 3.0, < 3.1
-trytond >= 3.0, < 3.1
\ No newline at end of file
+trytond_currency >= 3.2, < 3.3
+trytond_party >= 3.2, < 3.3
+trytond >= 3.2, < 3.3
+
+[timezone]
+pytz
\ No newline at end of file
diff --git a/view/company_form.xml b/view/company_form.xml
index 8d93a26..01b3858 100644
--- a/view/company_form.xml
+++ b/view/company_form.xml
@@ -1,12 +1,14 @@
 <?xml version="1.0"?>
 <!-- This file is part of Tryton.  The COPYRIGHT file at the top level of
 this repository contains the full copyright notices and license terms. -->
-<form string="Company">
+<form string="Company" col="6">
     <label name="party"/>
     <field name="party"/>
     <label name="currency"/>
     <field name="currency"/>
-    <notebook colspan="4">
+    <label name="timezone"/>
+    <field name="timezone"/>
+    <notebook colspan="6">
         <page string="Company" col="2" id="company">
             <label name="parent"/>
             <field name="parent"/>
diff --git a/view/user_form.xml b/view/user_form.xml
index ffe15a2..b47ddcc 100644
--- a/view/user_form.xml
+++ b/view/user_form.xml
@@ -9,7 +9,7 @@ this repository contains the full copyright notices and license terms. -->
         <label name="company"/>
         <field name="company" widget="selection"/>
         <label name="employee"/>
-        <field name="employee"/>
+        <field name="employee" widget="selection"/>
         <field name="employees" colspan="4"/>
     </xpath>
 </data>
-- 
tryton-modules-company



More information about the tryton-debian-vcs mailing list