Skip to content

Commit

Permalink
Merge PR #136 into 17.0
Browse files Browse the repository at this point in the history
Signed-off-by max3903
  • Loading branch information
OCA-git-bot committed Nov 29, 2024
2 parents 94ad9ca + 18f5f07 commit dcfe638
Show file tree
Hide file tree
Showing 15 changed files with 661 additions and 0 deletions.
84 changes: 84 additions & 0 deletions l10n_us_partner_legal_number/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
========================================================
Add Legal Number for North American Banking & Financials
========================================================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:0c77630412fcc3a3857fb1f6000d4dd0d5cfe95137c5068be138701cf02689ec
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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/17.0/l10n_us_partner_legal_number
: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-17-0/l10n-usa-17-0-l10n_us_partner_legal_number
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/l10n-usa&target_branch=17.0
:alt: Try me on Runboat

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

Add Legal Number for North American Banking & Financials

**Table of contents**

.. contents::
:local:

Usage
=====

Add Legal Number Field

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 to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/l10n-usa/issues/new?body=module:%20l10n_us_partner_legal_number%0Aversion:%2017.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
-------

* Open Source Integrators

Contributors
------------

- Chankya Soni <csoni@opensourceintegrators.com>
- Maxime Chambreuil <mchambreuil@opensourceintegrators.com>
- Serpent Consulting Services Pvt. Ltd. <support@serpentcs.com>
- Levent Karakas <leventk@eska.biz>

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/17.0/l10n_us_partner_legal_number>`_ 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 l10n_us_partner_legal_number/__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
16 changes: 16 additions & 0 deletions l10n_us_partner_legal_number/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright 2021 Open Source Integrators <csoni@opensourceintegrators.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

{
"name": "Add Legal Number for North American Banking & Financials",
"summary": "Add Legal Number for North American Banking & Financials",
"version": "17.0.1.0.0",
"license": "AGPL-3",
"author": "Open Source Integrators, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/l10n-usa",
"category": "Banking addons",
"depends": ["account"],
"data": ["views/res_partner.xml"],
"installable": True,
"external_dependencies": {"python": ["python-stdnum"]},
}
53 changes: 53 additions & 0 deletions l10n_us_partner_legal_number/i18n/l10n_us_partner_legal_number.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * l10n_us_partner_legal_number
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.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: l10n_us_partner_legal_number
#. odoo-python
#: code:addons/l10n_us_partner_legal_number/models/base.py:0
#, python-format
msgid "%s is not a valid EIN / SSN / Canadian Business Number"
msgstr ""

#. module: l10n_us_partner_legal_number
#: model:ir.model,name:l10n_us_partner_legal_number.model_res_partner
msgid "Contact"
msgstr ""

#. module: l10n_us_partner_legal_number
#: model:ir.model,name:l10n_us_partner_legal_number.model_countinghouse_legal_id_number
msgid "Counting House Legal Id Number"
msgstr ""

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

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

#. module: l10n_us_partner_legal_number
#: model:ir.model.fields,field_description:l10n_us_partner_legal_number.field_countinghouse_legal_id_number__legal_id_number
#: model:ir.model.fields,field_description:l10n_us_partner_legal_number.field_res_partner__legal_id_number
#: model:ir.model.fields,field_description:l10n_us_partner_legal_number.field_res_users__legal_id_number
msgid "Legal ID"
msgstr ""
4 changes: 4 additions & 0 deletions l10n_us_partner_legal_number/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from . import base
from . import res_partner
43 changes: 43 additions & 0 deletions l10n_us_partner_legal_number/models/base.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
from stdnum.ca import bn
from stdnum.us import ein, ssn

from odoo import _, api, fields, models
from odoo.exceptions import UserError


class LegalIDNumber(models.AbstractModel):
"""
Odoo's VAT field validation prevents it from being used
for EIN / GST / SSN, etc.
Use generic ID and apply validation depending on the Country field.
"""

_name = "countinghouse.legal_id_number"
_description = "Counting House Legal Id Number"

legal_id_number = fields.Char(
string="Legal ID",
required=False,
help="""For US entities, enter valid EIN or Social Security Number.
Canadian entities, enter Canadian Business Number.
""",
)

@api.constrains("legal_id_number")
def validate_legal_id_number(self):
if not self.legal_id_number:
return
valid = False
for v in (ssn, ein, bn):
try:
v.validate(self.legal_id_number)
valid = True
break
except Exception:
continue
if not valid:
raise UserError(
_("%s is not a valid EIN / SSN / Canadian Business Number")
% self.legal_id_number
)
6 changes: 6 additions & 0 deletions l10n_us_partner_legal_number/models/res_partner.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from odoo import models


class ResPartner(models.Model):
_name = "res.partner"
_inherit = ["countinghouse.legal_id_number", "res.partner"]
3 changes: 3 additions & 0 deletions l10n_us_partner_legal_number/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
4 changes: 4 additions & 0 deletions l10n_us_partner_legal_number/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- Chankya Soni \<<csoni@opensourceintegrators.com>\>
- Maxime Chambreuil \<<mchambreuil@opensourceintegrators.com>\>
- Serpent Consulting Services Pvt. Ltd. \<<support@serpentcs.com>\>
- Levent Karakas \<<leventk@eska.biz>\>
1 change: 1 addition & 0 deletions l10n_us_partner_legal_number/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add Legal Number for North American Banking & Financials
1 change: 1 addition & 0 deletions l10n_us_partner_legal_number/readme/USAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add Legal Number Field
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit dcfe638

Please sign in to comment.