diff --git a/account_banking_ach_direct_debit/__manifest__.py b/account_banking_ach_direct_debit/__manifest__.py index f6c04cf0..fc99d17f 100644 --- a/account_banking_ach_direct_debit/__manifest__.py +++ b/account_banking_ach_direct_debit/__manifest__.py @@ -4,7 +4,7 @@ { "name": "Account Banking ACH Direct Debit", "summary": "Create ACH files for Direct Debit", - "version": "14.0.1.0.0", + "version": "15.0.1.0.0", "license": "AGPL-3", "author": "Thinkwell Designs, Odoo Community Association (OCA)", "website": "https://github.com/OCA/l10n-usa", diff --git a/account_banking_ach_direct_debit/models/account_banking_mandate.py b/account_banking_ach_direct_debit/models/account_banking_mandate.py index 8a2dcae6..3583ef64 100644 --- a/account_banking_ach_direct_debit/models/account_banking_mandate.py +++ b/account_banking_ach_direct_debit/models/account_banking_mandate.py @@ -37,7 +37,6 @@ class AccountBankingMandate(models.Model): ) scheme = fields.Selection( [("CORE", "Basic (CORE)"), ("B2B", "Enterprise (B2B)")], - string="Scheme", default="CORE", tracking=True, ) @@ -49,8 +48,8 @@ def _check_recurring_type(self): for mandate in self: if mandate.type == "recurrent" and not mandate.recurrent_sequence_type: raise exceptions.ValidationError( - _("The recurrent mandate '%s' must have a sequence type.") - % mandate.unique_mandate_reference + _("The recurrent mandate '%(mandate)s' must have a sequence type.") + % {"mandate": mandate.unique_mandate_reference} ) @api.depends("unique_mandate_reference", "recurrent_sequence_type") @@ -108,8 +107,9 @@ def _achdd_mandate_set_state_to_expired(self): logger.info( _( "The following ACH Mandate IDs have been set to " - "expired: %s" % expired_mandates.ids + "expired: %(mandate)s" ) + % {"mandate": expired_mandates.ids} ) else: logger.info(_("0 ACH Mandates had to be set to Expired")) diff --git a/account_banking_ach_direct_debit/models/account_payment_order.py b/account_banking_ach_direct_debit/models/account_payment_order.py index 6ffee9a9..078e63a6 100644 --- a/account_banking_ach_direct_debit/models/account_payment_order.py +++ b/account_banking_ach_direct_debit/models/account_payment_order.py @@ -30,18 +30,18 @@ def generated2uploaded(self): mandate = self.env["account.banking.mandate"] for order in self: to_expire_mandates = first_mandates = all_mandates = mandate - for bank_line in order.bank_line_ids: - if bank_line.mandate_id in all_mandates: + for payment in order.payment_line_ids: + if payment.mandate_id in all_mandates: continue - all_mandates += bank_line.mandate_id - if bank_line.mandate_id.type == "oneoff": - to_expire_mandates += bank_line.mandate_id - elif bank_line.mandate_id.type == "recurrent": - seq_type = bank_line.mandate_id.recurrent_sequence_type + all_mandates += payment.mandate_id + if payment.mandate_id.type == "oneoff": + to_expire_mandates += payment.mandate_id + elif payment.mandate_id.type == "recurrent": + seq_type = payment.mandate_id.recurrent_sequence_type if seq_type == "final": - to_expire_mandates += bank_line.mandate_id + to_expire_mandates += payment.mandate_id elif seq_type == "first": - first_mandates += bank_line.mandate_id + first_mandates += payment.mandate_id all_mandates.write({"last_debit_date": order.date_generated}) to_expire_mandates.write({"state": "expired"}) first_mandates.write({"recurrent_sequence_type": "recurring"}) @@ -51,8 +51,8 @@ def generated2uploaded(self): "Automatically switched from First to " "Recurring when the debit order " "%s has been marked as uploaded." + "data-oe-id=%(order_id)d>%(name)s has been marked as uploaded." ) - % (order.id, order.name) + % {"order_id": order.id, "name": order.name} ) return res diff --git a/account_banking_ach_direct_debit/post_install.py b/account_banking_ach_direct_debit/post_install.py index 6a12e5a1..179c2895 100644 --- a/account_banking_ach_direct_debit/post_install.py +++ b/account_banking_ach_direct_debit/post_install.py @@ -4,13 +4,12 @@ def update_bank_journals(cr, registry): - with api.Environment.manage(): - env = api.Environment(cr, SUPERUSER_ID, {}) - journals = env["account.journal"].search([("type", "=", "bank")]) - ach_dd = env.ref( - "account_banking_ach_direct_debit.ach_direct_debit", - raise_if_not_found=False, - ) - if ach_dd: - journals.write({"inbound_payment_method_ids": [(4, ach_dd.id)]}) + env = api.Environment(cr, SUPERUSER_ID, {}) + journals = env["account.journal"].search([("type", "=", "bank")]) + ach_dd = env.ref( + "account_banking_ach_direct_debit.ach_direct_debit", + raise_if_not_found=False, + ) + if ach_dd: + journals.write({"inbound_payment_method_line_ids": [(4, ach_dd.id)]}) return diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 00000000..4ba182b6 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,3 @@ +# generated from manifests external_dependencies +carta-ach +python-stdnum diff --git a/setup/account_banking_ach_direct_debit/odoo/addons/account_banking_ach_direct_debit b/setup/account_banking_ach_direct_debit/odoo/addons/account_banking_ach_direct_debit new file mode 120000 index 00000000..2475da49 --- /dev/null +++ b/setup/account_banking_ach_direct_debit/odoo/addons/account_banking_ach_direct_debit @@ -0,0 +1 @@ +../../../../account_banking_ach_direct_debit \ No newline at end of file diff --git a/setup/account_banking_ach_direct_debit/setup.py b/setup/account_banking_ach_direct_debit/setup.py new file mode 100644 index 00000000..28c57bb6 --- /dev/null +++ b/setup/account_banking_ach_direct_debit/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)