Skip to content
This repository was archived by the owner on Dec 30, 2022. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
110 commits
Select commit Hold shift + click to select a range
5866b1e
Create branch 5.2
cedk May 6, 2019
cd05edd
Increase version number
cedk May 6, 2019
d691e62
Remove Python 3.4 classifier
cedk May 9, 2019
03b6af1
Always update ir.model.data if the filesystem value is different
cedk May 22, 2019
7d87270
Prepare release 5.2.1
cedk Jun 10, 2019
c3ffa9b
Added tag 5.2.1 for changeset aee8cd9fecdf
cedk Jun 10, 2019
786a537
Increase version number
cedk Jun 10, 2019
b34bf00
Skip tests relying on assertion when python is optimized
cedk Jun 12, 2019
c983dad
Correct underline on passlib in config docs
libateq Jun 28, 2019
5e20581
Prepare release 5.2.2
cedk Jul 1, 2019
c937bf6
Added tag 5.2.2 for changeset 06b6af6a1a71
cedk Jul 1, 2019
85541a8
Increase version number
cedk Jul 1, 2019
f00a2e5
Correct name of bus class config option
libateq Jun 28, 2019
a2c0a11
Always return 'id' key in the read result
cedk Jul 8, 2019
bfbd18a
Only encode report_content_html if it is not None
libateq Jul 8, 2019
ba5b2c2
Ensure count of grouped_slice is at least 1
cedk Jul 12, 2019
c66667f
Use non grouped domain when grouped record > IN_MAX
cedk Jul 12, 2019
7c465fe
Skip the Function field without setter in Data.sync()
semarie Jul 16, 2019
c87199c
Remove duplicate button attributes and move warning at the end
cedk Jul 17, 2019
dc170db
Prepare release 5.2.3
cedk Jul 17, 2019
5d5cd9f
Added tag 5.2.3 for changeset d06499aa4be1
cedk Jul 17, 2019
a17ba3a
Increase version number
cedk Jul 17, 2019
fda0965
Use separate connection to query cache table
cedk Jul 8, 2019
8a94959
Prepare release 5.2.4
cedk Aug 1, 2019
0f9210f
Added tag 5.2.4 for changeset e49a560dd265
cedk Aug 1, 2019
e5956d2
Increase version number
cedk Aug 1, 2019
a4bb475
Convert cache_name by TableHandler when used as database name
cedk Jul 28, 2019
5adc8c8
Prepare release 5.2.5
cedk Aug 17, 2019
d39b838
Added tag 5.2.5 for changeset 99b0686c8702
cedk Aug 17, 2019
407de4c
Increase version number
cedk Aug 17, 2019
d3c950e
Return name as report_content_name when template extensions is empty
Aug 23, 2019
1764b5c
Add missing Date header on email sent
lukio Aug 30, 2019
1939634
Use MagicMock for message when testing sendmail
cedk Aug 30, 2019
3fce4f3
Do not call _changed_values on non ModelView instance
cedk Sep 8, 2019
09229a4
Use new related API for _changed_values
cedk Sep 11, 2019
f8e2c58
Prepare release 5.2.6
cedk Sep 15, 2019
a893599
Added tag 5.2.6 for changeset 4363488df01b
cedk Sep 15, 2019
19f1904
Increase version number
cedk Sep 15, 2019
65f5bf1
Use stored value for One2Many changed without initial value
cedk Sep 7, 2019
0bf6b35
Import zero value as non null value
semarie Sep 17, 2019
d30738a
Prepare release 5.2.7
cedk Oct 6, 2019
dc506fa
Added tag 5.2.7 for changeset a533a499c493
cedk Oct 6, 2019
05caf74
Increase version number
cedk Oct 6, 2019
3cd34f0
Correctly test field access to set readonly attribute
cedk Oct 8, 2019
017a446
Always use search method on translations
cedk Oct 16, 2019
a5fa95f
Use proper key to compare with get_sources arguments
cedk Oct 25, 2019
0385152
Add missing skiptest attribute on xml validation
Oct 22, 2019
b66cb77
Cast timestamp epoch into FLOAT to avoid rounding
cedk Nov 1, 2019
eab35a0
Compare timestamps as Char for inequality
cedk Nov 3, 2019
c10ce00
Do not check timestamp when it is None
cedk Nov 5, 2019
69d3919
Store database pool per process
cedk Jun 27, 2019
626836f
Prepare release 5.2.8
cedk Nov 8, 2019
990b61b
Added tag 5.2.8 for changeset af82c05398fe
cedk Nov 8, 2019
f66620c
Increase version number
cedk Nov 8, 2019
1065211
Replace __unicode__ by __str__
cedk Oct 30, 2019
3f206ba
Prepare release 5.2.9 [skip ci]
cedk Dec 2, 2019
3933a5d
Add tag 5.2.9 [skip ci]
cedk Dec 2, 2019
8d8b4ad
Increase version number
cedk Dec 2, 2019
f3319ca
Adapt file mode depending on data type in soffice conversion
Nov 29, 2019
c1000a5
Prepare release 5.2.10 [skip ci]
cedk Dec 16, 2019
0aa4f25
Add tag 5.2.10 [skip ci]
cedk Dec 16, 2019
f02542c
Increase version number
cedk Dec 16, 2019
a462c47
Update default value of expand attribute to match client behavior
cedk Dec 11, 2019
05793d7
Prepare release 5.2.11 [skip ci]
cedk Jan 9, 2020
4893b05
Add tag 5.2.11 [skip ci]
cedk Jan 9, 2020
c5385a0
Increase version number
cedk Jan 9, 2020
908f6c3
Apply Exclude where clause when searching other records
cedk Jan 13, 2020
d15b733
Prepare release 5.2.12 [skip ci]
cedk Feb 2, 2020
a8071e9
Add tag 5.2.12 [skip ci]
cedk Feb 2, 2020
6a88a15
Increase version number
cedk Feb 2, 2020
7be96b6
Test memory cache with committed transaction as current
cedk Feb 10, 2020
b9463c6
Read context fields if they are also in depends
cedk Feb 11, 2020
032b3c1
Disable cache on default_get of ModelSingleton
cedk Feb 15, 2020
c3eb425
Set auth-method to trust for drone build
cedk Mar 1, 2020
d7e87d9
Enable check_access context when checking wizard access
cedk Mar 9, 2020
8c85ed2
Prepare release 5.2.13 [skip ci]
cedk Mar 9, 2020
5a0cbb5
Add tag 5.2.13 [skip ci]
cedk Mar 9, 2020
deda892
Increase version number
cedk Mar 9, 2020
11b7df4
Convert interval into seconds
cedk Mar 17, 2020
6ad2884
Skip check access on ir.ui.menu for wizard
cedk Mar 25, 2020
ef7e11b
Prepare release 5.2.14 [skip ci]
cedk Apr 4, 2020
084aef0
Add tag 5.2.14 [skip ci]
cedk Apr 4, 2020
4a6dec5
Increase version number
cedk Apr 4, 2020
a452335
Do not use only cache if context depends on other fields
cedk Apr 10, 2020
826fb6c
Properly test if report type in get_email
cedk Apr 10, 2020
3c95410
Clear report path when copying reports
udono Apr 19, 2020
a4a7c2a
Limit size of cache to reset per notify call
cedk Apr 19, 2020
ba64fb7
Do not write metadata on ir.note when writing on only the unread field
nicoe Apr 21, 2020
66e7078
Check model read access only on wizard with table_query models
Apr 25, 2020
2fb363c
Prepare release 5.2.15 [skip ci]
cedk May 1, 2020
c7abaed
Add tag 5.2.15 [skip ci]
cedk May 1, 2020
ded305a
Increase version number
cedk May 1, 2020
78264ca
Reschedule task failing for operational errors
cedk Apr 27, 2020
b1ea918
Prepare release 5.2.16 [skip ci]
cedk May 15, 2020
0270dae
Add tag 5.2.16 [skip ci]
cedk May 15, 2020
ec45149
Increase version number
cedk May 15, 2020
4b4e8bc
Correctly import DatabaseOperationalError
cedk May 16, 2020
6d4e21a
Prepare release 5.2.17 [skip ci]
cedk May 18, 2020
4b843af
Add tag 5.2.17 [skip ci]
cedk May 18, 2020
c77b7d3
Increase version number
cedk May 18, 2020
a2f1e9d
Ensure User application key is different on bunch creation
May 22, 2020
c2cbc98
Prepare release 5.2.18 [skip ci]
cedk Jun 3, 2020
8fb24e5
Add tag 5.2.18 [skip ci]
cedk Jun 3, 2020
dcbce5c
Increase version number
cedk Jun 3, 2020
955ae1e
Wait cache sync after clearing cache in test
cedk Jun 16, 2020
5d8239e
Make reschedule delay linear
cedk Jun 26, 2020
f014543
Prepare release 5.2.19 [skip ci]
cedk Jul 1, 2020
8228464
Add tag 5.2.19 [skip ci]
cedk Jul 1, 2020
083df1d
Increase version number
cedk Jul 1, 2020
14f43de
Do not set slots on ShowViewStart
cedk Jun 26, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ pipeline:
services:
postgresql:
image: postgres
environment:
- POSTGRES_HOST_AUTH_METHOD=trust
when:
matrix:
DATABASE: postgresql
Expand Down
19 changes: 19 additions & 0 deletions .hgtags
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,22 @@ e7a6d0e8002237f624ecc8a45a6a472f7baadd08 4.6.0
321b0104a732419c11aa4926785502e0615b89c9 4.8.0
e8cadc044d59edff8a2ca73932c723d507517ec8 5.0.0
ef34e4e92d45ab2b2b2956bbb6aa8b3ca259eb13 5.2.0
aee8cd9fecdfbf082030abd07cb2f98ed4bb839a 5.2.1
06b6af6a1a7182b83884cc2a3000a12966d1e14c 5.2.2
d06499aa4be143227c8f1aed0188106f2ee51c0c 5.2.3
e49a560dd265f6d018abf3974b227c6a841a8d12 5.2.4
99b0686c8702d2b41898c54bcdbfc36af8253a2b 5.2.5
4363488df01bb84b337267279b6a5e0e3b61d0ab 5.2.6
a533a499c493e206bf5fb8546038ba3e62af130b 5.2.7
af82c05398fea9ffc5f3713a7cd9e2418168fbba 5.2.8
5fb0c06625b777dbc55a615cc8d11ed1ae63c2af 5.2.9
ab630bf13ef2514b0c2b24f4343619a6064a5f41 5.2.10
2577bf7becc73304de840426946460250ad3e4ef 5.2.11
d9d5240b1e8966f80f74f15933cb3fa641cba5c1 5.2.12
8fc2d6f98d7b2b9a0f674e23a7ee486970a30902 5.2.13
732633a7fe34a4a20c6408c0f33181505a05aeeb 5.2.14
d647abbefe43bc434319efacbff63a0954e1a3d9 5.2.15
8e77e3156c32026b61b2ebe535f4521402b69305 5.2.16
ce808db9a1f59e4621c1b7eef8f297924b59ada5 5.2.17
3bfd0307262590bcae72c4e6778544761ae74149 5.2.18
aff310d8f73f6db33d60e6d2e865cb4dc1983522 5.2.19
58 changes: 58 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,61 @@
Version 5.2.19 - 2020-07-01
* Bug fixes (see mercurial logs for details)

