diff --git a/.hgtags b/.hgtags index 99a1d6eb1a..53da1900b6 100644 --- a/.hgtags +++ b/.hgtags @@ -10260,3 +10260,14 @@ f7802c4cd99f5d1a8e8afeed793649afac5439f5 edocument_peppol-8.0.2 22623d7ef6b81070982632f7624e14e232e082a8 account_payment_sepa-8.0.4 1176083ab6d5dc037ee52a77d2f1509dbd6e201e account_payment-8.0.2 cb5455d12dcecfa772c91bb46712739eaa5ee8d1 account_fr_chorus-8.0.2 +f73dd540ab20cb934eaf4ba7d12e10c5b0a505f0 trytond-8.0.12 +87f40c432f65342546bdbc5e8b98a2f5e9ff52c8 sao-8.0.13 +73d6d4bdf75443bd66c6ebb48743f8791db34acd stock_package_shipping_dpd-8.0.1 +35aa1f5e052c61ed86fabfc8b6507c809cf30b05 stock-8.0.5 +a36217fb77ad2b3a038014e3eccb6dec09f85a6d production-8.0.2 +9675d71a97b6e894975be0eeb73991f44380fe35 party-8.0.4 +a4f8614f69228072eb771b32c6de598061ca01da edocument_uncefact-8.0.4 +aff9feb280cc7ab3cfdff747cb8154568b98bb02 edocument_ubl-8.0.6 +79a199671b2d7cce8e809ebbe2020bd2d7bfcf35 account_payment_sepa_cfonb-8.0.2 +4dc762be7586ca0ea291c2da7c695a4977a87311 account_payment_sepa-8.0.5 +8b9ab1dad57f91516e9eb3989967769386a00faa account-8.0.4 diff --git a/modules/account/CHANGELOG b/modules/account/CHANGELOG index c8160aa6a7..6a697380d8 100644 --- a/modules/account/CHANGELOG +++ b/modules/account/CHANGELOG @@ -1,4 +1,9 @@ +Version 8.0.4 - 2026-10-15 +-------------------------- +* Bug fixes (see mercurial logs for details) + + Version 8.0.3 - 2026-07-15 -------------------------- * Bug fixes (see mercurial logs for details) diff --git a/modules/account/move.py b/modules/account/move.py index 594a587f7d..5efb89db39 100644 --- a/modules/account/move.py +++ b/modules/account/move.py @@ -355,9 +355,11 @@ class Move(DescriptionOriginMixin, ModelSQL, ModelView): ''' pool = Pool() MoveLine = pool.get('account.move.line') + Currency = pool.get('currency.currency') line = MoveLine.__table__() transaction = Transaction() cursor = transaction.connection.cursor() + cast = Currency.rounding.sql_cast for company, moves in groupby(moves, key=lambda m: m.company): currency = company.currency @@ -370,7 +372,7 @@ class Move(DescriptionOriginMixin, ModelSQL, ModelView): group_by=line.move, having=Abs(Round( Sum(line.debit - line.credit), - currency.digits)) < abs(currency.rounding)) + currency.digits)) < cast(abs(currency.rounding))) cursor.execute(*line.update( [line.state], ['valid'], @@ -382,7 +384,7 @@ class Move(DescriptionOriginMixin, ModelSQL, ModelView): group_by=line.move, having=Abs(Round( Sum(line.debit - line.credit), - currency.digits)) >= abs(currency.rounding)) + currency.digits)) >= cast(abs(currency.rounding))) cursor.execute(*line.update( [line.state], ['draft'], @@ -1444,16 +1446,13 @@ class Line(DescriptionOriginMixin, MoveLineMixin, ModelSQL, ModelView): }]) @classmethod - def check_modification(cls, mode, lines, values=None, external=False): + def on_modification(cls, mode, lines, field_names=None): pool = Pool() Move = pool.get('account.move') - super().check_modification( - mode, lines, values=values, external=external) + super().on_modification(mode, lines, field_names=field_names) - if (mode in {'create', 'delete'} - or (mode == 'write' - and values.keys() - cls._check_modify_exclude)): + if field_names is None or (field_names - cls._check_modify_exclude): journal_period_done = set() for line in lines: if line.move.state == 'posted': @@ -1474,7 +1473,8 @@ class Line(DescriptionOriginMixin, MoveLineMixin, ModelSQL, ModelView): 'account.msg_delete_line_reconciled', line=line.rec_name)) if (mode == 'write' - and values.keys() & cls._reconciliation_modify_disallow): + and field_names is not None + and field_names & cls._reconciliation_modify_disallow): for line in lines: if line.reconciliation: raise AccessError(gettext( diff --git a/modules/account/tests/test_module.py b/modules/account/tests/test_module.py index 41521b0994..fa99eb40a4 100644 --- a/modules/account/tests/test_module.py +++ b/modules/account/tests/test_module.py @@ -767,6 +767,69 @@ class AccountTestCase( ] move.save() + @with_transaction() + def test_move_validation(self): + "Test move validation" + pool = Pool() + Party = pool.get('party.party') + FiscalYear = pool.get('account.fiscalyear') + Journal = pool.get('account.journal') + Account = pool.get('account.account') + Move = pool.get('account.move') + Line = pool.get('account.move.line') + + party = Party(name='Party') + party.save() + + company = create_company() + with set_company(company): + fiscalyear = get_fiscalyear(company) + fiscalyear.save() + FiscalYear.create_period([fiscalyear]) + period = fiscalyear.periods[0] + create_chart(company) + + journal_revenue, = Journal.search([ + ('code', '=', 'REV'), + ]) + revenue, = Account.search([ + ('type.revenue', '=', True), + ('closed', '=', False), + ], limit=1) + receivable, = Account.search([ + ('type.receivable', '=', True), + ('closed', '=', False), + ], limit=1) + + move = Move() + move.period = period + move.journal = journal_revenue + move.date = period.start_date + move.lines = [ + Line(account=revenue, credit=Decimal(100)), + ] + move.save() + + line, = move.lines + self.assertEqual(line.state, 'draft') + + move.lines += ( + Line(account=receivable, debit=Decimal(100), party=party), + ) + move.save() + + self.assertEqual([l.state for l in move.lines], ['valid', 'valid']) + + line = move.lines[-1] + line.credit = Decimal(50) + line.save() + + self.assertEqual(line.state, 'draft') + + line.credit = Decimal(100) + line.save() + self.assertEqual(line.state, 'valid') + @with_transaction() def test_find_best_reconciliation(self): "Test find best reconciliation" diff --git a/modules/account/tryton.cfg b/modules/account/tryton.cfg index b85b12564f..287c8a6f65 100644 --- a/modules/account/tryton.cfg +++ b/modules/account/tryton.cfg @@ -1,5 +1,5 @@ [tryton] -version=8.0.4 +version=8.0.5 depends: company currency diff --git a/modules/account_payment_sepa/CHANGELOG b/modules/account_payment_sepa/CHANGELOG index 9777ad8e57..a6b23d978b 100644 --- a/modules/account_payment_sepa/CHANGELOG +++ b/modules/account_payment_sepa/CHANGELOG @@ -1,4 +1,9 @@ +Version 8.0.5 - 2026-10-15 +-------------------------- +* Bug fixes (see mercurial logs for details) + + Version 8.0.4 - 2026-10-01 -------------------------- * Bug fixes (see mercurial logs for details) diff --git a/modules/account_payment_sepa/template/pain.001.001.03.xml b/modules/account_payment_sepa/template/pain.001.001.03.xml index 52c8213550..2f494fce8b 100644 --- a/modules/account_payment_sepa/template/pain.001.001.03.xml +++ b/modules/account_payment_sepa/template/pain.001.001.03.xml @@ -32,7 +32,7 @@ this repository contains the full copyright notices and license terms. --> ${datetime.datetime.now().replace(microsecond=0).isoformat()} ${sum(len(payments) for _, payments in group.sepa_payments)} - ${format(sum(p.amount for p in group.payments).normalize(), 'f')} + ${format(sum(p.amount for p in group.payments), 'f')} @@ -45,7 +45,7 @@ this repository contains the full copyright notices and license terms. --> TRF ${'true' if group.journal.sepa_batch_booking else 'false'} ${len(payments)} - ${format(sum(p.amount for p in payments).normalize(), 'f')} + ${format(sum(p.amount for p in payments), 'f')} @@ -77,7 +77,7 @@ this repository contains the full copyright notices and license terms. --> - ${format(payment.amount.normalize(), 'f')} + ${format(payment.amount, 'f')} diff --git a/modules/account_payment_sepa/template/pain.001.001.05.xml b/modules/account_payment_sepa/template/pain.001.001.05.xml index bfe1893941..8ec43a54cc 100644 --- a/modules/account_payment_sepa/template/pain.001.001.05.xml +++ b/modules/account_payment_sepa/template/pain.001.001.05.xml @@ -13,7 +13,7 @@ this repository contains the full copyright notices and license terms. --> ${datetime.datetime.now().replace(microsecond=0).isoformat()} ${sum(len(payments) for _, payments in group.sepa_payments)} - ${format(sum(p.amount for p in group.payments).normalize(), 'f')} + ${format(sum(p.amount for p in group.payments), 'f')} @@ -26,7 +26,7 @@ this repository contains the full copyright notices and license terms. --> TRF ${'true' if group.journal.sepa_batch_booking else 'false'} ${len(payments)} - ${format(sum(p.amount for p in payments).normalize(), 'f')} + ${format(sum(p.amount for p in payments), 'f')} @@ -59,7 +59,7 @@ this repository contains the full copyright notices and license terms. --> - ${format(payment.amount.normalize(), 'f')} + ${format(payment.amount, 'f')} diff --git a/modules/account_payment_sepa/template/pain.001.003.03.xml b/modules/account_payment_sepa/template/pain.001.003.03.xml index 04e9adced7..197dc835d4 100644 --- a/modules/account_payment_sepa/template/pain.001.003.03.xml +++ b/modules/account_payment_sepa/template/pain.001.003.03.xml @@ -15,7 +15,7 @@ this repository contains the full copyright notices and license terms. --> ${group.sepa_message_id[:35]} ${datetime.datetime.now().replace(microsecond=0).isoformat()} ${sum(len(payments) for _, payments in group.sepa_payments)} - ${format(sum(p.amount for p in group.payments).normalize(), 'f')} + ${format(sum(p.amount for p in group.payments), 'f')} ${PartyIdentification(group.sepa_initiating_party, id=group.journal.sepa_payable_initiator_id, with_address=False)} @@ -25,7 +25,7 @@ this repository contains the full copyright notices and license terms. --> TRF ${'true' if group.journal.sepa_batch_booking else 'false'} ${len(payments)} - ${format(sum(p.amount for p in payments).normalize(), 'f')} + ${format(sum(p.amount for p in payments), 'f')} @@ -52,7 +52,7 @@ this repository contains the full copyright notices and license terms. --> - ${format(payment.amount.normalize(), 'f')} + ${format(payment.amount, 'f')} diff --git a/modules/account_payment_sepa/template/pain.008.001.02.xml b/modules/account_payment_sepa/template/pain.008.001.02.xml index 4b9a43c1ac..5f2b04138c 100644 --- a/modules/account_payment_sepa/template/pain.008.001.02.xml +++ b/modules/account_payment_sepa/template/pain.008.001.02.xml @@ -32,7 +32,7 @@ this repository contains the full copyright notices and license terms. --> ${datetime.datetime.now().replace(microsecond=0).isoformat()} ${sum(len(payments) for _, payments in group.sepa_payments)} - ${format(sum(p.amount for p in group.payments).normalize(), 'f')} + ${format(sum(p.amount for p in group.payments), 'f')} @@ -45,7 +45,7 @@ this repository contains the full copyright notices and license terms. --> DD ${'true' if group.journal.sepa_batch_booking else 'false'} ${len(payments)} - ${format(sum(p.amount for p in payments).normalize(), 'f')} + ${format(sum(p.amount for p in payments), 'f')} @@ -83,7 +83,7 @@ this repository contains the full copyright notices and license terms. --> ${payment.sepa_end_to_end_id} - ${format(payment.amount.normalize(), 'f')} + ${format(payment.amount, 'f')} diff --git a/modules/account_payment_sepa/template/pain.008.001.04.xml b/modules/account_payment_sepa/template/pain.008.001.04.xml index a597142303..d93a035da9 100644 --- a/modules/account_payment_sepa/template/pain.008.001.04.xml +++ b/modules/account_payment_sepa/template/pain.008.001.04.xml @@ -13,7 +13,7 @@ this repository contains the full copyright notices and license terms. --> ${datetime.datetime.now().replace(microsecond=0).isoformat()} ${len(group.payments)} - ${format(sum(p.amount for p in group.payments).normalize(), 'f')} + ${format(sum(p.amount for p in group.payments), 'f')} @@ -26,7 +26,7 @@ this repository contains the full copyright notices and license terms. --> DD ${'true' if group.journal.sepa_batch_booking else 'false'} ${len(payments)} - ${format(sum(p.amount for p in payments).normalize(), 'f')} + ${format(sum(p.amount for p in payments), 'f')} @@ -64,7 +64,7 @@ this repository contains the full copyright notices and license terms. --> ${payment.sepa_end_to_end_id} - ${format(payment.amount.normalize(), 'f')} + ${format(payment.amount, 'f')} diff --git a/modules/account_payment_sepa/template/pain.008.003.02.xml b/modules/account_payment_sepa/template/pain.008.003.02.xml index a167344082..37d1ee1b82 100644 --- a/modules/account_payment_sepa/template/pain.008.003.02.xml +++ b/modules/account_payment_sepa/template/pain.008.003.02.xml @@ -15,7 +15,7 @@ this repository contains the full copyright notices and license terms. --> ${group.sepa_message_id[:35]} ${datetime.datetime.now().replace(microsecond=0).isoformat()} ${sum(len(payments) for _, payments in group.sepa_payments)} - ${format(sum(p.amount for p in group.payments).normalize(), 'f')} + ${format(sum(p.amount for p in group.payments), 'f')} ${PartyIdentification(group.sepa_initiating_party, id=group.journal.sepa_receivable_initiator_id, with_address=False)} @@ -25,7 +25,7 @@ this repository contains the full copyright notices and license terms. --> DD ${'true' if group.journal.sepa_batch_booking else 'false'} ${len(payments)} - ${format(sum(p.amount for p in payments).normalize(), 'f')} + ${format(sum(p.amount for p in payments), 'f')} SEPA @@ -56,7 +56,7 @@ this repository contains the full copyright notices and license terms. --> ${payment.sepa_instruction_id} ${payment.sepa_end_to_end_id} - ${format(payment.amount.normalize(), 'f')} + ${format(payment.amount, 'f')} diff --git a/modules/account_payment_sepa/tryton.cfg b/modules/account_payment_sepa/tryton.cfg index 7eda52e29e..cdb98d04cf 100644 --- a/modules/account_payment_sepa/tryton.cfg +++ b/modules/account_payment_sepa/tryton.cfg @@ -1,5 +1,5 @@ [tryton] -version=8.0.5 +version=8.0.6 depends: account account_payment diff --git a/modules/account_payment_sepa_cfonb/CHANGELOG b/modules/account_payment_sepa_cfonb/CHANGELOG index ca1cccf125..65ef4c4251 100644 --- a/modules/account_payment_sepa_cfonb/CHANGELOG +++ b/modules/account_payment_sepa_cfonb/CHANGELOG @@ -1,4 +1,9 @@ +Version 8.0.2 - 2026-10-15 +-------------------------- +* Bug fixes (see mercurial logs for details) + + Version 8.0.1 - 2026-08-04 -------------------------- * Bug fixes (see mercurial logs for details) diff --git a/modules/account_payment_sepa_cfonb/template/pain.001.001.03-cfonb.xml b/modules/account_payment_sepa_cfonb/template/pain.001.001.03-cfonb.xml index cf9b578bd1..ab237aed47 100644 --- a/modules/account_payment_sepa_cfonb/template/pain.001.001.03-cfonb.xml +++ b/modules/account_payment_sepa_cfonb/template/pain.001.001.03-cfonb.xml @@ -26,7 +26,7 @@ this repository contains the full copyright notices and license terms. --> ${group.sepa_message_id[:35]} ${datetime.datetime.now().replace(microsecond=0).isoformat()} ${sum(len(payments) for _, payments in group.sepa_payments)} - ${format(sum(p.amount for p in group.payments).normalize(), 'f')} + ${format(sum(p.amount for p in group.payments), 'f')} ${PartyIdentification(group.sepa_initiating_party)} @@ -36,7 +36,7 @@ this repository contains the full copyright notices and license terms. --> TRF ${'true' if group.journal.sepa_batch_booking else 'false'} ${len(payments)} - ${format(sum(p.amount for p in payments).normalize(), 'f')} + ${format(sum(p.amount for p in payments), 'f')} @@ -62,7 +62,7 @@ this repository contains the full copyright notices and license terms. --> ${payment.sepa_end_to_end_id} - ${format(payment.amount.normalize(), 'f')} + ${format(payment.amount, 'f')} diff --git a/modules/account_payment_sepa_cfonb/template/pain.008.001.02-cfonb.xml b/modules/account_payment_sepa_cfonb/template/pain.008.001.02-cfonb.xml index 7bda4d37a5..a81676d936 100644 --- a/modules/account_payment_sepa_cfonb/template/pain.008.001.02-cfonb.xml +++ b/modules/account_payment_sepa_cfonb/template/pain.008.001.02-cfonb.xml @@ -32,7 +32,7 @@ this repository contains the full copyright notices and license terms. --> ${group.sepa_message_id[:35]} ${datetime.datetime.now().replace(microsecond=0).isoformat()} ${sum(len(payments) for _, payments in group.sepa_payments)} - ${format(sum(p.amount for p in group.payments).normalize(), 'f')} + ${format(sum(p.amount for p in group.payments), 'f')} ${PartyIdentification(group.sepa_initiating_party)} @@ -42,7 +42,7 @@ this repository contains the full copyright notices and license terms. --> DD ${'true' if group.journal.sepa_batch_booking else 'false'} ${len(payments)} - ${format(sum(p.amount for p in payments).normalize(), 'f')} + ${format(sum(p.amount for p in payments), 'f')} SEPA @@ -73,7 +73,7 @@ this repository contains the full copyright notices and license terms. --> ${payment.sepa_instruction_id} ${payment.sepa_end_to_end_id} - ${format(payment.amount.normalize(), 'f')} + ${format(payment.amount, 'f')} ${mandate.identification} diff --git a/modules/account_payment_sepa_cfonb/tryton.cfg b/modules/account_payment_sepa_cfonb/tryton.cfg index b9ea715751..55a85f7033 100644 --- a/modules/account_payment_sepa_cfonb/tryton.cfg +++ b/modules/account_payment_sepa_cfonb/tryton.cfg @@ -1,5 +1,5 @@ [tryton] -version=8.0.2 +version=8.0.3 depends: account_payment account_payment_sepa diff --git a/modules/edocument_ubl/CHANGELOG b/modules/edocument_ubl/CHANGELOG index 381bf63713..7016c27687 100644 --- a/modules/edocument_ubl/CHANGELOG +++ b/modules/edocument_ubl/CHANGELOG @@ -1,4 +1,9 @@ +Version 8.0.6 - 2026-10-15 +-------------------------- +* Bug fixes (see mercurial logs for details) + + Version 8.0.5 - 2026-09-16 -------------------------- * Bug fixes (see mercurial logs for details) diff --git a/modules/edocument_ubl/template/2/CreditNote.xml b/modules/edocument_ubl/template/2/CreditNote.xml index f9fdd61bee..973b3162ba 100644 --- a/modules/edocument_ubl/template/2/CreditNote.xml +++ b/modules/edocument_ubl/template/2/CreditNote.xml @@ -90,7 +90,7 @@ this repository contains the full copyright notices and license terms. --> ${this.invoice.payment_term.description} - ${format(line.amount.normalize(), 'f')} + ${format(line.amount, 'f')} ${line.maturity_date} @@ -101,16 +101,16 @@ this repository contains the full copyright notices and license terms. --> ${reason_code} ${allowance_charge.product.name} - ${format(abs(allowance_charge.amount).normalize(), 'f')} + ${format(abs(allowance_charge.amount), 'f')} ${TaxCategory(tax_line.tax)} - ${format((-amount).normalize(), 'f')} + ${format(-amount, 'f')} - ${format((-line.base).normalize(), 'f')} - ${format((-line.amount).normalize(), 'f')} + ${format(-line.base, 'f')} + ${format(-line.amount, 'f')} ${format((line.tax.rate * 100).normalize(), 'f')} ${TaxCategory(line.tax)} @@ -118,19 +118,19 @@ this repository contains the full copyright notices and license terms. --> - ${format((-this.invoice.untaxed_amount).normalize(), 'f')} - ${format((-this.invoice.untaxed_amount).normalize(), 'f')} - ${format((-(this.invoice.untaxed_amount + this.invoice.tax_amount)).normalize(), 'f')} + ${format(-this.invoice.untaxed_amount, 'f')} + ${format(-this.invoice.untaxed_amount, 'f')} + ${format(-(this.invoice.untaxed_amount + this.invoice.tax_amount), 'f')} - ${format((-(this.invoice.total_amount - this.invoice.untaxed_amount - this.invoice.tax_amount)).normalize(), 'f')} + ${format(-(this.invoice.total_amount - this.invoice.untaxed_amount - this.invoice.tax_amount), 'f')} - ${format((-this.prepaid_amount).normalize(), 'f')} - ${format((-this.invoice.total_amount + this.prepaid_amount).normalize(), 'f')} + ${format(-this.prepaid_amount, 'f')} + ${format(-this.invoice.total_amount + this.prepaid_amount, 'f')} ${line_id} - ${format(-Decimal(str(line.quantity)), 'f')} - ${format((-line.amount).normalize(), 'f')} + ${format(-Decimal(str(line.quantity)).normalize(), 'f')} + ${format(-line.amount, 'f')} ${line.description} ${line.product.name if line.product else line.summary} diff --git a/modules/edocument_ubl/template/2/Invoice.xml b/modules/edocument_ubl/template/2/Invoice.xml index a66d06cc3f..4e097a8b73 100644 --- a/modules/edocument_ubl/template/2/Invoice.xml +++ b/modules/edocument_ubl/template/2/Invoice.xml @@ -90,7 +90,7 @@ this repository contains the full copyright notices and license terms. --> ${this.invoice.payment_term.description} - ${format(line.amount.normalize(), 'f')} + ${format(line.amount, 'f')} ${line.maturity_date} @@ -101,16 +101,16 @@ this repository contains the full copyright notices and license terms. --> ${reason_code} ${allowance_charge.product.name} - ${format(abs(allowance_charge.amount).normalize(), 'f')} + ${format(abs(allowance_charge.amount), 'f')} ${TaxCategory(tax_line.tax)} - ${format(amount.normalize(), 'f')} + ${format(amount, 'f')} - ${format(line.base.normalize(), 'f')} - ${format(line.amount.normalize(), 'f')} + ${format(line.base, 'f')} + ${format(line.amount, 'f')} ${format((line.tax.rate * 100).normalize(), 'f')} ${TaxCategory(line.tax)} @@ -118,19 +118,19 @@ this repository contains the full copyright notices and license terms. --> - ${format(this.invoice.untaxed_amount.normalize(), 'f')} - ${format(this.invoice.untaxed_amount.normalize(), 'f')} - ${format((this.invoice.untaxed_amount + this.invoice.tax_amount).normalize(), 'f')} + ${format(this.invoice.untaxed_amount, 'f')} + ${format(this.invoice.untaxed_amount, 'f')} + ${format((this.invoice.untaxed_amount + this.invoice.tax_amount), 'f')} - ${format((this.invoice.total_amount - this.invoice.untaxed_amount - this.invoice.tax_amount).normalize(), 'f')} + ${format((this.invoice.total_amount - this.invoice.untaxed_amount - this.invoice.tax_amount), 'f')} - ${format(this.prepaid_amount.normalize(), 'f')} - ${format((this.invoice.total_amount - this.prepaid_amount).normalize(), 'f')} + ${format(this.prepaid_amount, 'f')} + ${format(this.invoice.total_amount - this.prepaid_amount, 'f')} ${line_id} - ${format(Decimal(str(line.quantity)), 'f')} - ${format(line.amount.normalize(), 'f')} + ${format(Decimal(str(line.quantity)).normalize(), 'f')} + ${format(line.amount, 'f')} ${line.description} ${line.product.name if line.product else line.summary} diff --git a/modules/edocument_ubl/tryton.cfg b/modules/edocument_ubl/tryton.cfg index ac3ed2e973..9e49c6f97e 100644 --- a/modules/edocument_ubl/tryton.cfg +++ b/modules/edocument_ubl/tryton.cfg @@ -1,5 +1,5 @@ [tryton] -version=8.0.6 +version=8.0.7 depends: edocument_unece ir diff --git a/modules/edocument_uncefact/CHANGELOG b/modules/edocument_uncefact/CHANGELOG index e5807f75ea..61f45eb627 100644 --- a/modules/edocument_uncefact/CHANGELOG +++ b/modules/edocument_uncefact/CHANGELOG @@ -1,4 +1,9 @@ +Version 8.0.4 - 2026-10-15 +-------------------------- +* Bug fixes (see mercurial logs for details) + + Version 8.0.3 - 2026-09-16 -------------------------- * Bug fixes (see mercurial logs for details) diff --git a/modules/edocument_uncefact/template/16B-CII/CrossIndustryInvoice.xml b/modules/edocument_uncefact/template/16B-CII/CrossIndustryInvoice.xml index 87ce726702..c7e056aebe 100644 --- a/modules/edocument_uncefact/template/16B-CII/CrossIndustryInvoice.xml +++ b/modules/edocument_uncefact/template/16B-CII/CrossIndustryInvoice.xml @@ -44,11 +44,11 @@ this repository contains the full copyright notices and license terms. --> - ${format((amount * this.type_sign).normalize(), 'f')} + ${format(amount * this.type_sign, 'f')} ${tax.unece_code} ${tax.vatex_code} ${tax.legal_notice} - ${format((base * this.type_sign).normalize(), 'f')} + ${format(base * this.type_sign, 'f')} ${tax.unece_category_code} ${format((tax.rate * 100).normalize(), 'f')} @@ -74,18 +74,18 @@ this repository contains the full copyright notices and license terms. --> - ${format(this.invoice.currency.round(line.unit_price).normalize(), 'f')} + ${format(this.invoice.currency.round(line.unit_price), 'f')} - ${format(abs(Decimal(str(line.quantity))), 'f')} + ${format(abs(Decimal(str(line.quantity)).normalize()), 'f')} ${TradeTax(tax.tax)} - ${format((line.amount * this.type_sign).normalize(), 'f')} + ${format(line.amount * this.type_sign, 'f')} @@ -158,14 +158,14 @@ this repository contains the full copyright notices and license terms. --> ${DateTime(line.maturity_date)} - ${format(((line.amount_second_currency or (line.debit - line.credit)) * this.type_sign).normalize(), 'f')} + ${format((line.amount_second_currency or (line.debit - line.credit)) * this.type_sign, 'f')} - ${format((this.invoice.untaxed_amount * this.type_sign).normalize(), 'f')} - ${format((this.invoice.untaxed_amount * this.type_sign).normalize(), 'f')} - ${format((this.invoice.tax_amount * this.type_sign).normalize(), 'f')} - ${format((this.invoice.total_amount * this.type_sign).normalize(), 'f')} - ${format((this.invoice.amount_to_pay * this.type_sign).normalize(), 'f')} + ${format(this.invoice.untaxed_amount * this.type_sign, 'f')} + ${format(this.invoice.untaxed_amount * this.type_sign, 'f')} + ${format(this.invoice.tax_amount * this.type_sign, 'f')} + ${format(this.invoice.total_amount * this.type_sign, 'f')} + ${format(this.invoice.amount_to_pay * this.type_sign, 'f')} diff --git a/modules/edocument_uncefact/tryton.cfg b/modules/edocument_uncefact/tryton.cfg index 9332da59d6..662845ba5e 100644 --- a/modules/edocument_uncefact/tryton.cfg +++ b/modules/edocument_uncefact/tryton.cfg @@ -1,5 +1,5 @@ [tryton] -version=8.0.4 +version=8.0.5 depends: ir edocument_unece diff --git a/modules/party/CHANGELOG b/modules/party/CHANGELOG index 9d2deb8a8c..47e3f4ae96 100644 --- a/modules/party/CHANGELOG +++ b/modules/party/CHANGELOG @@ -1,4 +1,9 @@ +Version 8.0.4 - 2026-10-15 +-------------------------- +* Bug fixes (see mercurial logs for details) + + Version 8.0.3 - 2026-08-15 -------------------------- * Bug fixes (see mercurial logs for details) diff --git a/modules/party/party.py b/modules/party/party.py index 138bfd663e..f3b3520d2f 100644 --- a/modules/party/party.py +++ b/modules/party/party.py @@ -395,12 +395,15 @@ class Party( else: for country in eu_vat.guess_country(text): if 'eu_vat' in identifier_types: - code = eu_vat.compact(country + text) - add('eu_vat', code) + code = country + text + if eu_vat.is_valid(code): + code = eu_vat.compact(code) + add('eu_vat', code) elif f'{country}_vat' in identifier_types: vat = get_cc_module(country, 'vat') - code = vat.compact(text) - add(f'{country}_vat', code) + if vat.is_valid(text): + code = vat.compact(text) + add(f'{country}_vat', code) return result @classmethod @@ -913,18 +916,20 @@ class Identifier(sequence_ordered(), DeactivableMixin, ModelSQL, ModelView): @fields.depends('type', 'code') def on_change_with_code(self): code = self.code - if self.type and '_' in self.type: + if code and self.type and '_' in self.type: if module := get_cc_module(*self.type.split('_', 1)): - if hasattr(module, 'compact'): - try: - code = module.compact(code) - except stdnum.exceptions.ValidationError: - pass - if hasattr(module, 'format'): - try: - code = module.format(code) - except stdnum.exceptions.ValidationError: - pass + if (hasattr(module, 'is_valid') + and module.is_valid(code)): + if hasattr(module, 'compact'): + try: + code = module.compact(code) + except stdnum.exceptions.ValidationError: + pass + if hasattr(module, 'format'): + try: + code = module.format(code) + except stdnum.exceptions.ValidationError: + pass return code def pre_validate(self): @@ -955,16 +960,18 @@ class Identifier(sequence_ordered(), DeactivableMixin, ModelSQL, ModelView): if ((type := values.get('type')) and '_' in type and (code := values.get('code'))): if module := get_cc_module(*type.split('_', 1)): - if hasattr(module, 'format'): - try: - values['code'] = module.format(code) - except stdnum.exceptions.ValidationError: - pass - if hasattr(module, 'compact'): - try: - values['code_compact'] = module.compact(code) - except stdnum.exceptions.ValidationError: - pass + if (hasattr(module, 'is_valid') + and module.is_valid(code)): + if hasattr(module, 'format'): + try: + values['code'] = module.format(code) + except stdnum.exceptions.ValidationError: + pass + if hasattr(module, 'compact'): + try: + values['code_compact'] = module.compact(code) + except stdnum.exceptions.ValidationError: + pass return values def compute_fields(self, field_names=None): @@ -974,12 +981,14 @@ class Identifier(sequence_ordered(), DeactivableMixin, ModelSQL, ModelView): code_compact = getattr(self, 'code_compact', None) if (type := getattr(self, 'type', None)) and '_' in type and code: if module := get_cc_module(*type.split('_', 1)): - if hasattr(module, 'format'): - code = module.format(code) - if hasattr(module, 'compact'): - code_compact = module.compact(code) - else: - code_compact = code + if (hasattr(module, 'is_valid') + and module.is_valid(code)): + if hasattr(module, 'format'): + code = module.format(code) + if hasattr(module, 'compact'): + code_compact = module.compact(code) + else: + code_compact = code if getattr(self, 'code', None) != code: values['code'] = code if getattr(self, 'code_compact', None) != code_compact: diff --git a/modules/party/tryton.cfg b/modules/party/tryton.cfg index 91093517e5..5307247293 100644 --- a/modules/party/tryton.cfg +++ b/modules/party/tryton.cfg @@ -1,5 +1,5 @@ [tryton] -version=8.0.4 +version=8.0.5 depends: country ir diff --git a/modules/production/CHANGELOG b/modules/production/CHANGELOG index ab732daa6d..6f7dac4f56 100644 --- a/modules/production/CHANGELOG +++ b/modules/production/CHANGELOG @@ -1,4 +1,9 @@ +Version 8.0.2 - 2026-10-15 +-------------------------- +* Bug fixes (see mercurial logs for details) + + Version 8.0.1 - 2026-07-01 -------------------------- * Bug fixes (see mercurial logs for details) diff --git a/modules/production/production.py b/modules/production/production.py index 0757d0aae8..aa3f5d3d0b 100644 --- a/modules/production/production.py +++ b/modules/production/production.py @@ -470,7 +470,7 @@ class Production( for input_ in self.inputs: if input_.state == 'cancelled': continue - cost_price = input_.get_cost_price() + cost_price = input_.get_cost_price() or 0 cost += (Decimal(str(input_.internal_quantity)) * cost_price) return round_price(cost) @@ -491,7 +491,7 @@ class Production( product = input_.product quantity = Uom.compute_qty( input_.unit, input_.quantity, product.default_uom) - cost += Decimal(str(quantity)) * product.cost_price + cost += Decimal(str(quantity)) * (product.cost_price or 0) return cost @dualmethod @@ -516,18 +516,20 @@ class Production( for input_ in production.bom.inputs: quantity = input_.compute_quantity(factor) product = input_.product - move = production._move( - 'input', product, input_.unit, quantity) - move.planned_date = input_date - to_save.append(input_.prepare_move(production, move)) + for line, quantity in input_.lines_for_quantity(quantity): + move = production._move( + 'input', product, input_.unit, quantity) + move.planned_date = input_date + to_save.append(input_.prepare_move(production, move)) for output in production.bom.outputs: quantity = output.compute_quantity(factor) product = output.product - move = production._move( - 'output', product, output.unit, quantity) - move.planned_date = output_date - to_save.append(output.prepare_move(production, move)) + for line, quantity in output.lines_for_quantity(quantity): + move = production._move( + 'output', product, output.unit, quantity) + move.planned_date = output_date + to_save.append(output.prepare_move(production, move)) Move.save(to_save) @classmethod @@ -564,7 +566,7 @@ class Production( for input_ in production.inputs: if input_.state == 'cancelled': continue - cost_price = input_.get_cost_price() + cost_price = input_.get_cost_price() or 0 input_quantities[input_.product] += ( Decimal(str(input_.internal_quantity))) input_costs[input_.product] += ( diff --git a/modules/production/tryton.cfg b/modules/production/tryton.cfg index 72ec77ce42..d5db94c4d6 100644 --- a/modules/production/tryton.cfg +++ b/modules/production/tryton.cfg @@ -1,5 +1,5 @@ [tryton] -version=8.0.2 +version=8.0.3 depends: company ir diff --git a/modules/stock/CHANGELOG b/modules/stock/CHANGELOG index ac83b9742d..58930dd6f2 100644 --- a/modules/stock/CHANGELOG +++ b/modules/stock/CHANGELOG @@ -1,4 +1,9 @@ +Version 8.0.5 - 2026-10-15 +-------------------------- +* Bug fixes (see mercurial logs for details) + + Version 8.0.4 - 2026-10-01 -------------------------- * Bug fixes (see mercurial logs for details) diff --git a/modules/stock/move.py b/modules/stock/move.py index 3780071931..b3e75a0677 100644 --- a/modules/stock/move.py +++ b/modules/stock/move.py @@ -322,8 +322,10 @@ class Move(Workflow, ModelSQL, ModelView): ()), ], states={ - 'invisible': ~Eval('unit_price_required'), - 'required': Bool(Eval('unit_price_required')), + 'invisible': ( + ~Eval('unit_price_required', False) + & (Eval('unit_price', None) == None)), # noqa: E711 + 'required': Eval('unit_price_required', False), 'readonly': Eval('state') != 'draft', }) unit_price_company = fields.Function( @@ -346,7 +348,7 @@ class Move(Workflow, ModelSQL, ModelView): ()), ], states={ - 'invisible': ~Eval('cost_price_required'), + 'invisible': ~Eval('cost_price_required', False), 'required': ( (Eval('state') == 'done') & Eval('cost_price_required', False)), @@ -370,8 +372,10 @@ class Move(Workflow, ModelSQL, ModelView): ()), ], states={ - 'invisible': ~Eval('unit_price_required'), - 'required': Bool(Eval('unit_price_required')), + 'invisible': ( + ~Eval('unit_price_required') + & (Eval('currency', None) == None)), # noqa: E711 + 'required': Eval('unit_price_required', False), 'readonly': Eval('state') != 'draft', }, help="The currency in which the unit price is specified.") diff --git a/modules/stock/stock_reporting.py b/modules/stock/stock_reporting.py index a7523bf168..0b678716ec 100644 --- a/modules/stock/stock_reporting.py +++ b/modules/stock/stock_reporting.py @@ -154,13 +154,13 @@ class _InventoryMixin: output_clause = ( (from_location.left >= left) & (from_location.right <= right)) start_quantity = Sum( - move.quantity * Case((output_clause, -1), else_=1), + move.internal_quantity * Case((output_clause, -1), else_=1), filter_=(move_date < from_date)) input_quantity = Sum( - move.quantity, + move.internal_quantity, filter_=input_clause & (move_date >= from_date)) output_quantity = Sum( - move.quantity, + move.internal_quantity, filter_=output_clause & (move_date >= from_date)) date_column = Greatest(move_date, from_date) diff --git a/modules/stock/tests/scenario_stock_reporting_inventory.rst b/modules/stock/tests/scenario_stock_reporting_inventory.rst index 18701d16c8..d3eacc6724 100644 --- a/modules/stock/tests/scenario_stock_reporting_inventory.rst +++ b/modules/stock/tests/scenario_stock_reporting_inventory.rst @@ -50,6 +50,8 @@ Get currency:: Create product:: >>> unit, = ProductUom.find([('name', '=', 'Unit')]) + >>> box2, = unit.duplicate(default={'factor': 2, 'rate': .5}) + >>> box10, = unit.duplicate(default={'factor': 10, 'rate': .1}) >>> template = ProductTemplate() >>> template.name = 'Product' @@ -96,8 +98,8 @@ Fill warehouse:: >>> move.product = product >>> move.from_location = storage_loc >>> move.to_location = customer_loc - >>> move.unit = unit - >>> move.quantity = 2 + >>> move.unit = box2 + >>> move.quantity = 1 >>> move.effective_date = dt.date(2025, 1, 10) >>> move.unit_price = Decimal('20.0000') >>> move.currency = currency @@ -111,7 +113,8 @@ Forecast some moves:: >>> move.product = product >>> move.from_location = supplier_loc >>> move.to_location = storage_loc - >>> move.quantity = 10 + >>> move.unit = box10 + >>> move.quantity = 1 >>> move.effective_date = dt.date(2025, 1, 5) >>> move.unit_price = Decimal('10.0000') >>> move.currency = currency diff --git a/modules/stock/tryton.cfg b/modules/stock/tryton.cfg index 29a2c53340..9f16a490c3 100644 --- a/modules/stock/tryton.cfg +++ b/modules/stock/tryton.cfg @@ -1,5 +1,5 @@ [tryton] -version=8.0.5 +version=8.0.6 depends: company currency diff --git a/modules/stock_package_shipping_dpd/CHANGELOG b/modules/stock_package_shipping_dpd/CHANGELOG index 76dff022df..6d89e5b5b2 100644 --- a/modules/stock_package_shipping_dpd/CHANGELOG +++ b/modules/stock_package_shipping_dpd/CHANGELOG @@ -1,4 +1,9 @@ +Version 8.0.1 - 2026-10-15 +-------------------------- +* Bug fixes (see mercurial logs for details) + + Version 8.0.0 - 2026-04-20 -------------------------- * Bug fixes (see mercurial logs for details) diff --git a/modules/stock_package_shipping_dpd/stock.py b/modules/stock_package_shipping_dpd/stock.py index 952f02632d..22965c0b1d 100644 --- a/modules/stock_package_shipping_dpd/stock.py +++ b/modules/stock_package_shipping_dpd/stock.py @@ -281,10 +281,18 @@ class CreateDPDShipping(Wizard): cm3 = UoM(ModelData.get_id('product', 'uom_cubic_centimeter')) kg = UoM(ModelData.get_id('product', 'uom_kilogram')) + volume = sum( + UoM.compute_qty( + p.volume_uom, p.total_volume, shipment.volume_uom, round=False) + for p in shipment.root_packages) volume = round(UoM.compute_qty( - shipment.volume_uom, shipment.volume, cm3, round=False)) + shipment.volume_uom, volume, cm3, round=False)) + weight = sum( + UoM.compute_qty( + p.weight_uom, p.total_weight, shipment.weight_uom, round=False) + for p in shipment.root_packages) weight = round(UoM.compute_qty( - shipment.weight_uom, shipment.weight, kg, round=False), 2) + shipment.weight_uom, weight, kg, round=False), 2) return { 'generalShipmentData': { 'identificationNumber': shipment.number, diff --git a/modules/stock_package_shipping_dpd/tests/scenario_shipping_dpd.rst b/modules/stock_package_shipping_dpd/tests/scenario_shipping_dpd.rst index e008fb2483..3f812b792d 100644 --- a/modules/stock_package_shipping_dpd/tests/scenario_shipping_dpd.rst +++ b/modules/stock_package_shipping_dpd/tests/scenario_shipping_dpd.rst @@ -136,7 +136,9 @@ Create Package Type:: ... name='Box', ... length=10, length_uom=cm, ... height=8, height_uom=cm, - ... width=5, width_uom=cm) + ... width=5, width_uom=cm, + ... packaging_weight=50, + ... packaging_weight_uom=g) >>> box.save() Create a DPD Carrier and the related credential:: diff --git a/modules/stock_package_shipping_dpd/tryton.cfg b/modules/stock_package_shipping_dpd/tryton.cfg index 453b443eb2..a4b4bf7346 100644 --- a/modules/stock_package_shipping_dpd/tryton.cfg +++ b/modules/stock_package_shipping_dpd/tryton.cfg @@ -1,5 +1,5 @@ [tryton] -version=8.0.1 +version=8.0.2 depends: ir res diff --git a/sao/CHANGELOG b/sao/CHANGELOG index 437d2a8a1d..025ed27508 100644 --- a/sao/CHANGELOG +++ b/sao/CHANGELOG @@ -1,4 +1,9 @@ +Version 8.0.13 - 2026-10-15 +--------------------------- +* Bug fixes (see mercurial logs for details) + + Version 8.0.12 - 2026-10-01 --------------------------- * Bug fixes (see mercurial logs for details) diff --git a/sao/package.json b/sao/package.json index d09d3f9951..31c22415c2 100644 --- a/sao/package.json +++ b/sao/package.json @@ -2,7 +2,7 @@ "name": "tryton-sao", "title": "sao", "description": "Tryton webclient", - "version": "8.0.13", + "version": "8.0.14", "homepage": "https://www.tryton.org/", "author": { "name": "Tryton" diff --git a/sao/src/common.js b/sao/src/common.js index d13fa456b4..5b9ed7167d 100644 --- a/sao/src/common.js +++ b/sao/src/common.js @@ -89,13 +89,16 @@ function getScrollableAncestors(el) { let ancestors = []; let parent = el.parentElement; - while (parent && parent !== document.body) { + while (parent && (parent !== document.body || + !parent.classList.contains('modal'))) { if (isScrollable(parent)) { ancestors.push(parent); } parent = parent.parentElement; } - ancestors.push(window); + if (parent && !parent.classList.contains('modal')) { + ancestors.push(window); + } return ancestors; } @@ -2978,9 +2981,13 @@ return ((a.isDate == b.isDate) && (a.isDateTime == b.isDateTime) && (a.valueOf() == b.valueOf())); - } else if ((a instanceof Number) || (b instanceof Number)) { - return (Number(a) === Number(b)); } else { + if (a instanceof Number) { + a = a.valueOf(); + } + if (b instanceof Number) { + b = b.valueOf(); + } return (a === b); } }; diff --git a/sao/src/sao.js b/sao/src/sao.js index 87cae8b1c3..627e7109f8 100644 --- a/sao/src/sao.js +++ b/sao/src/sao.js @@ -3,7 +3,7 @@ /* eslint-disable no-redeclare */ var Sao = { - __version__: '8.0.13', + __version__: '8.0.14', }; /* eslint-enable no-redeclare */ diff --git a/sao/src/view/tree.js b/sao/src/view/tree.js index 46b89459db..d4be458fd5 100644 --- a/sao/src/view/tree.js +++ b/sao/src/view/tree.js @@ -1102,11 +1102,13 @@ width = column.col.data('default-width'); } if (width && width.endsWith('%')) { - width = parseInt(width.slice(0, -1), 10) / 100; + // Reverse the calculation from _set_column_width + let factor = 1; if (column.attributes.expand) { - width /= parseInt(column.attributes.expand, 10); + factor += parseInt(column.attributes.expand, 10); } - width = `${width}em`; + width = parseInt(width.slice(0, -1), 10); + width = `${width / 100 / factor}em`; } min_width.push(width); column.col.sao_show(); diff --git a/sao/tests/sao.js b/sao/tests/sao.js index 84e32c0217..18d07b4e22 100644 --- a/sao/tests/sao.js +++ b/sao/tests/sao.js @@ -2969,6 +2969,44 @@ var now = new Date(); [ + [[['x', '=', 42]], {'x': 42}, true], + [[['x', '=', 42]], {'x': new Number(42)}, true], + [[['x', '=', 42]], {'x': 0}, false], + [[['x', '=', 42]], {'x': new Number(0)}, false], + [[['x', '=', 42]], {'x': null}, false], + [[['x', '=', new Number(42)]], {'x': 42}, true], + [[['x', '=', new Number(42)]], {'x': new Number(42)}, true], + [[['x', '=', new Number(42)]], {'x': 0}, false], + [[['x', '=', new Number(42)]], {'x': new Number(0)}, false], + [[['x', '=', new Number(42)]], {'x': null}, false], + [[['x', '=', 0]], {'x': 0}, true], + [[['x', '=', 0]], {'x': new Number(0)}, true], + [[['x', '=', 0]], {'x': null}, false], + [[['x', '=', new Number(0)]], {'x': 0}, true], + [[['x', '=', new Number(0)]], {'x': new Number(0)}, true], + [[['x', '=', new Number(0)]], {'x': null}, false], + [[['x', '=', null]], {'x': 0}, false], + [[['x', '=', null]], {'x': new Number(0)}, false], + [[['x', '=', null]], {'x': null}, true], + [[['x', '!=', 42]], {'x': 42}, false], + [[['x', '!=', 42]], {'x': new Number(42)}, false], + [[['x', '!=', 42]], {'x': 0}, true], + [[['x', '!=', 42]], {'x': new Number(0)}, true], + [[['x', '!=', 42]], {'x': null}, true], + [[['x', '!=', new Number(42)]], {'x': 42}, false], + [[['x', '!=', new Number(42)]], {'x': new Number(42)}, false], + [[['x', '!=', new Number(42)]], {'x': 0}, true], + [[['x', '!=', new Number(42)]], {'x': new Number(0)}, true], + [[['x', '!=', new Number(42)]], {'x': null}, true], + [[['x', '!=', 0]], {'x': 0}, false], + [[['x', '!=', 0]], {'x': new Number(0)}, false], + [[['x', '!=', 0]], {'x': null}, true], + [[['x', '!=', new Number(0)]], {'x': 0}, false], + [[['x', '!=', new Number(0)]], {'x': new Number(0)}, false], + [[['x', '!=', new Number(0)]], {'x': null}, true], + [[['x', '!=', null]], {'x': 0}, true], + [[['x', '!=', null]], {'x': new Number(0)}, true], + [[['x', '!=', null]], {'x': null}, false], [[['x', '>', 5]], {'x': 6}, true], [[['x', '>', 5]], {'x': 4}, false], [[['x', '>', null]], {'x': today}, false], diff --git a/trytond/CHANGELOG b/trytond/CHANGELOG index 7f2a4dba6f..b86d14f68b 100644 --- a/trytond/CHANGELOG +++ b/trytond/CHANGELOG @@ -1,4 +1,9 @@ +Version 8.0.12 - 2026-10-15 +--------------------------- +* Bug fixes (see mercurial logs for details) + + Version 8.0.11 - 2026-10-01 --------------------------- * Bug fixes (see mercurial logs for details) diff --git a/trytond/trytond/__init__.py b/trytond/trytond/__init__.py index 58272173f8..4bf47f7c16 100644 --- a/trytond/trytond/__init__.py +++ b/trytond/trytond/__init__.py @@ -14,7 +14,7 @@ from lxml import etree, objectify from ._safe_genshi import genshi_patch -__version__ = "8.0.12" +__version__ = "8.0.13" __series__ = '.'.join(__version__.split('.')[:2]) if not os.environ.get('TRYTOND_APPNAME'): diff --git a/trytond/trytond/application.py b/trytond/trytond/application.py index 0001fada77..eed9e7101e 100644 --- a/trytond/trytond/application.py +++ b/trytond/trytond/application.py @@ -46,4 +46,7 @@ if db_names: for thread in threads: thread.join() -assert len(threads := threading.enumerate()) == 1, f"len({threads}) != 1" +if len(threads := threading.enumerate()) != 1: + raise RuntimeError( + f"There are {len(threads)} threads running after initializing" + " the Pool") diff --git a/trytond/trytond/cache.py b/trytond/trytond/cache.py index b896690699..b00e682b9f 100644 --- a/trytond/trytond/cache.py +++ b/trytond/trytond/cache.py @@ -256,6 +256,8 @@ class MemoryCache(BaseCache): @classmethod def sync(cls, transaction): + if not Pool().ready: + return if cls._clean_last is None: cls._clean_last = dt.datetime.now() return @@ -298,7 +300,7 @@ class MemoryCache(BaseCache): cls._clean_last = dt.datetime.now() def sync_since(self, value): - return self._clean_last > value + return self._clean_last is not None and self._clean_last > value @classmethod def commit(cls, transaction): diff --git a/trytond/trytond/config.py b/trytond/trytond/config.py index d8347f8c94..08d14d24b5 100644 --- a/trytond/trytond/config.py +++ b/trytond/trytond/config.py @@ -104,7 +104,7 @@ class TrytonConfigParser(configparser.ConfigParser): self.add_section('bus') self.set('bus', 'allow_subscribe', 'False') self.set('bus', 'long_polling_timeout', str(5 * 60)) - self.set('bus', 'cache_timeout', '5') + self.set('bus', 'cache_timeout', str(5 * 60)) self.set('bus', 'select_timeout', '5') self.add_section('report') self.add_section('html') diff --git a/trytond/trytond/ir/action.py b/trytond/trytond/ir/action.py index 6ed796b8f7..dd2035210c 100644 --- a/trytond/trytond/ir/action.py +++ b/trytond/trytond/ir/action.py @@ -345,7 +345,11 @@ class ActionMixin(ModelSQL): action = fields.Many2One( 'ir.action', "Action", - required=True, readonly=True, ondelete='CASCADE') + required=True, ondelete='CASCADE', + states={ + 'required': Eval('id', -1) >= 0, + 'readonly': Eval('id', -1) >= 0, + }) @classmethod def __setup__(cls): @@ -456,8 +460,9 @@ class ActionMixin(ModelSQL): values = values.copy() for field in values: if field in Action._fields: - action_values[field] = values[field] - if hasattr(getattr(cls, field), 'set'): + if field != 'action': + action_values[field] = values[field] + elif hasattr(getattr(cls, field), 'set'): later[field] = values[field] for field in later: del values[field] @@ -468,7 +473,7 @@ class ActionMixin(ModelSQL): if database.nextid(transaction.connection, cls._table): database.setnextid(transaction.connection, cls._table, database.currid(transaction.connection, Action._table)) - if 'action' not in values: + if not values.get('action'): action, = Action.create([action_values]) values['action'] = action.id else: diff --git a/trytond/trytond/report/report.py b/trytond/trytond/report/report.py index 2d77b07a7a..a44ae6abcf 100644 --- a/trytond/trytond/report/report.py +++ b/trytond/trytond/report/report.py @@ -464,7 +464,7 @@ class Report(URLMixin, PoolBase): time.sleep(0.02 * (retry - count)) try: subprocess.run(args, timeout=timeout, check=True) - except subprocess.CalledProcessError: + except (subprocess.SubprocessError, OSError): if count: continue logger.error( diff --git a/trytond/trytond/tests/test_tools.py b/trytond/trytond/tests/test_tools.py index cb01d82410..3af49cf8b5 100644 --- a/trytond/trytond/tests/test_tools.py +++ b/trytond/trytond/tests/test_tools.py @@ -884,6 +884,63 @@ class DomainInversionTestCase(TestCase): unique_value(domain, single_value=False), (False, None, None)) def test_evaldomain(self): + + domain = [['x', '=', 42]] + self.assertTrue(eval_domain(domain, {'x': 42})) + self.assertTrue(eval_domain(domain, {'x': Decimal('42')})) + self.assertFalse(eval_domain(domain, {'x': 0})) + self.assertFalse(eval_domain(domain, {'x': Decimal('0')})) + self.assertFalse(eval_domain(domain, {'x': None})) + + domain = [['x', '=', Decimal('42')]] + self.assertTrue(eval_domain(domain, {'x': 42})) + self.assertTrue(eval_domain(domain, {'x': Decimal('42')})) + self.assertFalse(eval_domain(domain, {'x': 0})) + self.assertFalse(eval_domain(domain, {'x': Decimal('0')})) + self.assertFalse(eval_domain(domain, {'x': None})) + + domain = [['x', '=', 0]] + self.assertTrue(eval_domain(domain, {'x': 0})) + self.assertTrue(eval_domain(domain, {'x': Decimal('0')})) + self.assertFalse(eval_domain(domain, {'x': None})) + + domain = [['x', '=', Decimal('0')]] + self.assertTrue(eval_domain(domain, {'x': 0})) + self.assertTrue(eval_domain(domain, {'x': Decimal('0')})) + self.assertFalse(eval_domain(domain, {'x': None})) + + domain = [['x', '=', None]] + self.assertFalse(eval_domain(domain, {'x': 0})) + self.assertFalse(eval_domain(domain, {'x': Decimal('0')})) + self.assertTrue(eval_domain(domain, {'x': None})) + + domain = [['x', '!=', 42]] + self.assertFalse(eval_domain(domain, {'x': 42})) + self.assertFalse(eval_domain(domain, {'x': Decimal('42')})) + self.assertTrue(eval_domain(domain, {'x': Decimal('0')})) + self.assertTrue(eval_domain(domain, {'x': None})) + + domain = [['x', '!=', Decimal('42')]] + self.assertFalse(eval_domain(domain, {'x': 42})) + self.assertFalse(eval_domain(domain, {'x': Decimal('42')})) + self.assertTrue(eval_domain(domain, {'x': Decimal('0')})) + self.assertTrue(eval_domain(domain, {'x': None})) + + domain = [['x', '!=', 0]] + self.assertFalse(eval_domain(domain, {'x': 0})) + self.assertFalse(eval_domain(domain, {'x': Decimal('0')})) + self.assertTrue(eval_domain(domain, {'x': None})) + + domain = [['x', '!=', Decimal('0')]] + self.assertFalse(eval_domain(domain, {'x': 0})) + self.assertFalse(eval_domain(domain, {'x': Decimal('0')})) + self.assertTrue(eval_domain(domain, {'x': None})) + + domain = [['x', '!=', None]] + self.assertTrue(eval_domain(domain, {'x': 0})) + self.assertTrue(eval_domain(domain, {'x': Decimal('0')})) + self.assertFalse(eval_domain(domain, {'x': None})) + domain = [['x', '>', 5]] self.assertTrue(eval_domain(domain, {'x': 6})) self.assertFalse(eval_domain(domain, {'x': 4}))