[tryton-debian-vcs] tryton-modules-company branch upstream updated. upstream/4.0.1-1-g0de2903

Mathias Behrle tryton-debian-vcs at alioth.debian.org
Tue Jul 12 13:04:17 UTC 2016


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/4.0.1-1-g0de2903

commit 0de2903c06f53efb05d82be4eabb0f9b7804f333
Author: Mathias Behrle <mathiasb at m9s.biz>
Date:   Mon Jul 11 20:16:13 2016 +0200

    Adding upstream version 4.0.2.
    
    Signed-off-by: Mathias Behrle <mathiasb at m9s.biz>

diff --git a/CHANGELOG b/CHANGELOG
index 632dbf1..fbdddfa 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,6 @@
+Version 4.0.2 - 2016-07-05
+* Bug fixes (see mercurial logs for details)
+
 Version 4.0.1 - 2016-05-11
 * Bug fixes (see mercurial logs for details)
 
diff --git a/PKG-INFO b/PKG-INFO
index bd1dd5c..c7d4683 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: trytond_company
-Version: 4.0.1
+Version: 4.0.2
 Summary: Tryton module with companies and employees
 Home-page: http://www.tryton.org/
 Author: Tryton
diff --git a/cron.py b/cron.py
index 27b4243..7a5aed1 100644
--- a/cron.py
+++ b/cron.py
@@ -1,6 +1,6 @@
 # This file is part of Tryton.  The COPYRIGHT file at the top level of
 # this repository contains the full copyright notices and license terms.
-from trytond.model import ModelSQL, fields
+from trytond.model import ModelSQL, ModelView, fields, dualmethod
 from trytond.pool import Pool, PoolMeta
 from trytond.transaction import Transaction
 
@@ -14,23 +14,26 @@ class Cron:
     companies = fields.Many2Many('ir.cron-company.company', 'cron', 'company',
             'Companies', help='Companies registered for this cron')
 
-    @classmethod
-    def _callback(cls, cron):
+    @dualmethod
+    @ModelView.button
+    def run_once(cls, crons):
         User = Pool().get('res.user')
-        if not cron.companies:
-            return super(Cron, cls)._callback(cron)
-        # TODO replace with context
-        for company in cron.companies:
-            User.write([cron.user], {
-                    'company': company.id,
-                    'main_company': company.id,
-                    })
-            with Transaction().set_context(company=company.id):
-                super(Cron, cls)._callback(cron)
-        User.write([cron.user], {
-                'company': None,
-                'main_company': None,
-                })
+        for cron in crons:
+            if not cron.companies:
+                super(Cron, cls).run_once([cron])
+            else:
+                # TODO replace with context
+                for company in cron.companies:
+                    User.write([cron.user], {
+                            'company': company.id,
+                            'main_company': company.id,
+                            })
+                    with Transaction().set_context(company=company.id):
+                        super(Cron, cls).run_once([cron])
+                User.write([cron.user], {
+                        'company': None,
+                        'main_company': None,
+                        })
 
     @staticmethod
     def default_companies():
diff --git a/tryton.cfg b/tryton.cfg
index 64285cf..7e83183 100644
--- a/tryton.cfg
+++ b/tryton.cfg
@@ -1,5 +1,5 @@
 [tryton]
-version=4.0.1
+version=4.0.2
 depends:
     currency
     ir
diff --git a/trytond_company.egg-info/PKG-INFO b/trytond_company.egg-info/PKG-INFO
index 51e78fe..ddc20af 100644
--- a/trytond_company.egg-info/PKG-INFO
+++ b/trytond_company.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: trytond-company
-Version: 4.0.1
+Version: 4.0.2
 Summary: Tryton module with companies and employees
 Home-page: http://www.tryton.org/
 Author: Tryton
-- 
tryton-modules-company



More information about the tryton-debian-vcs mailing list