Version 5.2.18 - 2020-06-03
* Bug fixes (see mercurial logs for details)

Version 5.2.17 - 2020-05-18
* Bug fixes (see mercurial logs for details)

Version 5.2.16 - 2020-05-15
* Bug fixes (see mercurial logs for details)

Version 5.2.15 - 2020-05-01
* Bug fixes (see mercurial logs for details)

Version 5.2.14 - 2020-04-04
* Bug fixes (see mercurial logs for details)

Version 5.2.13 - 2020-03-09
* Bug fixes (see mercurial logs for details)
* Enable check_access context when checking wizard access (issue9108)

Version 5.2.12 - 2020-02-02
* Bug fixes (see mercurial logs for details)

Version 5.2.11 - 2020-01-09
* Bug fixes (see mercurial logs for details)

Version 5.2.10 - 2019-12-16
* Bug fixes (see mercurial logs for details)

Version 5.2.9 - 2019-12-02
* Bug fixes (see mercurial logs for details)

Version 5.2.8 - 2019-11-08
* Bug fixes (see mercurial logs for details)

Version 5.2.7 - 2019-10-06
* Bug fixes (see mercurial logs for details)

Version 5.2.6 - 2019-09-15
* Bug fixes (see mercurial logs for details)

Version 5.2.5 - 2019-08-17
* Bug fixes (see mercurial logs for details)

