[tryton-commits] changeset in trytond:5.0 Update sendmail tests for SSL context
changeset 67d9d137be5a in trytond:5.0 details: https://hg.tryton.org/trytond?cmd=changeset=67d9d137be5a description: Update sendmail tests for SSL context issue11564 (grafted from f2213e8ce5b209e35d849f46387917d252b4a435) diffstat: trytond/tests/test_sendmail.py | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diffs (29 lines): diff -r b4740b533061 -r 67d9d137be5a trytond/tests/test_sendmail.py --- a/trytond/tests/test_sendmail.pyTue Jun 21 10:16:35 2022 +0200 +++ b/trytond/tests/test_sendmail.pyTue Jun 21 10:57:08 2022 +0200 @@ -3,7 +3,7 @@ import smtplib import unittest from email.message import Message -from unittest.mock import Mock, MagicMock, patch, call +from unittest.mock import ANY, Mock, MagicMock, patch, call from trytond.sendmail import ( sendmail_transactional, sendmail, SMTPDataManager, get_smtp_server) @@ -58,14 +58,14 @@ SMTP.return_value = server = Mock() self.assertEqual( get_smtp_server('smtps://localhost:25'), server) -SMTP.assert_called_once_with('localhost', 25) +SMTP.assert_called_once_with('localhost', 25, context=ANY) with patch.object(smtplib, 'SMTP') as SMTP: SMTP.return_value = server = Mock() self.assertEqual( get_smtp_server('smtp+tls://localhost:25'), server) SMTP.assert_called_once_with('localhost', 25) -server.starttls.assert_called_once_with() +server.starttls.assert_called_once_with(context=ANY) def test_get_smtp_server_extra_parameters(self): 'Test get_smtp_server uri extra parameters'
[tryton-commits] changeset in trytond:5.0 Enforce certificate validation for SMTP...
changeset b4740b533061 in trytond:5.0 details: https://hg.tryton.org/trytond?cmd=changeset=b4740b533061 description: Enforce certificate validation for SMTP connection issue11564 review417381003 (grafted from 314535925101f45598850d9a8e31145abef9be05) diffstat: CHANGELOG | 2 ++ trytond/sendmail.py | 4 +++- 2 files changed, 5 insertions(+), 1 deletions(-) diffs (35 lines): diff -r 696668dd8a37 -r b4740b533061 CHANGELOG --- a/CHANGELOG Fri Jun 03 19:04:20 2022 +0200 +++ b/CHANGELOG Tue Jun 21 10:16:35 2022 +0200 @@ -1,3 +1,5 @@ +* Enforce certificate validation for SMTP connection (issue11564) + Version 5.0.48 - 2022-06-03 * Bug fixes (see mercurial logs for details) diff -r 696668dd8a37 -r b4740b533061 trytond/sendmail.py --- a/trytond/sendmail.py Fri Jun 03 19:04:20 2022 +0200 +++ b/trytond/sendmail.py Tue Jun 21 10:16:35 2022 +0200 @@ -2,6 +2,7 @@ # this repository contains the full copyright notices and license terms. import logging import smtplib +import ssl from email.message import Message from email.utils import formatdate from urllib.parse import parse_qs, unquote_plus @@ -53,12 +54,13 @@ for key, value in parse_qs(uri.query, strict_parsing=True).items(): extra[key] = cast.get(key, lambda a: a)(value[0]) if uri.scheme.startswith('smtps'): +extra['context'] = ssl.create_default_context() server = smtplib.SMTP_SSL(uri.hostname, uri.port, **extra) else: server = smtplib.SMTP(uri.hostname, uri.port, **extra) if 'tls' in uri.scheme: -server.starttls() +server.starttls(context=ssl.create_default_context()) if uri.username and uri.password: server.login(
[tryton-commits] changeset in trytond:6.0 Update sendmail tests for SSL context
changeset 62f84787fbd1 in trytond:6.0 details: https://hg.tryton.org/trytond?cmd=changeset=62f84787fbd1 description: Update sendmail tests for SSL context issue11564 (grafted from f2213e8ce5b209e35d849f46387917d252b4a435) diffstat: trytond/tests/test_sendmail.py | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diffs (29 lines): diff -r 8a240f0f4f06 -r 62f84787fbd1 trytond/tests/test_sendmail.py --- a/trytond/tests/test_sendmail.pyTue Jun 21 10:16:35 2022 +0200 +++ b/trytond/tests/test_sendmail.pyTue Jun 21 10:57:08 2022 +0200 @@ -3,7 +3,7 @@ import smtplib import unittest from email.message import Message -from unittest.mock import Mock, MagicMock, patch, call +from unittest.mock import ANY, Mock, MagicMock, patch, call from trytond.sendmail import ( sendmail_transactional, sendmail, SMTPDataManager, get_smtp_server) @@ -58,14 +58,14 @@ SMTP.return_value = server = Mock() self.assertEqual( get_smtp_server('smtps://localhost:25'), server) -SMTP.assert_called_once_with('localhost', 25) +SMTP.assert_called_once_with('localhost', 25, context=ANY) with patch.object(smtplib, 'SMTP') as SMTP: SMTP.return_value = server = Mock() self.assertEqual( get_smtp_server('smtp+tls://localhost:25'), server) SMTP.assert_called_once_with('localhost', 25) -server.starttls.assert_called_once_with() +server.starttls.assert_called_once_with(context=ANY) def test_get_smtp_server_extra_parameters(self): 'Test get_smtp_server uri extra parameters'
[tryton-commits] changeset in trytond:6.0 Enforce certificate validation for SMTP...
changeset 8a240f0f4f06 in trytond:6.0 details: https://hg.tryton.org/trytond?cmd=changeset=8a240f0f4f06 description: Enforce certificate validation for SMTP connection issue11564 review417381003 (grafted from 314535925101f45598850d9a8e31145abef9be05) diffstat: CHANGELOG | 2 ++ trytond/sendmail.py | 4 +++- 2 files changed, 5 insertions(+), 1 deletions(-) diffs (37 lines): diff -r 628f7c860bed -r 8a240f0f4f06 CHANGELOG --- a/CHANGELOG Fri Jun 03 19:03:43 2022 +0200 +++ b/CHANGELOG Tue Jun 21 10:16:35 2022 +0200 @@ -1,3 +1,5 @@ +* Enforce certificate validation for SMTP connection (issue11564) + Version 6.0.19 - 2022-06-03 * Bug fixes (see mercurial logs for details) diff -r 628f7c860bed -r 8a240f0f4f06 trytond/sendmail.py --- a/trytond/sendmail.py Fri Jun 03 19:03:43 2022 +0200 +++ b/trytond/sendmail.py Tue Jun 21 10:16:35 2022 +0200 @@ -2,6 +2,7 @@ # this repository contains the full copyright notices and license terms. import logging import smtplib +import ssl from email.message import Message from email.utils import formatdate from email.mime.text import MIMEText @@ -69,6 +70,7 @@ extra[key] = cast.get(key, lambda a: a)(value[0]) if uri.scheme.startswith('smtps'): connector = smtplib.SMTP_SSL +extra['context'] = ssl.create_default_context() else: connector = smtplib.SMTP try: @@ -80,7 +82,7 @@ return if 'tls' in uri.scheme: -server.starttls() +server.starttls(context=ssl.create_default_context()) if uri.username and uri.password: server.login(
[tryton-commits] changeset in trytond:6.2 Update sendmail tests for SSL context
changeset 9317c12690ba in trytond:6.2 details: https://hg.tryton.org/trytond?cmd=changeset=9317c12690ba description: Update sendmail tests for SSL context issue11564 (grafted from f2213e8ce5b209e35d849f46387917d252b4a435) diffstat: trytond/tests/test_sendmail.py | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diffs (29 lines): diff -r e1a40dc38b1c -r 9317c12690ba trytond/tests/test_sendmail.py --- a/trytond/tests/test_sendmail.pyTue Jun 21 10:16:35 2022 +0200 +++ b/trytond/tests/test_sendmail.pyTue Jun 21 10:57:08 2022 +0200 @@ -3,7 +3,7 @@ import smtplib import unittest from email.message import Message -from unittest.mock import Mock, MagicMock, patch, call +from unittest.mock import ANY, Mock, MagicMock, patch, call from trytond.sendmail import ( sendmail_transactional, sendmail, SMTPDataManager, get_smtp_server) @@ -58,14 +58,14 @@ SMTP.return_value = server = Mock() self.assertEqual( get_smtp_server('smtps://localhost:25'), server) -SMTP.assert_called_once_with('localhost', 25) +SMTP.assert_called_once_with('localhost', 25, context=ANY) with patch.object(smtplib, 'SMTP') as SMTP: SMTP.return_value = server = Mock() self.assertEqual( get_smtp_server('smtp+tls://localhost:25'), server) SMTP.assert_called_once_with('localhost', 25) -server.starttls.assert_called_once_with() +server.starttls.assert_called_once_with(context=ANY) def test_get_smtp_server_extra_parameters(self): 'Test get_smtp_server uri extra parameters'
[tryton-commits] changeset in trytond:6.2 Enforce certificate validation for SMTP...
changeset e1a40dc38b1c in trytond:6.2 details: https://hg.tryton.org/trytond?cmd=changeset=e1a40dc38b1c description: Enforce certificate validation for SMTP connection issue11564 review417381003 (grafted from 314535925101f45598850d9a8e31145abef9be05) diffstat: CHANGELOG | 2 ++ trytond/sendmail.py | 4 +++- 2 files changed, 5 insertions(+), 1 deletions(-) diffs (37 lines): diff -r 3ca7c00aaf76 -r e1a40dc38b1c CHANGELOG --- a/CHANGELOG Fri Jun 03 19:03:00 2022 +0200 +++ b/CHANGELOG Tue Jun 21 10:16:35 2022 +0200 @@ -1,3 +1,5 @@ +* Enforce certificate validation for SMTP connection (issue11564) + Version 6.2.9 - 2022-06-03 * Bug fixes (see mercurial logs for details) diff -r 3ca7c00aaf76 -r e1a40dc38b1c trytond/sendmail.py --- a/trytond/sendmail.py Fri Jun 03 19:03:00 2022 +0200 +++ b/trytond/sendmail.py Tue Jun 21 10:16:35 2022 +0200 @@ -2,6 +2,7 @@ # this repository contains the full copyright notices and license terms. import logging import smtplib +import ssl from email.message import Message from email.utils import formatdate from email.mime.text import MIMEText @@ -70,6 +71,7 @@ extra[key] = cast.get(key, lambda a: a)(value[0]) if uri.scheme.startswith('smtps'): connector = smtplib.SMTP_SSL +extra['context'] = ssl.create_default_context() else: connector = smtplib.SMTP try: @@ -81,7 +83,7 @@ return if 'tls' in uri.scheme: -server.starttls() +server.starttls(context=ssl.create_default_context()) if uri.username and uri.password: server.login(
[tryton-commits] changeset in trytond:6.4 Update sendmail tests for SSL context
changeset 978bcc137381 in trytond:6.4 details: https://hg.tryton.org/trytond?cmd=changeset=978bcc137381 description: Update sendmail tests for SSL context issue11564 (grafted from f2213e8ce5b209e35d849f46387917d252b4a435) diffstat: trytond/tests/test_sendmail.py | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diffs (29 lines): diff -r 602589cc73f5 -r 978bcc137381 trytond/tests/test_sendmail.py --- a/trytond/tests/test_sendmail.pyTue Jun 21 10:16:35 2022 +0200 +++ b/trytond/tests/test_sendmail.pyTue Jun 21 10:57:08 2022 +0200 @@ -3,7 +3,7 @@ import smtplib import unittest from email.message import Message -from unittest.mock import MagicMock, Mock, call, patch +from unittest.mock import ANY, MagicMock, Mock, call, patch from trytond.sendmail import ( SMTPDataManager, get_smtp_server, sendmail, sendmail_transactional) @@ -59,14 +59,14 @@ SMTP.return_value = server = Mock() self.assertEqual( get_smtp_server('smtps://localhost:25'), server) -SMTP.assert_called_once_with('localhost', 25) +SMTP.assert_called_once_with('localhost', 25, context=ANY) with patch.object(smtplib, 'SMTP') as SMTP: SMTP.return_value = server = Mock() self.assertEqual( get_smtp_server('smtp+tls://localhost:25'), server) SMTP.assert_called_once_with('localhost', 25) -server.starttls.assert_called_once_with() +server.starttls.assert_called_once_with(context=ANY) def test_get_smtp_server_extra_parameters(self): 'Test get_smtp_server uri extra parameters'
[tryton-commits] changeset in trytond:6.4 Enforce certificate validation for SMTP...
changeset 602589cc73f5 in trytond:6.4 details: https://hg.tryton.org/trytond?cmd=changeset=602589cc73f5 description: Enforce certificate validation for SMTP connection issue11564 review417381003 (grafted from 314535925101f45598850d9a8e31145abef9be05) diffstat: CHANGELOG | 2 ++ trytond/sendmail.py | 4 +++- 2 files changed, 5 insertions(+), 1 deletions(-) diffs (37 lines): diff -r 6db5e97b3b8f -r 602589cc73f5 CHANGELOG --- a/CHANGELOG Wed Jun 15 09:19:10 2022 +0200 +++ b/CHANGELOG Tue Jun 21 10:16:35 2022 +0200 @@ -1,3 +1,5 @@ +* Enforce certificate validation for SMTP connection (issue11564) + Version 6.4.2 - 2022-06-15 * Bug fixes (see mercurial logs for details) diff -r 6db5e97b3b8f -r 602589cc73f5 trytond/sendmail.py --- a/trytond/sendmail.py Wed Jun 15 09:19:10 2022 +0200 +++ b/trytond/sendmail.py Tue Jun 21 10:16:35 2022 +0200 @@ -2,6 +2,7 @@ # this repository contains the full copyright notices and license terms. import logging import smtplib +import ssl import time from email.message import Message from email.mime.text import MIMEText @@ -89,6 +90,7 @@ extra[key] = cast.get(key, lambda a: a)(value[0]) if uri.scheme.startswith('smtps'): connector = smtplib.SMTP_SSL +extra['context'] = ssl.create_default_context() else: connector = smtplib.SMTP try: @@ -100,7 +102,7 @@ return if 'tls' in uri.scheme: -server.starttls() +server.starttls(context=ssl.create_default_context()) if uri.username and uri.password: server.login(
[tryton-commits] changeset in tryton:6.4 Do not display empty message in info bar
changeset 0d5db6a6a42a in tryton:6.4 details: https://hg.tryton.org/tryton?cmd=changeset=0d5db6a6a42a description: Do not display empty message in info bar issue11569 review419351003 (grafted from 76e38f53400fa05af163bcf5e9b4c22f0078f33b) diffstat: tryton/gui/window/infobar.py | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diffs (12 lines): diff -r 96ffb3785b46 -r 0d5db6a6a42a tryton/gui/window/infobar.py --- a/tryton/gui/window/infobar.py Tue Jun 21 10:15:13 2022 +0200 +++ b/tryton/gui/window/infobar.py Tue Jun 21 10:18:23 2022 +0200 @@ -15,6 +15,8 @@ return self.__box def info_bar_add(self, message, type_=Gtk.MessageType.ERROR): +if not message: +return key = (message, type_) if key not in self.__messages: info_bar = Gtk.InfoBar()
[tryton-commits] changeset in tryton:6.4 Do not set adjustment value when testing...
changeset 96ffb3785b46 in tryton:6.4 details: https://hg.tryton.org/tryton?cmd=changeset=96ffb3785b46 description: Do not set adjustment value when testing for next or previous record issue11463 review419341003 (grafted from 919f582baad176ae184ef4700bc56532072a1783) diffstat: tryton/gui/window/view_form/screen/screen.py | 22 ++ 1 files changed, 10 insertions(+), 12 deletions(-) diffs (63 lines): diff -r 863dbda09832 -r 96ffb3785b46 tryton/gui/window/view_form/screen/screen.py --- a/tryton/gui/window/view_form/screen/screen.py Mon May 02 16:27:12 2022 +0200 +++ b/tryton/gui/window/view_form/screen/screen.py Tue Jun 21 10:15:13 2022 +0200 @@ -982,16 +982,15 @@ # Force record_message self.current_record = self.current_record -def _get_next_record(self): +def _get_next_record(self, test=False): view = self.current_view if view.view_type == 'tree' and len(self.group): range_ = view.treeview.get_visible_range() -if range_: +if range_ and not test: start, end = range_ vadjustment = view.treeview.get_vadjustment() -vadjustment.props.value = min( -vadjustment.props.value + vadjustment.props.page_increment, -vadjustment.props.upper) +vadjustment.set_value( +vadjustment.props.value + vadjustment.props.page_increment) model = view.treeview.get_model() iter_ = model.get_iter(end) return model.get_value(iter_, 0) @@ -1059,7 +1058,7 @@ return self.group[0] if len(self.group) else None def has_next(self): -next_record = self._get_next_record() +next_record = self._get_next_record(test=True) return next_record and next_record != self.current_record def display_next(self): @@ -1070,16 +1069,15 @@ self.set_cursor(reset_view=False) view.display() -def _get_prev_record(self): +def _get_prev_record(self, test=False): view = self.current_view if view.view_type == 'tree' and len(self.group): range_ = view.treeview.get_visible_range() -if range_: +if range_ and not test: start, end = range_ vadjustment = view.treeview.get_vadjustment() -vadjustment.props.value = min( -vadjustment.props.value - vadjustment.props.page_increment, -vadjustment.props.lower) +vadjustment.set_value( +vadjustment.props.value - vadjustment.props.page_increment) model = view.treeview.get_model() iter_ = model.get_iter(start) return model.get_value(iter_, 0) @@ -1137,7 +1135,7 @@ return self.group[-1] if len(self.group) else None def has_prev(self): -prev_record = self._get_prev_record() +prev_record = self._get_prev_record(test=True) return prev_record and prev_record != self.current_record def display_prev(self):
[tryton-commits] changeset in sao:6.4 Do not display empty message in info bar
changeset ae834befbfcb in sao:6.4 details: https://hg.tryton.org/sao?cmd=changeset=ae834befbfcb description: Do not display empty message in info bar issue11569 review419351003 (grafted from d76b420485c209714d0a5c4a505bff9dc921b45e) diffstat: src/window.js | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diffs (13 lines): diff -r 6017ba2fae0d -r ae834befbfcb src/window.js --- a/src/window.js Tue Jun 21 10:12:25 2022 +0200 +++ b/src/window.js Tue Jun 21 10:18:23 2022 +0200 @@ -60,6 +60,9 @@ this.__messages = new Set(); }, add: function(message, type) { +if (!message) { +return; +} var key = JSON.stringify([message, type]); if (!this.__messages.has(key)) { var infobar = jQuery('', {
[tryton-commits] changeset in sao:6.0 Set FractionDigits options to format CSV to...
changeset 5ec0f9872885 in sao:6.0 details: https://hg.tryton.org/sao?cmd=changeset=5ec0f9872885 description: Set FractionDigits options to format CSV to locale The default browser options are 0 and 3 which are not enough so we set to the maximum supported. issue11499 review439211003 (grafted from 8ae142382bae11283b3ddf1706c6c4cf1a7c06d7) diffstat: src/window.js | 5 - 1 files changed, 4 insertions(+), 1 deletions(-) diffs (15 lines): diff -r d2482244df19 -r 5ec0f9872885 src/window.js --- a/src/window.js Wed Jun 15 09:21:07 2022 +0200 +++ b/src/window.js Tue Jun 21 10:12:25 2022 +0200 @@ -2055,7 +2055,10 @@ val, {'s': 1, 'm': 60, 'h': 60 * 60}); } else if (!isNaN(Number(val))) { val = val.toLocaleString( -Sao.i18n.BC47(Sao.i18n.getlang())); +Sao.i18n.BC47(Sao.i18n.getlang()), { +'minimumFractionDigits': 0, +'maximumFractionDigits': 20, +}); } } else if (val.isTimeDelta) { val = val.asSeconds();
[tryton-commits] changeset in sao:6.2 Set FractionDigits options to format CSV to...
changeset 907d219a3fb7 in sao:6.2 details: https://hg.tryton.org/sao?cmd=changeset=907d219a3fb7 description: Set FractionDigits options to format CSV to locale The default browser options are 0 and 3 which are not enough so we set to the maximum supported. issue11499 review439211003 (grafted from 8ae142382bae11283b3ddf1706c6c4cf1a7c06d7) diffstat: src/window.js | 5 - 1 files changed, 4 insertions(+), 1 deletions(-) diffs (15 lines): diff -r 1f996b83529c -r 907d219a3fb7 src/window.js --- a/src/window.js Wed Jun 15 09:20:38 2022 +0200 +++ b/src/window.js Tue Jun 21 10:12:25 2022 +0200 @@ -2085,7 +2085,10 @@ val, {'s': 1, 'm': 60, 'h': 60 * 60}); } else if (!isNaN(Number(val))) { val = val.toLocaleString( -Sao.i18n.BC47(Sao.i18n.getlang())); +Sao.i18n.BC47(Sao.i18n.getlang()), { +'minimumFractionDigits': 0, +'maximumFractionDigits': 20, +}); } } else if (val.isTimeDelta) { val = val.asSeconds();
[tryton-commits] changeset in sao:6.4 Set FractionDigits options to format CSV to...
changeset 6017ba2fae0d in sao:6.4 details: https://hg.tryton.org/sao?cmd=changeset=6017ba2fae0d description: Set FractionDigits options to format CSV to locale The default browser options are 0 and 3 which are not enough so we set to the maximum supported. issue11499 review439211003 (grafted from 8ae142382bae11283b3ddf1706c6c4cf1a7c06d7) diffstat: src/window.js | 5 - 1 files changed, 4 insertions(+), 1 deletions(-) diffs (15 lines): diff -r 8b816b244db5 -r 6017ba2fae0d src/window.js --- a/src/window.js Wed Jun 15 09:20:00 2022 +0200 +++ b/src/window.js Tue Jun 21 10:12:25 2022 +0200 @@ -2114,7 +2114,10 @@ val, {'s': 1, 'm': 60, 'h': 60 * 60}); } else if (!isNaN(Number(val))) { val = val.toLocaleString( -Sao.i18n.BC47(Sao.i18n.getlang())); +Sao.i18n.BC47(Sao.i18n.getlang()), { +'minimumFractionDigits': 0, +'maximumFractionDigits': 20, +}); } } else if (val.isTimeDelta) { val = val.asSeconds();
[tryton-commits] changeset in modules/stock:6.0 Join with a unique currency rate
changeset 5a982851b09d in modules/stock:6.0 details: https://hg.tryton.org/modules/stock?cmd=changeset=5a982851b09d description: Join with a unique currency rate issue11255 review435291004 (grafted from c2f056739e4856f2530b491653dfe8e5a8cb0461) diffstat: stock_reporting_margin.py | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diffs (21 lines): diff -r 727aaf280e23 -r 5a982851b09d stock_reporting_margin.py --- a/stock_reporting_margin.py Fri Jun 03 19:16:01 2022 +0200 +++ b/stock_reporting_margin.py Wed Jun 15 22:03:38 2022 +0200 @@ -93,7 +93,7 @@ condition=(move.currency == currency_rate.currency) & (currency_rate.start_date <= move.effective_date) & ((currency_rate.end_date == Null) -| (currency_rate.end_date >= move.effective_date)) +| (currency_rate.end_date > move.effective_date)) ) .join(company, condition=move.company == company.id) @@ -103,7 +103,7 @@ condition=(company.currency == currency_rate_company.currency) & (currency_rate_company.start_date <= move.effective_date) & ((currency_rate_company.end_date == Null) -| (currency_rate_company.end_date >= move.effective_date)) +| (currency_rate_company.end_date > move.effective_date)) ) .join(from_location, condition=(move.from_location == from_location.id))
[tryton-commits] changeset in modules/stock:6.2 Join with a unique currency rate
changeset 94a4c9245492 in modules/stock:6.2 details: https://hg.tryton.org/modules/stock?cmd=changeset=94a4c9245492 description: Join with a unique currency rate issue11255 review435291004 (grafted from c2f056739e4856f2530b491653dfe8e5a8cb0461) diffstat: stock_reporting_margin.py | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diffs (21 lines): diff -r 351879fa7e6d -r 94a4c9245492 stock_reporting_margin.py --- a/stock_reporting_margin.py Fri Jun 03 19:15:02 2022 +0200 +++ b/stock_reporting_margin.py Wed Jun 15 22:03:38 2022 +0200 @@ -91,7 +91,7 @@ condition=(move.currency == currency_rate.currency) & (currency_rate.start_date <= move.effective_date) & ((currency_rate.end_date == Null) -| (currency_rate.end_date >= move.effective_date)) +| (currency_rate.end_date > move.effective_date)) ) .join(company, condition=move.company == company.id) @@ -101,7 +101,7 @@ condition=(company.currency == currency_rate_company.currency) & (currency_rate_company.start_date <= move.effective_date) & ((currency_rate_company.end_date == Null) -| (currency_rate_company.end_date >= move.effective_date)) +| (currency_rate_company.end_date > move.effective_date)) ) .join(from_location, condition=(move.from_location == from_location.id))
[tryton-commits] changeset in modules/stock:6.4 Join with a unique currency rate
changeset bd73e46ad032 in modules/stock:6.4 details: https://hg.tryton.org/modules/stock?cmd=changeset=bd73e46ad032 description: Join with a unique currency rate issue11255 review435291004 (grafted from c2f056739e4856f2530b491653dfe8e5a8cb0461) diffstat: stock_reporting_margin.py | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diffs (21 lines): diff -r 790b6a51684a -r bd73e46ad032 stock_reporting_margin.py --- a/stock_reporting_margin.py Wed Jun 15 09:22:16 2022 +0200 +++ b/stock_reporting_margin.py Wed Jun 15 22:03:38 2022 +0200 @@ -90,7 +90,7 @@ condition=(move.currency == currency_rate.currency) & (currency_rate.start_date <= move.effective_date) & ((currency_rate.end_date == Null) -| (currency_rate.end_date >= move.effective_date)) +| (currency_rate.end_date > move.effective_date)) ) .join(company, condition=move.company == company.id) @@ -100,7 +100,7 @@ condition=(company.currency == currency_rate_company.currency) & (currency_rate_company.start_date <= move.effective_date) & ((currency_rate_company.end_date == Null) -| (currency_rate_company.end_date >= move.effective_date)) +| (currency_rate_company.end_date > move.effective_date)) ) .join(from_location, condition=(move.from_location == from_location.id))
[tryton-commits] changeset in modules/sale:5.0 Join with a unique currency rate
changeset 84e1993e0595 in modules/sale:5.0 details: https://hg.tryton.org/modules/sale?cmd=changeset=84e1993e0595 description: Join with a unique currency rate issue11255 review435291004 (grafted from e076958f9f429733a0636d892fb505800bc99f85) diffstat: sale_reporting.py | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diffs (20 lines): diff -r 88913b8117e6 -r 84e1993e0595 sale_reporting.py --- a/sale_reporting.py Tue Mar 01 19:29:54 2022 +0100 +++ b/sale_reporting.py Wed Jun 15 22:03:38 2022 +0200 @@ -79,14 +79,14 @@ condition=(sale.currency == currency_sale.currency) & (currency_sale.start_date <= sale.sale_date) & ((currency_sale.end_date == Null) -| (currency_sale.end_date >= sale.sale_date)) +| (currency_sale.end_date > sale.sale_date)) ) .join(company, condition=sale.company == company.id) .join(currency_company, condition=(company.currency == currency_company.currency) & (currency_company.start_date <= sale.sale_date) & ((currency_company.end_date == Null) -| (currency_company.end_date >= sale.sale_date)) +| (currency_company.end_date > sale.sale_date)) )) return from_item, tables
[tryton-commits] changeset in modules/sale:6.0 Join with a unique currency rate
changeset 9e33cce53628 in modules/sale:6.0 details: https://hg.tryton.org/modules/sale?cmd=changeset=9e33cce53628 description: Join with a unique currency rate issue11255 review435291004 (grafted from e076958f9f429733a0636d892fb505800bc99f85) diffstat: sale_reporting.py | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diffs (20 lines): diff -r d2d3746072c5 -r 9e33cce53628 sale_reporting.py --- a/sale_reporting.py Fri Jun 03 19:19:45 2022 +0200 +++ b/sale_reporting.py Wed Jun 15 22:03:38 2022 +0200 @@ -84,14 +84,14 @@ condition=(sale.currency == currency_sale.currency) & (currency_sale.start_date <= sale.sale_date) & ((currency_sale.end_date == Null) -| (currency_sale.end_date >= sale.sale_date)) +| (currency_sale.end_date > sale.sale_date)) ) .join(company, condition=sale.company == company.id) .join(currency_company, condition=(company.currency == currency_company.currency) & (currency_company.start_date <= sale.sale_date) & ((currency_company.end_date == Null) -| (currency_company.end_date >= sale.sale_date)) +| (currency_company.end_date > sale.sale_date)) )) return from_item, tables, withs
[tryton-commits] changeset in modules/sale:6.2 Join with a unique currency rate
changeset e13105a9a0cc in modules/sale:6.2 details: https://hg.tryton.org/modules/sale?cmd=changeset=e13105a9a0cc description: Join with a unique currency rate issue11255 review435291004 (grafted from e076958f9f429733a0636d892fb505800bc99f85) diffstat: sale_reporting.py | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diffs (20 lines): diff -r 105f796bbfdf -r e13105a9a0cc sale_reporting.py --- a/sale_reporting.py Fri Jun 03 19:17:50 2022 +0200 +++ b/sale_reporting.py Wed Jun 15 22:03:38 2022 +0200 @@ -81,14 +81,14 @@ condition=(sale.currency == currency_sale.currency) & (currency_sale.start_date <= sale.sale_date) & ((currency_sale.end_date == Null) -| (currency_sale.end_date >= sale.sale_date)) +| (currency_sale.end_date > sale.sale_date)) ) .join(company, condition=sale.company == company.id) .join(currency_company, condition=(company.currency == currency_company.currency) & (currency_company.start_date <= sale.sale_date) & ((currency_company.end_date == Null) -| (currency_company.end_date >= sale.sale_date)) +| (currency_company.end_date > sale.sale_date)) )) return from_item, tables, withs
[tryton-commits] changeset in modules/sale:6.4 Join with a unique currency rate
changeset b9ebf0ef08f0 in modules/sale:6.4 details: https://hg.tryton.org/modules/sale?cmd=changeset=b9ebf0ef08f0 description: Join with a unique currency rate issue11255 review435291004 (grafted from e076958f9f429733a0636d892fb505800bc99f85) diffstat: sale_reporting.py | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diffs (20 lines): diff -r eb260fb0ef2e -r b9ebf0ef08f0 sale_reporting.py --- a/sale_reporting.py Fri Jun 03 19:16:50 2022 +0200 +++ b/sale_reporting.py Wed Jun 15 22:03:38 2022 +0200 @@ -112,14 +112,14 @@ condition=(line.currency == currency_sale.currency) & (currency_sale.start_date <= line.date) & ((currency_sale.end_date == Null) -| (currency_sale.end_date >= line.date)) +| (currency_sale.end_date > line.date)) ) .join(company, condition=line.company == company.id) .join(currency_company, condition=(company.currency == currency_company.currency) & (currency_company.start_date <= line.date) & ((currency_company.end_date == Null) -| (currency_company.end_date >= line.date)) +| (currency_company.end_date > line.date)) )) return from_item, tables, withs
[tryton-commits] changeset in modules/project_revenue:5.0 Clear purchase lines wh...
changeset 5bc0d3896ee3 in modules/project_revenue:5.0 details: https://hg.tryton.org/modules/project_revenue?cmd=changeset=5bc0d3896ee3 description: Clear purchase lines when copying works issue11546 review421291003 (grafted from 555fdc46e8d1485a4da1b1cd970746f2bfd28fbe) diffstat: work.py | 11 +++ 1 files changed, 11 insertions(+), 0 deletions(-) diffs (18 lines): diff -r eecbd8044081 -r 5bc0d3896ee3 work.py --- a/work.py Thu Jun 17 22:02:33 2021 +0200 +++ b/work.py Thu Jun 16 14:31:01 2022 +0200 @@ -204,3 +204,14 @@ digits = self.__class__.list_price.digits self.list_price = self.list_price.quantize( Decimal(str(10.0 ** -digits[1]))) + +@classmethod +def copy(cls, records, default=None): +if default is None: +default = {} +else: +default = default.copy() +if hasattr(cls, 'purchase_lines'): +# Do not copy purchase lines if purchase is activated +default.setdefault('purchase_lines', None) +return super().copy(records, default=default)
[tryton-commits] changeset in modules/project_revenue:6.0 Clear purchase lines wh...
changeset eea300f205d2 in modules/project_revenue:6.0 details: https://hg.tryton.org/modules/project_revenue?cmd=changeset=eea300f205d2 description: Clear purchase lines when copying works issue11546 review421291003 (grafted from 555fdc46e8d1485a4da1b1cd970746f2bfd28fbe) diffstat: work.py | 11 +++ 1 files changed, 11 insertions(+), 0 deletions(-) diffs (18 lines): diff -r 5bff0ed40514 -r eea300f205d2 work.py --- a/work.py Mon May 03 15:56:12 2021 +0200 +++ b/work.py Thu Jun 16 14:31:01 2022 +0200 @@ -226,3 +226,14 @@ return time = Category(ModelData.get_id('product', 'uom_cat_time')) return self.product.default_uom_category == time + +@classmethod +def copy(cls, records, default=None): +if default is None: +default = {} +else: +default = default.copy() +if hasattr(cls, 'purchase_lines'): +# Do not copy purchase lines if purchase is activated +default.setdefault('purchase_lines', None) +return super().copy(records, default=default)
[tryton-commits] changeset in modules/project_revenue:6.2 Clear purchase lines wh...
changeset 3936bf78944c in modules/project_revenue:6.2 details: https://hg.tryton.org/modules/project_revenue?cmd=changeset=3936bf78944c description: Clear purchase lines when copying works issue11546 review421291003 (grafted from 555fdc46e8d1485a4da1b1cd970746f2bfd28fbe) diffstat: work.py | 11 +++ 1 files changed, 11 insertions(+), 0 deletions(-) diffs (18 lines): diff -r 63ae0f3f97d5 -r 3936bf78944c work.py --- a/work.py Mon Nov 01 17:22:25 2021 +0100 +++ b/work.py Thu Jun 16 14:31:01 2022 +0200 @@ -211,3 +211,14 @@ return time = Category(ModelData.get_id('product', 'uom_cat_time')) return self.product.default_uom_category == time + +@classmethod +def copy(cls, records, default=None): +if default is None: +default = {} +else: +default = default.copy() +if hasattr(cls, 'purchase_lines'): +# Do not copy purchase lines if purchase is activated +default.setdefault('purchase_lines', None) +return super().copy(records, default=default)
[tryton-commits] changeset in modules/project_revenue:6.4 Clear purchase lines wh...
changeset a6db1fef7ce3 in modules/project_revenue:6.4 details: https://hg.tryton.org/modules/project_revenue?cmd=changeset=a6db1fef7ce3 description: Clear purchase lines when copying works issue11546 review421291003 (grafted from 555fdc46e8d1485a4da1b1cd970746f2bfd28fbe) diffstat: work.py | 11 +++ 1 files changed, 11 insertions(+), 0 deletions(-) diffs (18 lines): diff -r 4c6c1b286f04 -r a6db1fef7ce3 work.py --- a/work.py Mon May 02 17:25:08 2022 +0200 +++ b/work.py Thu Jun 16 14:31:01 2022 +0200 @@ -209,3 +209,14 @@ return time = Category(ModelData.get_id('product', 'uom_cat_time')) return self.product.default_uom_category == time + +@classmethod +def copy(cls, records, default=None): +if default is None: +default = {} +else: +default = default.copy() +if hasattr(cls, 'purchase_lines'): +# Do not copy purchase lines if purchase is activated +default.setdefault('purchase_lines', None) +return super().copy(records, default=default)
[tryton-commits] changeset in modules/project_invoice:6.0 Clear invoiced progress...
changeset 8190f0930f6e in modules/project_invoice:6.0 details: https://hg.tryton.org/modules/project_invoice?cmd=changeset=8190f0930f6e description: Clear invoiced progress when copying works issue11545 review423331004 (grafted from cf92953d5ad93874e7d7e1e3d0a577cddfffe275) diffstat: project.py | 9 + 1 files changed, 9 insertions(+), 0 deletions(-) diffs (19 lines): diff -r 497c38128b0f -r 8190f0930f6e project.py --- a/project.pySat Jan 01 18:15:23 2022 +0100 +++ b/project.pyThu Jun 16 14:29:15 2022 +0200 @@ -205,6 +205,15 @@ origins.append(invoiced_progress) return origins +@classmethod +def copy(cls, records, default=None): +if default is None: +default = {} +else: +default = default.copy() +default.setdefault('invoiced_progress', None) +return super().copy(records, default=default) + class Timesheet:
[tryton-commits] changeset in modules/project_invoice:6.2 Clear invoiced progress...
changeset dee1ac89dc90 in modules/project_invoice:6.2 details: https://hg.tryton.org/modules/project_invoice?cmd=changeset=dee1ac89dc90 description: Clear invoiced progress when copying works issue11545 review423331004 (grafted from cf92953d5ad93874e7d7e1e3d0a577cddfffe275) diffstat: project.py | 9 + 1 files changed, 9 insertions(+), 0 deletions(-) diffs (19 lines): diff -r 136c373878a7 -r dee1ac89dc90 project.py --- a/project.pySat Jan 01 18:14:57 2022 +0100 +++ b/project.pyThu Jun 16 14:29:15 2022 +0200 @@ -208,6 +208,15 @@ origins.append(invoiced_progress) return origins +@classmethod +def copy(cls, records, default=None): +if default is None: +default = {} +else: +default = default.copy() +default.setdefault('invoiced_progress', None) +return super().copy(records, default=default) + class Timesheet: __slots__ = ()
[tryton-commits] changeset in modules/project_invoice:6.4 Clear invoiced progress...
changeset 3d71ae3e7f37 in modules/project_invoice:6.4 details: https://hg.tryton.org/modules/project_invoice?cmd=changeset=3d71ae3e7f37 description: Clear invoiced progress when copying works issue11545 review423331004 (grafted from cf92953d5ad93874e7d7e1e3d0a577cddfffe275) diffstat: project.py | 9 + 1 files changed, 9 insertions(+), 0 deletions(-) diffs (19 lines): diff -r 70e7b55b481a -r 3d71ae3e7f37 project.py --- a/project.pyMon May 02 17:35:29 2022 +0200 +++ b/project.pyThu Jun 16 14:29:15 2022 +0200 @@ -206,6 +206,15 @@ origins.append(invoiced_progress) return origins +@classmethod +def copy(cls, records, default=None): +if default is None: +default = {} +else: +default = default.copy() +default.setdefault('invoiced_progress', None) +return super().copy(records, default=default) + class Timesheet: __slots__ = ()
[tryton-commits] changeset in modules/product_price_list_dates:5.0 Use context da...
changeset 9b041c3782a6 in modules/product_price_list_dates:5.0 details: https://hg.tryton.org/modules/product_price_list_dates?cmd=changeset=9b041c3782a6 description: Use context date as default pattern issue11359 review417411003 (grafted from 3ca1623dd74c4c1a9aff760d2b43d5dabf82a1ee) diffstat: product.py | 9 + tests/test_product_price_list_dates.py | 21 + 2 files changed, 30 insertions(+), 0 deletions(-) diffs (64 lines): diff -r 59ef9db0ce19 -r 9b041c3782a6 product.py --- a/product.pyThu Jun 17 22:01:18 2021 +0200 +++ b/product.pyTue Jun 21 10:13:53 2022 +0200 @@ -3,6 +3,7 @@ from trytond.model import ModelView, fields from trytond.pool import PoolMeta, Pool from trytond.pyson import Eval, If +from trytond.transaction import Transaction __all__ = ['PriceList', 'PriceListLine', 'PriceListLineContext'] @@ -23,6 +24,14 @@ def open_lines(cls, price_lists): pass +def compute( +self, party, product, unit_price, quantity, uom, pattern=None): +context = Transaction().context +pattern = pattern.copy() if pattern is not None else {} +pattern.setdefault('date', context.get('date')) +return super().compute( +party, product, unit_price, quantity, uom, pattern=pattern) + class PriceListLine(metaclass=PoolMeta): __name__ = 'product.price_list.line' diff -r 59ef9db0ce19 -r 9b041c3782a6 tests/test_product_price_list_dates.py --- a/tests/test_product_price_list_dates.pyThu Jun 17 22:01:18 2021 +0200 +++ b/tests/test_product_price_list_dates.pyTue Jun 21 10:13:53 2022 +0200 @@ -10,6 +10,7 @@ from trytond.tests.test_tryton import suite as test_suite from trytond.modules.company.tests import create_company, set_company +from trytond.transaction import Transaction class ProductPriceListDatesTestCase(ModuleTestCase): @@ -73,6 +74,26 @@ None, None, Decimal(10), 1, None, pattern={'date': yesterday}), Decimal(9)) +@with_transaction() +def test_price_list_with_context_date(self): +"Test price list with context date" +pool = Pool() +Date = pool.get('ir.date') + +today = Date.today() +tomorrow = today + datetime.timedelta(days=1) + +price_list = self.create_price_list('start_date', tomorrow) + +with Transaction().set_context(date=today): +self.assertEqual( +price_list.compute(None, None, Decimal(10), 1, None), +Decimal(10)) +with Transaction().set_context(date=tomorrow): +self.assertEqual( +price_list.compute(None, None, Decimal(10), 1, None), +Decimal(9)) + def suite(): suite = test_suite()
[tryton-commits] changeset in modules/product_price_list_dates:6.2 Use context da...
changeset 2e277dc50a4c in modules/product_price_list_dates:6.2 details: https://hg.tryton.org/modules/product_price_list_dates?cmd=changeset=2e277dc50a4c description: Use context date as default pattern issue11359 review417411003 (grafted from 3ca1623dd74c4c1a9aff760d2b43d5dabf82a1ee) diffstat: product.py | 9 + tests/test_product_price_list_dates.py | 21 + 2 files changed, 30 insertions(+), 0 deletions(-) diffs (64 lines): diff -r 90caabde5801 -r 2e277dc50a4c product.py --- a/product.pyMon Nov 01 17:27:20 2021 +0100 +++ b/product.pyTue Jun 21 10:13:53 2022 +0200 @@ -3,6 +3,7 @@ from trytond.model import ModelView, fields from trytond.pool import PoolMeta, Pool from trytond.pyson import Eval, If +from trytond.transaction import Transaction class PriceList(metaclass=PoolMeta): @@ -21,6 +22,14 @@ def open_lines(cls, price_lists): pass +def compute( +self, party, product, unit_price, quantity, uom, pattern=None): +context = Transaction().context +pattern = pattern.copy() if pattern is not None else {} +pattern.setdefault('date', context.get('date')) +return super().compute( +party, product, unit_price, quantity, uom, pattern=pattern) + class PriceListLine(metaclass=PoolMeta): __name__ = 'product.price_list.line' diff -r 90caabde5801 -r 2e277dc50a4c tests/test_product_price_list_dates.py --- a/tests/test_product_price_list_dates.pyMon Nov 01 17:27:20 2021 +0100 +++ b/tests/test_product_price_list_dates.pyTue Jun 21 10:13:53 2022 +0200 @@ -11,6 +11,7 @@ from trytond.modules.company.tests import ( create_company, set_company, CompanyTestMixin) +from trytond.transaction import Transaction class ProductPriceListDatesTestCase(CompanyTestMixin, ModuleTestCase): @@ -75,6 +76,26 @@ None, None, Decimal(10), 1, None, pattern={'date': yesterday}), Decimal(9)) +@with_transaction() +def test_price_list_with_context_date(self): +"Test price list with context date" +pool = Pool() +Date = pool.get('ir.date') + +today = Date.today() +tomorrow = today + datetime.timedelta(days=1) + +price_list = self.create_price_list('start_date', tomorrow) + +with Transaction().set_context(date=today): +self.assertEqual( +price_list.compute(None, None, Decimal(10), 1, None), +Decimal(10)) +with Transaction().set_context(date=tomorrow): +self.assertEqual( +price_list.compute(None, None, Decimal(10), 1, None), +Decimal(9)) + def suite(): suite = test_suite()
[tryton-commits] changeset in modules/product_price_list_dates:6.4 Use context da...
changeset fc5176c72a23 in modules/product_price_list_dates:6.4 details: https://hg.tryton.org/modules/product_price_list_dates?cmd=changeset=fc5176c72a23 description: Use context date as default pattern issue11359 review417411003 (grafted from 3ca1623dd74c4c1a9aff760d2b43d5dabf82a1ee) diffstat: product.py | 9 + tests/test_module.py | 21 + 2 files changed, 30 insertions(+), 0 deletions(-) diffs (63 lines): diff -r 9b01092ec750 -r fc5176c72a23 product.py --- a/product.pyMon May 02 17:35:04 2022 +0200 +++ b/product.pyTue Jun 21 10:13:53 2022 +0200 @@ -3,6 +3,7 @@ from trytond.model import ModelView, fields from trytond.pool import Pool, PoolMeta from trytond.pyson import Eval, If +from trytond.transaction import Transaction class PriceList(metaclass=PoolMeta): @@ -21,6 +22,14 @@ def open_lines(cls, price_lists): pass +def compute( +self, party, product, unit_price, quantity, uom, pattern=None): +context = Transaction().context +pattern = pattern.copy() if pattern is not None else {} +pattern.setdefault('date', context.get('date')) +return super().compute( +party, product, unit_price, quantity, uom, pattern=pattern) + class PriceListLine(metaclass=PoolMeta): __name__ = 'product.price_list.line' diff -r 9b01092ec750 -r fc5176c72a23 tests/test_module.py --- a/tests/test_module.py Mon May 02 17:35:04 2022 +0200 +++ b/tests/test_module.py Tue Jun 21 10:13:53 2022 +0200 @@ -8,6 +8,7 @@ CompanyTestMixin, create_company, set_company) from trytond.pool import Pool from trytond.tests.test_tryton import ModuleTestCase, with_transaction +from trytond.transaction import Transaction class ProductPriceListDatesTestCase(CompanyTestMixin, ModuleTestCase): @@ -72,5 +73,25 @@ None, None, Decimal(10), 1, None, pattern={'date': yesterday}), Decimal(9)) +@with_transaction() +def test_price_list_with_context_date(self): +"Test price list with context date" +pool = Pool() +Date = pool.get('ir.date') + +today = Date.today() +tomorrow = today + datetime.timedelta(days=1) + +price_list = self.create_price_list('start_date', tomorrow) + +with Transaction().set_context(date=today): +self.assertEqual( +price_list.compute(None, None, Decimal(10), 1, None), +Decimal(10)) +with Transaction().set_context(date=tomorrow): +self.assertEqual( +price_list.compute(None, None, Decimal(10), 1, None), +Decimal(9)) + del ModuleTestCase
[tryton-commits] changeset in modules/ldap_authentication:5.0 Enforce certificate...
changeset bcc67f47e13c in modules/ldap_authentication:5.0 details: https://hg.tryton.org/modules/ldap_authentication?cmd=changeset=bcc67f47e13c description: Enforce certificate validation for LDAP connection issue11564 review417381003 (grafted from 366cca2d391e3fda2e038b34a032f4acf0efdce5) diffstat: CHANGELOG | 2 ++ res.py| 5 - 2 files changed, 6 insertions(+), 1 deletions(-) diffs (34 lines): diff -r ec8ba81a54f4 -r bcc67f47e13c CHANGELOG --- a/CHANGELOG Thu Jun 17 21:56:46 2021 +0200 +++ b/CHANGELOG Tue Jun 21 10:17:02 2022 +0200 @@ -1,3 +1,5 @@ +* Enforce certificate validation for LDAP connection (issue11564) + Version 5.0.4 - 2021-06-17 * Bug fixes (see mercurial logs for details) diff -r ec8ba81a54f4 -r bcc67f47e13c res.py --- a/res.pyThu Jun 17 21:56:46 2021 +0200 +++ b/res.pyTue Jun 21 10:17:02 2022 +0200 @@ -1,6 +1,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. import logging +import ssl import urllib.parse import ldap3 @@ -42,10 +43,12 @@ uri, _, _, _, _, extensions = parse_ldap_url(uri) if uri.scheme.startswith('ldaps'): scheme, port = 'ldaps', 636 +tls = ldap3.Tls(validate=ssl.CERT_REQUIRED) else: scheme, port = 'ldap', 389 +tls = None return ldap3.Server('%s://%s:%s' % ( -scheme, uri.hostname, uri.port or port)) +scheme, uri.hostname, uri.port or port), tls=tls) class User(metaclass=PoolMeta):
[tryton-commits] changeset in modules/ldap_authentication:6.0 Enforce certificate...
changeset ef94072def34 in modules/ldap_authentication:6.0 details: https://hg.tryton.org/modules/ldap_authentication?cmd=changeset=ef94072def34 description: Enforce certificate validation for LDAP connection issue11564 review417381003 (grafted from 366cca2d391e3fda2e038b34a032f4acf0efdce5) diffstat: CHANGELOG | 2 ++ res.py| 5 - 2 files changed, 6 insertions(+), 1 deletions(-) diffs (34 lines): diff -r 5895439fca1c -r ef94072def34 CHANGELOG --- a/CHANGELOG Mon May 03 15:37:53 2021 +0200 +++ b/CHANGELOG Tue Jun 21 10:17:02 2022 +0200 @@ -1,3 +1,5 @@ +* Enforce certificate validation for LDAP connection (issue11564) + Version 6.0.0 - 2021-05-03 * Bug fixes (see mercurial logs for details) diff -r 5895439fca1c -r ef94072def34 res.py --- a/res.pyMon May 03 15:37:53 2021 +0200 +++ b/res.pyTue Jun 21 10:17:02 2022 +0200 @@ -1,6 +1,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. import logging +import ssl import urllib.parse import ldap3 @@ -42,10 +43,12 @@ uri, _, _, _, _, extensions = parse_ldap_url(uri) if uri.scheme.startswith('ldaps'): scheme, port = 'ldaps', 636 +tls = ldap3.Tls(validate=ssl.CERT_REQUIRED) else: scheme, port = 'ldap', 389 +tls = None return ldap3.Server('%s://%s:%s' % ( -scheme, uri.hostname, uri.port or port)) +scheme, uri.hostname, uri.port or port), tls=tls) class User(metaclass=PoolMeta):
[tryton-commits] changeset in modules/ldap_authentication:6.2 Enforce certificate...
changeset 513f30593c54 in modules/ldap_authentication:6.2 details: https://hg.tryton.org/modules/ldap_authentication?cmd=changeset=513f30593c54 description: Enforce certificate validation for LDAP connection issue11564 review417381003 (grafted from 366cca2d391e3fda2e038b34a032f4acf0efdce5) diffstat: CHANGELOG | 2 ++ res.py| 5 - 2 files changed, 6 insertions(+), 1 deletions(-) diffs (34 lines): diff -r afafb11e0bed -r 513f30593c54 CHANGELOG --- a/CHANGELOG Mon Nov 01 17:02:36 2021 +0100 +++ b/CHANGELOG Tue Jun 21 10:17:02 2022 +0200 @@ -1,3 +1,5 @@ +* Enforce certificate validation for LDAP connection (issue11564) + Version 6.2.0 - 2021-11-01 * Bug fixes (see mercurial logs for details) diff -r afafb11e0bed -r 513f30593c54 res.py --- a/res.pyMon Nov 01 17:02:36 2021 +0100 +++ b/res.pyTue Jun 21 10:17:02 2022 +0200 @@ -1,6 +1,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. import logging +import ssl import urllib.parse import ldap3 @@ -42,10 +43,12 @@ uri, _, _, _, _, extensions = parse_ldap_url(uri) if uri.scheme.startswith('ldaps'): scheme, port = 'ldaps', 636 +tls = ldap3.Tls(validate=ssl.CERT_REQUIRED) else: scheme, port = 'ldap', 389 +tls = None return ldap3.Server('%s://%s:%s' % ( -scheme, uri.hostname, uri.port or port)) +scheme, uri.hostname, uri.port or port), tls=tls) class User(metaclass=PoolMeta):
[tryton-commits] changeset in modules/ldap_authentication:6.4 Enforce certificate...
changeset 8e370ce4b240 in modules/ldap_authentication:6.4 details: https://hg.tryton.org/modules/ldap_authentication?cmd=changeset=8e370ce4b240 description: Enforce certificate validation for LDAP connection issue11564 review417381003 (grafted from 366cca2d391e3fda2e038b34a032f4acf0efdce5) diffstat: CHANGELOG | 2 ++ res.py| 5 - 2 files changed, 6 insertions(+), 1 deletions(-) diffs (34 lines): diff -r d48910495606 -r 8e370ce4b240 CHANGELOG --- a/CHANGELOG Mon May 02 16:43:56 2022 +0200 +++ b/CHANGELOG Tue Jun 21 10:17:02 2022 +0200 @@ -1,3 +1,5 @@ +* Enforce certificate validation for LDAP connection (issue11564) + Version 6.4.0 - 2022-05-02 * Bug fixes (see mercurial logs for details) * Add support for Python 3.10 diff -r d48910495606 -r 8e370ce4b240 res.py --- a/res.pyMon May 02 16:43:56 2022 +0200 +++ b/res.pyTue Jun 21 10:17:02 2022 +0200 @@ -1,6 +1,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. import logging +import ssl import urllib.parse import ldap3 @@ -42,10 +43,12 @@ uri, _, _, _, _, extensions = parse_ldap_url(uri) if uri.scheme.startswith('ldaps'): scheme, port = 'ldaps', 636 +tls = ldap3.Tls(validate=ssl.CERT_REQUIRED) else: scheme, port = 'ldap', 389 +tls = None return ldap3.Server('%s://%s:%s' % ( -scheme, uri.hostname, uri.port or port)) +scheme, uri.hostname, uri.port or port), tls=tls) class User(metaclass=PoolMeta):
[tryton-commits] changeset in modules/account_stock_shipment_cost_weight:6.4 Stor...
changeset d52c926ac8fd in modules/account_stock_shipment_cost_weight:6.4 details: https://hg.tryton.org/modules/account_stock_shipment_cost_weight?cmd=changeset=d52c926ac8fd description: Store allocation factors per model name and id This avoid collision if different shipment models have the same id. issue11559 review443231004 (grafted from 72fb25e40b43e433f2a5b9c48d11c79edc80953d) diffstat: account.py | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diffs (14 lines): diff -r 24e4913c6706 -r d52c926ac8fd account.py --- a/account.pyMon May 02 17:57:15 2022 +0200 +++ b/account.pyWed Jun 15 22:05:41 2022 +0200 @@ -29,8 +29,8 @@ factors = {} for shipment in shipments: if not sum_weight: -factors[str(shipment.id)] = 1 / length +factors[str(shipment)] = 1 / length else: -factors[str(shipment.id)] = ( +factors[str(shipment)] = ( Decimal(shipment.weight or 0) / sum_weight) return factors
[tryton-commits] changeset in modules/account_stock_shipment_cost:6.4 Store alloc...
changeset 805860023023 in modules/account_stock_shipment_cost:6.4 details: https://hg.tryton.org/modules/account_stock_shipment_cost?cmd=changeset=805860023023 description: Store allocation factors per model name and id This avoid collision if different shipment models have the same id. issue11559 review443231004 (grafted from ff1179530c06cd90d96b4a150c6863bcc557b500) diffstat: account.py | 13 - 1 files changed, 8 insertions(+), 5 deletions(-) diffs (33 lines): diff -r 2061d0523fa5 -r 805860023023 account.py --- a/account.pyMon May 02 17:13:01 2022 +0200 +++ b/account.pyWed Jun 15 22:05:41 2022 +0200 @@ -210,7 +210,7 @@ shipments = self.all_shipments length = Decimal(len(shipments)) factor = 1 / length -return {str(shipment.id): factor for shipment in shipments} +return {str(shipment): factor for shipment in shipments} def _allocate_cost(self, factors, sign=1): "Allocate cost on shipments using factors" @@ -225,13 +225,16 @@ (list(self.shipment_returns), ShipmentReturn), ]: for shipment in shipments: +try: +factor = factors[str(shipment)] +except KeyError: +# Try with just id for backward compatibility +factor = factors[str(shipment.id)] if (any(c.state == 'posted' for c in shipment.shipment_costs) and shipment.cost): -shipment.cost += round_price( -cost * factors[str(shipment.id)]) +shipment.cost += round_price(cost * factor) else: -shipment.cost = round_price( -cost * factors[str(shipment.id)]) +shipment.cost = round_price(cost * factor) klass.save(shipments) klass.set_shipment_cost(shipments)
[tryton-commits] changeset in modules/account_payment_sepa:6.2 Convert filter to ...
changeset 4d9ddfa86775 in modules/account_payment_sepa:6.2 details: https://hg.tryton.org/modules/account_payment_sepa?cmd=changeset=4d9ddfa86775 description: Convert filter to list to call lock issue11537 (grafted from 6e6dabfb679d498c4163b3e2e29ee134ce428d06) diffstat: payment.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff -r 8814ed56f0bb -r 4d9ddfa86775 payment.py --- a/payment.pyMon Jun 20 23:43:27 2022 +0200 +++ b/payment.pyTue Jun 21 08:31:41 2022 +0200 @@ -214,7 +214,7 @@ if self.kind == 'receivable': payments = list(self.payments) mandates = Payment.get_sepa_mandates(payments) -Mandate.lock(filter(None, mandates)) +Mandate.lock(list(filter(None, mandates))) sequence_types = {} for payment, mandate in zip(payments, mandates): if not mandate:
[tryton-commits] changeset in modules/account_payment_sepa:6.2 Filter out empty m...
changeset 8814ed56f0bb in modules/account_payment_sepa:6.2 details: https://hg.tryton.org/modules/account_payment_sepa?cmd=changeset=8814ed56f0bb description: Filter out empty mandates before lock issue11537 review419251003 (grafted from 3b3e1664763dbfb124106e2907acd6130d43ff89) diffstat: payment.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff -r 664715ed94f7 -r 8814ed56f0bb payment.py --- a/payment.pyFri Dec 03 21:54:30 2021 +0100 +++ b/payment.pyMon Jun 20 23:43:27 2022 +0200 @@ -214,7 +214,7 @@ if self.kind == 'receivable': payments = list(self.payments) mandates = Payment.get_sepa_mandates(payments) -Mandate.lock(mandates) +Mandate.lock(filter(None, mandates)) sequence_types = {} for payment, mandate in zip(payments, mandates): if not mandate:
[tryton-commits] changeset in modules/account_payment_sepa:6.4 Convert filter to ...
changeset 1b3f8ba3b79f in modules/account_payment_sepa:6.4 details: https://hg.tryton.org/modules/account_payment_sepa?cmd=changeset=1b3f8ba3b79f description: Convert filter to list to call lock issue11537 (grafted from 6e6dabfb679d498c4163b3e2e29ee134ce428d06) diffstat: payment.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff -r 87cea3ad3077 -r 1b3f8ba3b79f payment.py --- a/payment.pyMon Jun 20 23:43:27 2022 +0200 +++ b/payment.pyTue Jun 21 08:31:41 2022 +0200 @@ -211,7 +211,7 @@ if self.kind == 'receivable': payments = list(self.payments) mandates = Payment.get_sepa_mandates(payments) -Mandate.lock(filter(None, mandates)) +Mandate.lock(list(filter(None, mandates))) sequence_types = {} for payment, mandate in zip(payments, mandates): if not mandate:
[tryton-commits] changeset in modules/account_payment_sepa:6.4 Filter out empty m...
changeset 87cea3ad3077 in modules/account_payment_sepa:6.4 details: https://hg.tryton.org/modules/account_payment_sepa?cmd=changeset=87cea3ad3077 description: Filter out empty mandates before lock issue11537 review419251003 (grafted from 3b3e1664763dbfb124106e2907acd6130d43ff89) diffstat: payment.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff -r 7a2132322d4f -r 87cea3ad3077 payment.py --- a/payment.pyMon May 02 17:33:19 2022 +0200 +++ b/payment.pyMon Jun 20 23:43:27 2022 +0200 @@ -211,7 +211,7 @@ if self.kind == 'receivable': payments = list(self.payments) mandates = Payment.get_sepa_mandates(payments) -Mandate.lock(mandates) +Mandate.lock(filter(None, mandates)) sequence_types = {} for payment, mandate in zip(payments, mandates): if not mandate:
[tryton-commits] changeset in modules/account:default Do not compare debit or cre...
changeset 6d06c13574dd in modules/account:default details: https://hg.tryton.org/modules/account?cmd=changeset=6d06c13574dd description: Do not compare debit or credit to None when searching issue11568 review417441003 diffstat: account.py | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diffs (21 lines): diff -r fa8a0d293726 -r 6d06c13574dd account.py --- a/account.pyWed Jun 15 22:01:00 2022 +0200 +++ b/account.pyFri Jun 24 09:19:13 2022 +0200 @@ -1966,7 +1966,7 @@ break ids = [a.id for a in accounts -if operator_(getattr(a, fname), operand)] +if operand is not None and operator_(getattr(a, fname), operand)] return [('id', 'in', ids)] @classmethod @@ -2014,7 +2014,7 @@ }.get(operator_, lambda v, l: False) ids = [a.id for a in accounts -if operator_(getattr(a, name), operand)] +if operand is not None and operator_(getattr(a, name), operand)] return [('id', 'in', ids)] def get_currency(self, name):