[tryton-commits] changeset in modules/purchase_request:default Remove company con...
changeset 3b11b7aa9bb0 in modules/purchase_request:default details: https://hg.tryton.org/modules/purchase_request?cmd=changeset=3b11b7aa9bb0 description: Remove company context domain issue11222 review393641002 diffstat: purchase_request.py | 7 ++- 1 files changed, 2 insertions(+), 5 deletions(-) diffs (24 lines): diff -r 020feb2f5e68 -r 3b11b7aa9bb0 purchase_request.py --- a/purchase_request.py Tue Feb 15 00:08:47 2022 +0100 +++ b/purchase_request.py Fri Feb 18 13:20:44 2022 +0100 @@ -12,7 +12,7 @@ employee_field, reset_employee, set_employee) from trytond.modules.product import round_price from trytond.pool import Pool -from trytond.pyson import Bool, Eval, If, In +from trytond.pyson import Bool, Eval, If from trytond.tools import firstline, sortable_values from trytond.transaction import Transaction from trytond.wizard import Button, StateTransition, StateView, Wizard @@ -88,10 +88,7 @@ purchase = fields.Function(fields.Many2One('purchase.purchase', 'Purchase'), 'get_purchase', searcher='search_purchase') company = fields.Many2One('company.company', 'Company', required=True, -readonly=True, domain=[ -('id', If(In('company', Eval('context', {})), '=', '!='), -Eval('context', {}).get('company', -1)), -]) +readonly=True) origin = fields.Reference('Origin', selection='get_origin', readonly=True) exception_ignored = fields.Boolean('Ignored Exception')
[tryton-commits] changeset in modules/notification_email:default Add test using i...
changeset 9d0273e50446 in modules/notification_email:default details: https://hg.tryton.org/modules/notification_email?cmd=changeset=9d0273e50446 description: Add test using id as recipient issue11033 review383751002 diffstat: tests/test_notification_email.py | 48 ++- 1 files changed, 46 insertions(+), 2 deletions(-) diffs (79 lines): diff -r cce8a58fa33c -r 9d0273e50446 tests/test_notification_email.py --- a/tests/test_notification_email.py Fri Feb 18 13:17:45 2022 +0100 +++ b/tests/test_notification_email.py Fri Feb 18 13:18:06 2022 +0100 @@ -6,6 +6,7 @@ from unittest.mock import ANY, patch from trytond.config import config + try: from trytond.modules.company.tests import CompanyTestMixin except ImportError: @@ -33,7 +34,7 @@ config.set('email', 'from', FROM) self.addCleanup(lambda: config.set('email', 'from', reset_from)) -def _setup_notification(self): +def _setup_notification(self, recipient_field='create_uid'): pool = Pool() Model = pool.get('ir.model') ModelField = pool.get('ir.model.field') @@ -63,7 +64,7 @@ notification_email = NotificationEmail() notification_email.recipients, = ModelField.search([ ('model.model', '=', model.model), -('name', '=', 'create_uid'), +('name', '=', recipient_field), ]) notification_email.content = report notification_email.save() @@ -132,6 +133,49 @@ self.assertEqual(log.recipients_secondary, '') self.assertEqual(log.recipients_hidden, '') +@unittest.skipIf( +(3, 5, 0) <= sys.version_info < (3, 5, 2), "python bug #25195") +@with_transaction() +def test_notification_email_id_recipient(self): +"Test email notificiation is sent when using id as recipient" +pool = Pool() +User = pool.get('res.user') +Trigger = pool.get('ir.trigger') +Model = pool.get('ir.model') +NotificationEmail = pool.get('notification.email') +Log = pool.get('notification.email.log') + +self._setup_notification(recipient_field='id') +notification_email, = NotificationEmail.search([]) + +model, = Model.search([ +('model', '=', User.__name__), +]) +Trigger.create([{ +'name': 'Test creation', +'model': model.id, +'on_create': True, +'condition': 'true', +'notification_email': notification_email.id, +'action': 'notification.email|trigger', +}]) + +with patch.object( +notification_module, 'sendmail_transactional') as sendmail, \ +patch.object(notification_module, 'SMTPDataManager'): +User.create([{ +'name': "Michael Scott", +'login': "msc", +'email': 'm...@example.com'}]) +self.run_tasks() +sendmail.assert_called_once_with( +FROM, ['m...@example.com'], ANY, +datamanager=ANY) + +log, = Log.search([]) +self.assertEqual(log.trigger.notification_email, notification_email) +self.assertEqual(log.recipients, 'Michael Scott ') + @with_transaction() def test_notification_email_delay(self): "Test email notification is sent with delay"
[tryton-commits] changeset in modules/notification_email:default Use record as re...
changeset cce8a58fa33c in modules/notification_email:default details: https://hg.tryton.org/modules/notification_email?cmd=changeset=cce8a58fa33c description: Use record as recipient for id fields issue11033 review383751002 diffstat: notification.py | 16 +++- 1 files changed, 11 insertions(+), 5 deletions(-) diffs (44 lines): diff -r dfa598f83870 -r cce8a58fa33c notification.py --- a/notification.py Sat Dec 18 16:31:08 2021 +0100 +++ b/notification.py Fri Feb 18 13:17:45 2022 +0100 @@ -266,11 +266,17 @@ if logs: Log.create(logs) +def _get_recipients(self, record, name): +if name == 'id': +return record +else: +return getattr(record, name, None) + def _get_to(self, record): to = [] languagues = set() if self.recipients: -recipients = getattr(record, self.recipients.name, None) +recipients = self._get_recipients(record, self.recipients.name) if recipients: languagues.update(self._get_languages(recipients)) to = self._get_addresses(recipients) @@ -284,8 +290,8 @@ cc = [] languagues = set() if self.recipients_secondary: -recipients_secondary = getattr( -record, self.recipients_secondary.name, None) +recipients_secondary = self._get_recipients( +record, self.recipients_secondary.name) if recipients_secondary: languagues.update( self._get_languages(recipients_secondary)) @@ -300,8 +306,8 @@ bcc = [] languagues = set() if self.recipients_hidden: -recipients_hidden = getattr( -record, self.recipients_hidden.name, None) +recipients_hidden = self._get_recipients( +record, self.recipients_hidden.name) if recipients_hidden: languagues.update(self._get_languages(recipients_hidden)) bcc = self._get_addresses(recipients_hidden)
[tryton-commits] changeset in modules/company:default Add company field on strict...
changeset 29eacb5a174a in modules/company:default details: https://hg.tryton.org/modules/company?cmd=changeset=29eacb5a174a description: Add company field on strict sequences view issue11205 review395441002 diffstat: ir.xml | 11 +++ 1 files changed, 11 insertions(+), 0 deletions(-) diffs (21 lines): diff -r 3aa665924244 -r 29eacb5a174a ir.xml --- a/ir.xmlThu Feb 03 23:13:26 2022 +0100 +++ b/ir.xmlFri Feb 18 13:15:08 2022 +0100 @@ -14,6 +14,17 @@ sequence_tree + +ir.sequence.strict + +sequence_form + + + +ir.sequence.strict + +sequence_tree + User in companies
[tryton-commits] changeset in trytond:default Catch UnicodeEncodeError when autoc...
changeset 24c1b56da072 in trytond:default details: https://hg.tryton.org/trytond?cmd=changeset=24c1b56da072 description: Catch UnicodeEncodeError when autocompleting emails issue11261 review38036100 diffstat: trytond/ir/email_.py | 10 -- 1 files changed, 8 insertions(+), 2 deletions(-) diffs (23 lines): diff -r 40122ebebce7 -r 24c1b56da072 trytond/ir/email_.py --- a/trytond/ir/email_.py Thu Feb 17 00:48:06 2022 +0100 +++ b/trytond/ir/email_.py Fri Feb 18 13:06:20 2022 +0100 @@ -206,11 +206,17 @@ if not name and not email: return [] s = StringMatcher() -s.set_seq2(_formataddr((name, email))) +try: +s.set_seq2(_formataddr((name, email))) +except UnicodeEncodeError: +return [] def generate(name, email): for name, email in cls._match(name, email): -address = _formataddr((name, email)) +try: +address = _formataddr((name, email)) +except UnicodeEncodeError: +continue s.set_seq1(address) yield ( s.ratio(), address,
[tryton-commits] changeset in weblate:default Translated using Weblate (German)
changeset fdd29648171f in weblate:default details: https://hg.tryton.org/weblate?cmd=changeset=fdd29648171f description: Translated using Weblate (German) Currently translated at 100.0% (309 of 309 strings) Translation: Tryton/account_invoice Translate-URL: https://translate.tryton.org/projects/tryton/account_invoice/de/ diffstat: modules/account_invoice/locale/de.po | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diffs (23 lines): diff -r 38a637e6b7c9 -r fdd29648171f modules/account_invoice/locale/de.po --- a/modules/account_invoice/locale/de.po Tue Feb 15 01:43:18 2022 + +++ b/modules/account_invoice/locale/de.po Thu Feb 17 08:31:03 2022 + @@ -1,8 +1,8 @@ # msgid "" msgstr "" -"PO-Revision-Date: 2022-02-12 09:02+\n" -"Last-Translator: Mathias Behrle \n" +"PO-Revision-Date: 2022-02-18 09:24+\n" +"Last-Translator: Korbinian Preisler \n" "Language: de\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -37,7 +37,7 @@ msgctxt "field:account.fiscalyear.invoice_sequence,in_credit_note_sequence:" msgid "Supplier Credit Note Sequence" -msgstr "Nummernkreis Lieferantengutschriften" +msgstr "Nummernkreis Lieferantenstornorechnungen" msgctxt "field:account.fiscalyear.invoice_sequence,in_invoice_sequence:" msgid "Supplier Invoice Sequence"
[tryton-commits] changeset in modules/sale_supply_production:default Plan product...
changeset 947ef95c15d7 in modules/sale_supply_production:default details: https://hg.tryton.org/modules/sale_supply_production?cmd=changeset=947ef95c15d7 description: Plan production for today when there is no shipping date issue11258 review356031002 diffstat: sale.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff -r 09d3209d099c -r 947ef95c15d7 sale.py --- a/sale.py Sun Jan 23 12:54:56 2022 +0100 +++ b/sale.py Fri Feb 18 09:40:35 2022 +0100 @@ -91,7 +91,7 @@ for l in invoice_lines)): return -date = self.shipping_date +date = self.shipping_date or today if date <= today: date = today else:
[tryton-commits] changeset in modules/sale:default Reuse planned shipping date wh...
changeset 3bfef79b48cb in modules/sale:default details: https://hg.tryton.org/modules/sale?cmd=changeset=3bfef79b48cb description: Reuse planned shipping date when all moves are cancelled issue11258 review366751002 diffstat: sale.py | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diffs (17 lines): diff -r a6b936440fd1 -r 3bfef79b48cb sale.py --- a/sale.py Tue Feb 15 00:08:47 2022 +0100 +++ b/sale.py Fri Feb 18 09:34:30 2022 +0100 @@ -1437,10 +1437,10 @@ @fields.depends('moves', methods=['planned_shipping_date']) def on_change_with_shipping_date(self, name=None): -if self.moves: +moves = [m for m in self.moves if m.state != 'cancelled'] +if moves: dates = filter( -None, (m.effective_date or m.planned_date for m in self.moves -if m.state != 'cancelled')) +None, (m.effective_date or m.planned_date for m in moves)) return min(dates, default=None) return self.planned_shipping_date
[tryton-commits] changeset in modules/purchase:default Reuse planned delivery dat...
changeset 55722fc603cd in modules/purchase:default details: https://hg.tryton.org/modules/purchase?cmd=changeset=55722fc603cd description: Reuse planned delivery date when all moves are cancelled issue11258 diffstat: purchase.py | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diffs (17 lines): diff -r ebdd7b78a2ee -r 55722fc603cd purchase.py --- a/purchase.py Tue Feb 15 00:08:47 2022 +0100 +++ b/purchase.py Fri Feb 18 09:40:01 2022 +0100 @@ -1453,10 +1453,10 @@ @fields.depends('moves', methods=['planned_delivery_date']) def on_change_with_delivery_date(self, name=None): -if self.moves: +moves = [m for m in self.moves if m.state != 'cancelled'] +if moves: dates = filter( -None, (m.effective_date or m.planned_date for m in self.moves -if m.state != 'cancelled')) +None, (m.effective_date or m.planned_date for m in moves)) return min(dates, default=None) return self.planned_delivery_date