Version 5.2.4 - 2019-08-01
* Bug fixes (see mercurial logs for details)

Version 5.2.3 - 2019-07-17
* Bug fixes (see mercurial logs for details)

Version 5.2.2 - 2019-07-01
* Bug fixes (see mercurial logs for details)

Version 5.2.1 - 2019-06-10
* Bug fixes (see mercurial logs for details)

Version 5.2.0 - 2019-05-06
* Bug fixes (see mercurial logs for details)
* Add sort and translate options to Reference field
Expand Down
6 changes: 3 additions & 3 deletions COPYRIGHT
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
Copyright (C) 2004-2008 Tiny SPRL.
Copyright (C) 2007-2019 Cédric Krier.
Copyright (C) 2007-2020 Cédric Krier.
Copyright (C) 2007-2013 Bertrand Chenal.
Copyright (C) 2008-2019 B2CK SPRL.
Copyright (C) 2008-2020 B2CK SPRL.
Copyright (C) 2011 Openlabs Technologies & Consulting (P) Ltd.
Copyright (C) 2011-2019 Nicolas Évrard.
Copyright (C) 2011-2020 Nicolas Évrard.

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
Expand Down
2 changes: 1 addition & 1 deletion doc/topics/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ The time in seconds until the reset password expires.
Default: `86400` (24h)

