Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[16.0][MIG] account_banking_ach_base #97

Open
wants to merge 20 commits into
base: 16.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 86 additions & 0 deletions account_banking_ach_base/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
=====================================================
Localizations for North American Banking & Financials
=====================================================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fl10n--usa-lightgray.png?logo=github
:target: https://github.com/OCA/l10n-usa/tree/14.0/account_banking_ach_base
:alt: OCA/l10n-usa
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/l10n-usa-14-0/l10n-usa-14-0-account_banking_ach_base
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/203/14.0
:alt: Try me on Runbot

|badge1| |badge2| |badge3| |badge4| |badge5|

Add fields to Bank, Partner and Company required for ACH transactions in USA.

**Table of contents**

.. contents::
:local:

Usage
=====

Add `routing_number` on Bank records.

Add Legal ID on Partner and Company records.

Add Mandate URL field to Company record. Use in email templates to provide customer with an easy
way to access your Mandate Authorization form to streamline ACH authorizations.

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/l10n-usa/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/l10n-usa/issues/new?body=module:%20account_banking_ach_base%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
~~~~~~~

* Thinkwell Designs

Contributors
~~~~~~~~~~~~

* Dave Burkholder <[email protected]>
* Maxime Chambreuil <[email protected]>
* Serpent Consulting Services Pvt. Ltd. <[email protected]>
* Murtaza Mithaiwala <[email protected]>

Maintainers
~~~~~~~~~~~

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

