changeset a3f1797df93e in modules/account_fr_chorus:default
details: 
https://hg.tryton.org/modules/account_fr_chorus?cmd=changeset;node=a3f1797df93e
description:
        Simplify cron

        issue8201
        issue6117
        issue2286
diffstat:

 __init__.py |   2 ++
 account.py  |   1 +
 account.xml |  19 +------------------
 ir.py       |  13 +++++++++++++
 4 files changed, 17 insertions(+), 18 deletions(-)

diffs (79 lines):

diff -r 7df60bb70dc5 -r a3f1797df93e __init__.py
--- a/__init__.py       Sun Apr 07 19:50:02 2019 +0200
+++ b/__init__.py       Fri Apr 12 15:59:24 2019 +0200
@@ -5,6 +5,7 @@
 from . import account
 from . import party
 from . import edocument
+from . import ir
 
 __all__ = ['register']
 
@@ -16,6 +17,7 @@
         account.Invoice,
         account.InvoiceChorus,
         party.Party,
+        ir.Cron,
         module='account_fr_chorus', type_='model')
     Pool.register(
         edocument.UNCEFACTInvoice,
diff -r 7df60bb70dc5 -r a3f1797df93e account.py
--- a/account.py        Sun Apr 07 19:50:02 2019 +0200
+++ b/account.py        Fri Apr 12 15:59:24 2019 +0200
@@ -197,6 +197,7 @@
             records = cls.search(['OR',
                     ('number', '=', None),
                     ('number', '=', ''),
+                    ('company', '=', transaction.context.get('company')),
                     ])
 
         for record in records:
diff -r 7df60bb70dc5 -r a3f1797df93e account.xml
--- a/account.xml       Sun Apr 07 19:50:02 2019 +0200
+++ b/account.xml       Fri Apr 12 15:59:24 2019 +0200
@@ -55,27 +55,10 @@
             <field name="perm_delete" eval="True"/>
         </record>
 
-        <record model="res.user" id="user_chorus">
-            <field name="login">user_cron_chorus</field>
-            <field name="name">Cron Chorus</field>
-            <field name="active" eval="False"/>
-        </record>
-        <record model="res.user-res.group" id="user_chorus-group_account">
-            <field name="user" ref="user_chorus"/>
-            <field name="group" ref="account.group_account"/>
-        </record>
-
         <record model="ir.cron" id="cron_invoice_send">
-            <field name="name">Send invoices to Chorus</field>
-            <field name="request_user" ref="res.user_admin"/>
-            <field name="user" ref="user_chorus"/>
-            <field name="active" eval="True"/>
+            <field name="method">account.invoice.chorus|send</field>
             <field name="interval_number" eval="15"/>
             <field name="interval_type">minutes</field>
-            <field name="number_calls" eval="-1"/>
-            <field name="repeat_missed" eval="False"/>
-            <field name="model">account.invoice.chorus</field>
-            <field name="function">send</field>
         </record>
     </data>
 </tryton>
diff -r 7df60bb70dc5 -r a3f1797df93e ir.py
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/ir.py     Fri Apr 12 15:59:24 2019 +0200
@@ -0,0 +1,13 @@
+# 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.pool import PoolMeta
+
+
+class Cron(metaclass=PoolMeta):
+    __name__ = 'ir.cron'
+
+    @classmethod
+    def __setup__(cls):
+        super().__setup__()
+        cls.method.selection.append(
+            ('account.invoice.chorus|send', "Send invoices to Chorus"))

Reply via email to