passlib
-------
~~~~~~~

The path to the `INI file to load as CryptContext
<https://passlib.readthedocs.io/en/stable/narr/context-tutorial.html#loading-saving-a-cryptcontext>`_.
Expand Down
17 changes: 7 additions & 10 deletions doc/topics/views/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -345,16 +345,6 @@ Display a button.
The function may return an `ir.action` id or one of those client side
action keywords:

* ``string``: The string that will be displayed inside the button.

* ``confirm``: A string that will be shown in order to request
confirmation when clicking the button.

* ``help``: see in common-attributes-help_.

The button should be registered on ``ir.model.button`` where the default value
of the ``string``, ``confirm`` and ``help`` attributes can be can be defined.

.. _topics-views-client-actions:

* ``new``: to create a new record
Expand Down Expand Up @@ -384,6 +374,13 @@ of the ``string``, ``confirm`` and ``help`` attributes can be can be defined.
toolbar. The valid values are the keywords starting with `form_` from
:ref:`Actions <topics-actions>` without the `form_` part.


.. warning::
The button should be registered on ``ir.model.button`` where the default
value of the ``string``, ``confirm`` and ``help`` attributes can be can be
defined.


notebook
^^^^^^^^

Expand Down
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ def run(self):
'Natural Language :: Turkish',
'Operating System :: OS Independent',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
Expand Down
2 changes: 1 addition & 1 deletion trytond/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import warnings
from email import charset