This module is part of the `OCA/l10n-usa <https://github.com/OCA/l10n-usa/tree/14.0/account_banking_ach_base>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
3 changes: 3 additions & 0 deletions account_banking_ach_base/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from . import models
25 changes: 25 additions & 0 deletions account_banking_ach_base/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright 2018 Thinkwell Designs <[email protected]>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

{
"name": "Localizations for North American Banking & Financials",
"summary": "Add fields required for North American Banking & Financials",
"version": "16.0.1.0.1",
"license": "AGPL-3",
"author": "Thinkwell Designs, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/l10n-usa",
"category": "Banking addons",
"depends": [
"account_payment_order",
"account_banking_mandate",
"l10n_us_partner_legal_number",
],
"data": [
"views/account_banking_mandate.xml",
"views/account_move.xml",
"views/res_bank.xml",
"views/res_company.xml",
],
"external_dependencies": {"python": ["python-stdnum", "ach"]},
"installable": True,
}
194 changes: 194 additions & 0 deletions account_banking_ach_base/i18n/account_banking_ach_base.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,194 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_banking_ach_base
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: account_banking_ach_base
#: code:addons/account_banking_ach_base/models/account_payment_order.py:0
#, python-format
msgid "%s account number has no Bank assigned"
msgstr ""

#. module: account_banking_ach_base
#: code:addons/account_banking_ach_base/models/account_payment_order.py:0
#, python-format
msgid "%s does not have a Routing Number assigned!"
msgstr ""

#. module: account_banking_ach_base
#: code:addons/account_banking_ach_base/models/account_payment_order.py:0
#, python-format
msgid "%s does not have an EIN / SSN / BN assigned!"
msgstr ""

#. module: account_banking_ach_base
#: code:addons/account_banking_ach_base/models/account_payment_order.py:0
#, python-format
msgid "%s has no routing number specified"
msgstr ""

#. module: account_banking_ach_base
#: code:addons/account_banking_ach_base/models/res_bank.py:0
#, python-format
msgid "%s is not a valid Canadian routing number!"
msgstr ""

#. module: account_banking_ach_base
#: code:addons/account_banking_ach_base/models/res_bank.py:0
#, python-format
msgid "%s is not a valid US routing number!"
msgstr ""

#. module: account_banking_ach_base
#: model:ir.model,name:account_banking_ach_base.model_account_banking_mandate
msgid "A generic banking mandate"
msgstr ""

#. module: account_banking_ach_base
#: model:ir.model,name:account_banking_ach_base.model_res_bank
msgid "Bank"
msgstr ""

#. module: account_banking_ach_base
#: model:ir.model,name:account_banking_ach_base.model_res_company
msgid "Companies"
msgstr ""

#. module: account_banking_ach_base
#: model:ir.model.fields,field_description:account_banking_ach_base.field_account_banking_mandate__delay_days
msgid "Delay Days"
msgstr ""

#. module: account_banking_ach_base
#: code:addons/account_banking_ach_base/models/account_banking_mandate.py:0
#, python-format
msgid "Delay days must be specified, and greater than 0."
msgstr ""

#. module: account_banking_ach_base
#: model:ir.model.fields,field_description:account_banking_ach_base.field_account_banking_mandate__display_name
#: model:ir.model.fields,field_description:account_banking_ach_base.field_account_move__display_name
#: model:ir.model.fields,field_description:account_banking_ach_base.field_account_payment_order__display_name
#: model:ir.model.fields,field_description:account_banking_ach_base.field_res_bank__display_name
#: model:ir.model.fields,field_description:account_banking_ach_base.field_res_company__display_name
msgid "Display Name"
msgstr ""

#. module: account_banking_ach_base
#: model_terms:ir.ui.view,arch_db:account_banking_ach_base.view_company_legal_id_number
msgid "EIN / SSN / BN"
msgstr ""

#. module: account_banking_ach_base
#: model:ir.model.fields,help:account_banking_ach_base.field_res_company__legal_id_number
msgid ""
"For US entities, enter valid EIN or Social Security Number.\n"
" Canadian entities, enter Canadian Business Number.\n"
" "
msgstr ""

#. module: account_banking_ach_base
#: model:ir.model.fields,help:account_banking_ach_base.field_res_company__mandate_url
msgid ""
"Full URL to download ACH Mandate /\n"
" Authorization form. Useful to include in email\n"
" templates for customer to access and\n"
" complete the Mandate form."
msgstr ""

#. module: account_banking_ach_base
#: model:ir.model.fields,field_description:account_banking_ach_base.field_account_banking_mandate__id
#: model:ir.model.fields,field_description:account_banking_ach_base.field_account_move__id
#: model:ir.model.fields,field_description:account_banking_ach_base.field_account_payment_order__id
#: model:ir.model.fields,field_description:account_banking_ach_base.field_res_bank__id
#: model:ir.model.fields,field_description:account_banking_ach_base.field_res_company__id
msgid "ID"
msgstr ""

#. module: account_banking_ach_base
#: model:ir.model,name:account_banking_ach_base.model_account_move
msgid "Journal Entry"
msgstr ""

#. module: account_banking_ach_base
#: model:ir.model.fields,field_description:account_banking_ach_base.field_account_banking_mandate____last_update
#: model:ir.model.fields,field_description:account_banking_ach_base.field_account_move____last_update
#: model:ir.model.fields,field_description:account_banking_ach_base.field_account_payment_order____last_update
#: model:ir.model.fields,field_description:account_banking_ach_base.field_res_bank____last_update
#: model:ir.model.fields,field_description:account_banking_ach_base.field_res_company____last_update
msgid "Last Modified on"
msgstr ""

#. module: account_banking_ach_base
#: model:ir.model.fields,field_description:account_banking_ach_base.field_res_company__legal_id_number
msgid "Legal ID"
msgstr ""

#. module: account_banking_ach_base
#: model:ir.model.fields,field_description:account_banking_ach_base.field_res_company__mandate_url
msgid "Mandate URL"
msgstr ""

#. module: account_banking_ach_base
#: code:addons/account_banking_ach_base/models/account_payment_order.py:0
#, python-format
msgid ""
"Missing ACH Direct Debit mandate on the bank payment line with partner '%s' "
"(reference '%s')."
msgstr ""

#. module: account_banking_ach_base
#: model:ir.model.fields,help:account_banking_ach_base.field_account_banking_mandate__delay_days
msgid ""
"Number of days to wait after invoice\n"
" date before including an invoice in Payment\n"
" Order for processing."
msgstr ""

#. module: account_banking_ach_base
#: model:ir.model,name:account_banking_ach_base.model_account_payment_order
msgid "Payment Order"
msgstr ""

#. module: account_banking_ach_base
#: model_terms:ir.ui.view,arch_db:account_banking_ach_base.view_account_invoice_filter_valid_mandate_id
msgid "Ready for Payment Order"
msgstr ""

#. module: account_banking_ach_base
#: model:ir.model.fields,field_description:account_banking_ach_base.field_res_bank__routing_number
msgid "Routing Number"
msgstr ""

#. module: account_banking_ach_base
#: code:addons/account_banking_ach_base/models/account_payment_order.py:0
#, python-format
msgid ""
"The ACH Direct Debit mandate with reference '%s' for partner '%s' has "
"expired."
msgstr ""

#. module: account_banking_ach_base
#: code:addons/account_banking_ach_base/models/account_payment_order.py:0
#, python-format
msgid ""
"The mandate with reference '%s' for partner '%s' has type set to 'One-Off' "
"and it has a last debit date set to '%s', so we can't use it."
msgstr ""

#. module: account_banking_ach_base
#: code:addons/account_banking_ach_base/models/account_move.py:0
#, python-format
msgid ""
"To satisfy payment mandate, cannot add invoice %s to Debit Order until %s!"
msgstr ""
8 changes: 8 additions & 0 deletions account_banking_ach_base/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from . import account_banking_mandate
from . import account_move
from . import account_payment_order
from . import res_bank
from . import res_company
from . import account_payment_method
62 changes: 62 additions & 0 deletions account_banking_ach_base/models/account_banking_mandate.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
from odoo import _, api, fields, models
from odoo.exceptions import UserError


class AccountBankingMandate(models.Model):
_inherit = "account.banking.mandate"

delay_days = fields.Integer(
required=True,
default=10,
help="""Number of days to wait after invoice
date before including an invoice in Payment
Order for processing.""",
)

def validate(self):
for mandate in self:
if not mandate.delay_days:
raise UserError(
_("""Delay days must be specified, and greater than 0.""")
)
return super(AccountBankingMandate, self).validate()

def set_payment_modes_on_partner(self):
"""
Set the payment modes on the Partner if they don't already exist.
"""
payment_modes = {}
if (
self.partner_id.customer_rank
and not self.partner_id.customer_payment_mode_id
):
customer_mode = self.env["account.payment.mode"].search(
[
("payment_type", "=", "inbound"),
("company_id", "=", self.company_id.id),
],
limit=1,
)
if customer_mode:
payment_modes["customer_payment_mode_id"] = customer_mode.id
if (
self.partner_id.supplier_rank
and not self.partner_id.supplier_payment_mode_id
):
supplier_mode = self.env["account.payment.mode"].search(
[
("payment_type", "=", "outbound"),
("company_id", "=", self.company_id.id),
],
limit=1,
)
if supplier_mode:
payment_modes["supplier_payment_mode_id"] = supplier_mode.id
if payment_modes:
self.partner_id.write(payment_modes)

@api.model
def create(self, vals):
mandate = super(AccountBankingMandate, self).create(vals)
mandate.set_payment_modes_on_partner()
return mandate
Loading
Loading