changeset 46533f1d2b1d in modules/company:default
details: https://hg.tryton.org/modules/company?cmd=changeset;node=46533f1d2b1d
description:
Simplify cron
issue8201
issue6117
issue2286
diffstat:
cron.py | 10 ----------
view/cron_form.xml | 2 +-
2 files changed, 1 insertions(+), 11 deletions(-)
diffs (39 lines):
diff -r fb00e94cf604 -r 46533f1d2b1d cron.py
--- a/cron.py Sun Apr 07 19:50:03 2019 +0200
+++ b/cron.py Fri Apr 12 15:59:24 2019 +0200
@@ -16,23 +16,13 @@
@dualmethod
@ModelView.button
def run_once(cls, crons):
- User = Pool().get('res.user')
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 -r fb00e94cf604 -r 46533f1d2b1d view/cron_form.xml
--- a/view/cron_form.xml Sun Apr 07 19:50:03 2019 +0200
+++ b/view/cron_form.xml Fri Apr 12 15:59:24 2019 +0200
@@ -2,7 +2,7 @@
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
this repository contains the full copyright notices and license terms. -->
<data>
- <xpath expr="/form/field[@name='args']" position="after">
+ <xpath expr="/form" position="inside">
<field name="companies" colspan="4"/>
</xpath>
</data>