__version__ = "5.2.0"
__version__ = "5.2.20"

os.environ['TZ'] = 'UTC'
if hasattr(time, 'tzset'):
Expand Down
14 changes: 8 additions & 6 deletions trytond/backend/postgresql/database.py
Original file line number Diff line number Diff line change
@@ -1,5 +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 collections import defaultdict
import time
import logging
import os
Expand Down Expand Up @@ -108,7 +109,7 @@ class JSONContains(BinaryOperator):
class Database(DatabaseInterface):

_lock = RLock()
_databases = {}
_databases = defaultdict(dict)
_connpool = None
_list_cache = {}
_list_cache_timestamp = {}
Expand All @@ -130,13 +131,14 @@ class Database(DatabaseInterface):
def __new__(cls, name='template1'):
with cls._lock:
now = datetime.now()
for database in list(cls._databases.values()):
databases = cls._databases[os.getpid()]
for database in list(databases.values()):
if ((now - database._last_use).total_seconds() > _timeout
and database.name != name
and not database._connpool._used):
database.close()
if name in cls._databases:
inst = cls._databases[name]
if name in databases:
inst = databases[name]
else:
if name == 'template1':
minconn = 0
Expand All @@ -147,7 +149,7 @@ def __new__(cls, name='template1'):
inst._connpool = ThreadedConnectionPool(
minconn, _maxconn, **cls._connection_params(name),
cursor_factory=LoggingCursor)
cls._databases[name] = inst
databases[name] = inst
inst._last_use = datetime.now()
return inst

Expand Down Expand Up @@ -200,7 +202,7 @@ def close(self):
with self._lock:
logger.info('disconnect from "%s"', self.name)
self._connpool.closeall()
self._databases.pop(self.name)
self._databases[os.getpid()].pop(self.name)

@classmethod
def create(cls, connection, database_name, template='template0'):
Expand Down
2 changes: 1 addition & 1 deletion trytond/bus.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ def publish(cls, channel, message):
cursor.execute('NOTIFY "%s", %%s' % cls._channel, (payload,))


if config.get('bus', 'queue'):
if config.get('bus', 'class'):
Bus = resolve(config.get('bus', 'class'))
else:
Bus = LongPollingBus
Expand Down
100 changes: 59 additions & 41 deletions trytond/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from trytond import backend
from trytond.config import config
from trytond.transaction import Transaction
from trytond.tools import resolve
from trytond.tools import resolve, grouped_slice

__all__ = ['BaseCache', 'Cache', 'LRUDict']
_clear_timeout = config.getint('cache', 'clean_timeout', default=5 * 60)
Expand Down Expand Up @@ -165,8 +165,9 @@ def _clear(self, dbname, timestamp=None):

