Browse Source

[MIG] partner_identification: Migration to 12.0

[FIX] Tests

[FIX] data sequence

Fix openerp to odoo in comment

[REM] at_install, post_install

[ADD] Model descriptions

[REM] Extra spaces
pull/644/head
tarteo 6 years ago
parent
commit
de4689f0ed
  1. 78
      partner_identification/README.rst
  2. 8
      partner_identification/__manifest__.py
  3. 3
      partner_identification/models/res_partner_id_category.py
  4. 1
      partner_identification/models/res_partner_id_number.py
  5. 17
      partner_identification/readme/CONFIGURE.rst
  6. 8
      partner_identification/readme/CONTRIBUTORS.rst
  7. 10
      partner_identification/readme/DESCRIPTION.rst
  8. 2
      partner_identification/readme/ROADMAP.rst
  9. 19
      partner_identification/readme/USAGE.rst
  10. 4
      partner_identification/tests/test_partner_identification.py
  11. 5
      partner_identification/tests/test_res_partner.py

78
partner_identification/README.rst

@ -1,11 +1,30 @@
.. 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
==============================
Partner Identification Numbers
==============================
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Production%2FStable-green.png
:target: https://odoo-community.org/page/development-status
:alt: Production/Stable
.. |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%2Fpartner--contact-lightgray.png?logo=github
:target: https://github.com/OCA/partner-contact/tree/12.0/partner_identification
:alt: OCA/partner-contact
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/partner-contact-12-0/partner-contact-12-0-partner_identification
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/134/12.0
:alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5|
This module allows to manage all sort of identification numbers
and certificates which are assigned to a partner (company or individual)
and vary from country to country.
@ -17,12 +36,10 @@ and vary from country to country.
* Driver license
* etc
**Table of contents**
Installation
============
No specific installation step required.
.. contents::
:local:
Configuration
=============
@ -52,7 +69,7 @@ In partner form you will see another tab called 'ID Numbers'. You can add
any IDs to this partner, defining:
Category:
ID type defined in configuration. For example, Driver License
ID type defined in configuration. For example, Driver License
ID Number:
The ID itself. For example, Driver License number of this person
Issued by:
@ -68,38 +85,37 @@ Status:
Notes:
Any further information related with this ID. For example, vehicle types this person can drive
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/134/11.0
Known issues / Roadmap
======================
* If you want to search a partner by ID you will use advance search form.
You can't search by issuer, valid dates, category or notes.
Bug Tracker
===========
Bugs are tracked on `GitHub Issues
<https://github.com/OCA/partner_contact/issues>`_. In case of trouble, please
check there if your issue has already been reported. If you spotted it first,
help us smash it by providing detailed and welcomed feedback.
Bugs are tracked on `GitHub Issues <https://github.com/OCA/partner-contact/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/partner-contact/issues/new?body=module:%20partner_identification%0Aversion:%2012.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
=======
Images
------
* Odoo Community Association: `Icon <https://odoo-community.org/logo.png>`_.
Authors
~~~~~~~
* ChriCar Beteiligungs- und Beratungs- GmbH
* Tecnativa
* Camptocamp
* ACSONE SA/NV
* LasLabs
* Onestein
Contributors
------------
~~~~~~~~~~~~
* Antonio Espinosa <antonio.espinosa@tecnativa.com>
* Ferdinand Gassauer <office@chrcar.at>
@ -108,19 +124,21 @@ Contributors
* Jairo Llopis <jairo.llopis@tecnativa.com>
* Dave Lasley <dave@laslabs.com>
* Simone Orsi <simone.orsi@camptocamp.com>
* Dennis Sluijk <d.sluijk@onestein.nl>
Maintainers
~~~~~~~~~~~
Maintainer
----------
This module is maintained by the OCA.
.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org
This module is maintained by the OCA.
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.
To contribute to this module, please visit https://odoo-community.org.
This module is part of the `OCA/partner-contact <https://github.com/OCA/partner-contact/tree/12.0/partner_identification>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

8
partner_identification/__manifest__.py

@ -9,22 +9,24 @@
{
'name': 'Partner Identification Numbers',
'category': 'Customer Relationship Management',
'version': '11.0.1.0.0',
'version': '12.0.1.0.0',
'license': 'AGPL-3',
'depends': [
'contacts',
],
'data': [
'security/ir.model.access.csv',
'views/res_partner_id_category_view.xml',
'views/res_partner_id_number_view.xml',
'views/res_partner_view.xml',
'security/ir.model.access.csv',
],
'author': 'ChriCar Beteiligungs- und Beratungs- GmbH, '
'author': 'ChriCar Beteiligungs- und Beratungs- GmbH,'
'Tecnativa,'
'Camptocamp,'
'ACSONE SA/NV,'
'LasLabs,'
'Onestein,'
'Odoo Community Association (OCA)',
'website': 'https://github.com/OCA/partner-contact',
'development_status': 'Production/Stable',
}

3
partner_identification/models/res_partner_id_category.py

@ -15,6 +15,7 @@ from odoo.tools.safe_eval import safe_eval
class ResPartnerIdCategory(models.Model):
_name = "res.partner.id_category"
_description = "Partner ID Category"
_order = "name"
code = fields.Char(
@ -48,7 +49,7 @@ class ResPartnerIdCategory(models.Model):
@api.multi
def validate_id_number(self, id_number):
"""Validate the given ID number
The method raises an openerp.exceptions.ValidationError if the eval of
The method raises an odoo.exceptions.ValidationError if the eval of
python validation code fails
"""
self.ensure_one()

1
partner_identification/models/res_partner_id_number.py

@ -12,6 +12,7 @@ from odoo import api, models, fields
class ResPartnerIdNumber(models.Model):
_name = "res.partner.id_number"
_description = "Partner ID Number"
_order = "name"
@api.constrains('name', 'category_id')

17
partner_identification/readme/CONFIGURE.rst

@ -0,0 +1,17 @@
Configure all ID types you need in Contacts > Configuration > Partner ID Categories.
For example, we create a category 'Driver License':
Name:
Name of this ID type. For example, 'Driver License'
Code:
Code, abbreviation or acronym of this ID type. For example, 'driver_license'
Python validation code:
Optional python code called to validate ID numbers of this ID type. This functionality can be
overridden by setting ``id_no_validate`` to ``True`` in the context, such as:
.. code-block:: python
partner.with_context(id_no_validate=True).write({
'name': 'Bad Value',
'category_id': self.env.ref('id_category_only_numerics').id,
})

8
partner_identification/readme/CONTRIBUTORS.rst

@ -0,0 +1,8 @@
* Antonio Espinosa <antonio.espinosa@tecnativa.com>
* Ferdinand Gassauer <office@chrcar.at>
* Gerhard Könighofer <gerhard.koenighofer@swing-system.com>
* Laurent Mignon <laurent.mignon@acsone.eu>
* Jairo Llopis <jairo.llopis@tecnativa.com>
* Dave Lasley <dave@laslabs.com>
* Simone Orsi <simone.orsi@camptocamp.com>
* Dennis Sluijk <d.sluijk@onestein.nl>

10
partner_identification/readme/DESCRIPTION.rst

@ -0,0 +1,10 @@
This module allows to manage all sort of identification numbers
and certificates which are assigned to a partner (company or individual)
and vary from country to country.
* Commercial register
* VAT ID
* Fiscal ID's
* Membership numbers
* Driver license
* etc

2
partner_identification/readme/ROADMAP.rst

@ -0,0 +1,2 @@
* If you want to search a partner by ID you will use advance search form.
You can't search by issuer, valid dates, category or notes.

19
partner_identification/readme/USAGE.rst

@ -0,0 +1,19 @@
In partner form you will see another tab called 'ID Numbers'. You can add
any IDs to this partner, defining:
Category:
ID type defined in configuration. For example, Driver License
ID Number:
The ID itself. For example, Driver License number of this person
Issued by:
Another partner, who issued this ID. For example, Traffic National Institution
Place of Issuance:
The place where the ID has been issued. For example the country for passports and visa
Valid from:
Issued date. For example, date when person approved his driving exam, 21/10/2009
Valid until:
Expiration date. For example, date when person needs to renew his driver license, 21/10/2019
Status:
ID status. For example new/to renew/expired
Notes:
Any further information related with this ID. For example, vehicle types this person can drive

4
partner_identification/tests/test_partner_identification.py

@ -57,11 +57,11 @@ if id_number.name != '1234':
})
partner_1 = self.env.ref('base.res_partner_1')
with self.assertRaises(ValidationError), self.cr.savepoint():
partner_1.write({'id_numbers': [(0, 0, {
partner_1.write({'id_numbers': [(0, 0, {
'name': '01234',
'category_id': partner_id_category.id
})]})
partner_1.write({'id_numbers': [(0, 0, {
partner_1.write({'id_numbers': [(0, 0, {
'name': '1234',
'category_id': partner_id_category.id
})]})

5
partner_identification/tests/test_res_partner.py

@ -8,9 +8,6 @@ from .fake_models import ResPartner, setup_test_model, teardown_test_model
class TestResPartner(common.SavepointCase):
at_install = False
post_install = True
@classmethod
def setUpClass(cls):
super().setUpClass()
@ -28,7 +25,7 @@ class TestResPartner(common.SavepointCase):
'code': 'id_code',
'name': 'id_name',
})
cls.partner = cls.env.user.partner_id
cls.partner = cls.env.ref('base.main_partner')
cls.partner_id = cls.env['res.partner.id_number'].create({
'name': 'Good ID',
'category_id': cls.partner_id_category.id,

Loading…
Cancel
Save