Cédric Krier pushed to branch branch/default at Tryton / Tryton
Commits: 781b3cf9 by Maxime Richez at 2023-02-20T16:56:51+01:00 Add history on party tax identifier Closes #12095 - - - - - 4 changed files: - modules/account_invoice_history/CHANGELOG - modules/account_invoice_history/__init__.py - modules/account_invoice_history/account.py - modules/account_invoice_history/party.py Changes: ===================================== modules/account_invoice_history/CHANGELOG ===================================== @@ -1,3 +1,5 @@ +* Add history on party tax identifier + Version 6.6.0 - 2022-10-31 -------------------------- * Bug fixes (see mercurial logs for details) ===================================== modules/account_invoice_history/__init__.py ===================================== @@ -10,6 +10,7 @@ Pool.register( party.Party, party.Address, + party.Identifier, account.Invoice, account_invoice.PaymentTerm, account_invoice.PaymentTermLine, ===================================== modules/account_invoice_history/account.py ===================================== @@ -37,6 +37,7 @@ super(Invoice, cls).__setup__() cls._check_modify_exclude.add('numbered_at') cls.party.datetime_field = 'history_datetime' + cls.party_tax_identifier.datetime_field = 'history_datetime' cls.invoice_address.datetime_field = 'history_datetime' cls.payment_term.datetime_field = 'history_datetime' @@ -45,7 +46,8 @@ pool = Pool() Party = pool.get('party.party') Address = pool.get('party.address') + Identifier = pool.get('party.identifier') PaymentTerm = pool.get('account.invoice.payment_term') table = cls.__table__() party = Party.__table__() address = Address.__table__() @@ -48,7 +50,8 @@ PaymentTerm = pool.get('account.invoice.payment_term') table = cls.__table__() party = Party.__table__() address = Address.__table__() + identifier = Identifier.__table__() payment_term = PaymentTerm.__table__() cursor = Transaction().connection.cursor() @@ -58,7 +61,9 @@ cursor.execute(*table .join(party, condition=table.party == party.id) .join(address, condition=table.invoice_address == address.id) + .join(identifier, 'LEFT', + condition=table.party_tax_identifier == identifier.id) .join(payment_term, 'LEFT', condition=table.payment_term == payment_term.id) .select(table.id, Greatest(table.numbered_at, party.create_date, @@ -61,8 +66,9 @@ .join(payment_term, 'LEFT', condition=table.payment_term == payment_term.id) .select(table.id, Greatest(table.numbered_at, party.create_date, - address.create_date, payment_term.create_date), + address.create_date, identifier.create_date, + payment_term.create_date), where=reduce_ids(table.id, ids) & (table.numbered_at != Null) & (table.state.in_(cls._history_states())))) ===================================== modules/account_invoice_history/party.py ===================================== @@ -11,3 +11,8 @@ class Address(metaclass=PoolMeta): __name__ = 'party.address' _history = True + + +class Identifier(metaclass=PoolMeta): + __name__ = 'party.identifier' + _history = True View it on Heptapod: https://foss.heptapod.net/tryton/tryton/-/commit/781b3cf9f9d95393a87ced34ec1203075e598405 -- View it on Heptapod: https://foss.heptapod.net/tryton/tryton/-/commit/781b3cf9f9d95393a87ced34ec1203075e598405 You're receiving this email because of your account on foss.heptapod.net.