@classmethod
def sync(cls, transaction):
dbname = transaction.database.name
if not _clear_timeout and transaction.database.has_channel():
database = transaction.database
dbname = database.name
if not _clear_timeout and database.has_channel():
with cls._listener_lock:
if dbname not in cls._listener:
cls._listener[dbname] = listener = threading.Thread(
Expand All @@ -175,12 +176,17 @@ def sync(cls, transaction):
return
if (datetime.now() - cls._clean_last).total_seconds() < _clear_timeout:
return
with transaction.connection.cursor() as cursor:
table = Table(cls._table)
cursor.execute(*table.select(_cast(table.timestamp), table.name))
timestamps = {}
for timestamp, name in cursor.fetchall():
timestamps[name] = timestamp
connection = database.get_connection(readonly=True, autocommit=True)
try:
with connection.cursor() as cursor:
table = Table(cls._table)
cursor.execute(*table.select(
_cast(table.timestamp), table.name))
timestamps = {}
for timestamp, name in cursor.fetchall():
timestamps[name] = timestamp
finally:
database.put_connection(connection)
for name, timestamp in timestamps.items():
try:
inst = cls._instances[name]
Expand All @@ -197,39 +203,51 @@ def commit(cls, transaction):
reset = cls._reset.setdefault(transaction, set())
if not reset:
return
dbname = transaction.database.name
with transaction.connection.cursor() as cursor:
if not _clear_timeout and transaction.database.has_channel():
cursor.execute(
'NOTIFY "%s", %%s' % cls._channel,
(json.dumps(list(reset), separators=(',', ':')),))
else:
for name in reset:
cursor.execute(*table.select(table.name,
where=table.name == name,
limit=1))
if cursor.fetchone():
# It would be better to insert only
cursor.execute(*table.update([table.timestamp],
[CurrentTimestamp()],
database = transaction.database
dbname = database.name
if not _clear_timeout and transaction.database.has_channel():
with transaction.connection.cursor() as cursor:
# The count computed as
# 8000 (max notify size) / 64 (max name data len)
for sub_reset in grouped_slice(reset, 125):
cursor.execute(
'NOTIFY "%s", %%s' % cls._channel,
(json.dumps(list(sub_reset), separators=(',', ':')),))
else:
connection = database.get_connection(
readonly=False, autocommit=True)
try:
with connection.cursor() as cursor:
for name in reset:
cursor.execute(*table.select(table.name, table.id,
table.timestamp,
where=table.name == name,
limit=1))
if cursor.fetchone():
# It would be better to insert only
cursor.execute(*table.update([table.timestamp],
[CurrentTimestamp()],
where=table.name == name))
else:
cursor.execute(*table.insert(
[table.timestamp, table.name],
[[CurrentTimestamp(), name]]))

cursor.execute(*table.select(
Max(table.timestamp),
where=table.name == name))
timestamp, = cursor.fetchone()

cursor.execute(*table.select(
_cast(Max(table.timestamp)),
where=table.name == name))
else:
cursor.execute(*table.insert(
[table.timestamp, table.name],
[[CurrentTimestamp(), name]]))

cursor.execute(*table.select(
Max(table.timestamp),
where=table.name == name))
timestamp, = cursor.fetchone()

cursor.execute(*table.select(
_cast(Max(table.timestamp)),
where=table.name == name))
timestamp, = cursor.fetchone()

inst = cls._instances[name]
inst._clear(dbname, timestamp)
timestamp, = cursor.fetchone()

inst = cls._instances[name]
inst._clear(dbname, timestamp)
connection.commit()
finally:
database.put_connection(connection)
reset.clear()

@classmethod
Expand Down
2 changes: 1 addition & 1 deletion trytond/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -764,7 +764,7 @@ def write_records(self, module, model,
fs_values = old_values.copy()
fs_values.update(new_values)

if values != old_values:
if values != fs_values:
self.grouped_model_data.extend(([self.ModelData(mdata_id)], {
'fs_id': fs_id,
'model': model,
Expand Down
8 changes: 4 additions & 4 deletions trytond/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def __init__(self, message, description=''):
self.description = description
self.code = 1

def __unicode__(self):
def __str__(self):
return '%s - %s' % (self.message, self.description)


Expand All @@ -29,7 +29,7 @@ def __init__(self, name, message, description=''):
self.description = description
self.code = 2

def __unicode__(self):
def __str__(self):
return '%s - %s' % (self.message, self.description)


Expand All @@ -55,7 +55,7 @@ def __init__(self, message):
self.message = message
self.code = 4

def __unicode__(self):
def __str__(self):
return self.message


Expand All @@ -68,5 +68,5 @@ class MissingDependenciesException(TrytonException):
def __init__(self, missings):
self.missings = missings

def __unicode__(self):
def __str__(self):
return 'Missing dependencies: %s' % ' '.join(self.missings)
Loading