Browse Source

[11.0][MIG] partner_ref_unique: Migrate to v11

pull/670/head
Cris Martín 6 years ago
committed by sbejaoui
parent
commit
6220d0009c
  1. 2
      partner_ref_unique/README.rst
  2. 2
      partner_ref_unique/__init__.py
  3. 8
      partner_ref_unique/__manifest__.py
  4. 2
      partner_ref_unique/models/__init__.py
  5. 5
      partner_ref_unique/models/res_company.py
  6. 8
      partner_ref_unique/models/res_partner.py
  7. 5
      partner_ref_unique/readme/CONFIGURE.rst
  8. 10
      partner_ref_unique/readme/CONTRIBUTORS.rst
  9. 1
      partner_ref_unique/readme/DESCRIPTION.rst
  10. 6
      partner_ref_unique/readme/USAGE.rst
  11. 2
      partner_ref_unique/tests/__init__.py
  12. 5
      partner_ref_unique/tests/test_res_partner_ref.py
  13. 12
      partner_ref_unique/views/res_company_view.xml

2
partner_ref_unique/README.rst

@ -19,7 +19,7 @@ To use this module, you need to:
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot :alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/134/9.0
:target: https://runbot.odoo-community.org/runbot/134/11.0
Bug Tracker Bug Tracker
=========== ===========

2
partner_ref_unique/__init__.py

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright 2016 Antiun Ingenieria S.L. - Antonio Espinosa
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import models from . import models

8
partner_ref_unique/__openerp__.py → partner_ref_unique/__manifest__.py

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright 2016 Antiun Ingenieria S.L. - Antonio Espinosa # Copyright 2016 Antiun Ingenieria S.L. - Antonio Espinosa
# Copyright 2017 Tecnativa - Vicent Cubells # Copyright 2017 Tecnativa - Vicent Cubells
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
@ -6,11 +5,10 @@
{ {
"name": "Partner unique reference", "name": "Partner unique reference",
"summary": "Add an unique constraint to partner ref field", "summary": "Add an unique constraint to partner ref field",
"version": "9.0.1.0.0",
"version": "11.0.1.0.0",
"category": "Customer Relationship Management", "category": "Customer Relationship Management",
"website": "http://www.antiun.com",
"author": "Antiun Ingeniería S.L., "
"Tecnativa, "
"website": "https://github.com/OCA/partner-contact/",
"author": "Tecnativa, "
"Odoo Community Association (OCA)", "Odoo Community Association (OCA)",
"license": "AGPL-3", "license": "AGPL-3",
"application": False, "application": False,

2
partner_ref_unique/models/__init__.py

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright 2016 Antiun Ingenieria S.L. - Antonio Espinosa
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import res_company from . import res_company

5
partner_ref_unique/models/res_company.py

@ -1,8 +1,7 @@
# -*- coding: utf-8 -*-
# Copyright 2016 Antiun Ingenieria S.L. - Antonio Espinosa
# Copyright 2016 Antonio Espinosa
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import models, fields
from odoo import fields, models
class ResCompany(models.Model): class ResCompany(models.Model):

8
partner_ref_unique/models/res_partner.py

@ -1,9 +1,8 @@
# -*- coding: utf-8 -*-
# Copyright 2016 Antiun Ingenieria S.L. - Antonio Espinosa
# Copyright 2016 Antonio Espinosa
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import models, api, _
from openerp.exceptions import ValidationError
from odoo import _, api, models
from odoo.exceptions import ValidationError
class ResPartner(models.Model): class ResPartner(models.Model):
@ -20,7 +19,6 @@ class ResPartner(models.Model):
domain = [ domain = [
('id', '!=', partner.id), ('id', '!=', partner.id),
('ref', '=', partner.ref), ('ref', '=', partner.ref),
('customer', '=', True),
] ]
if mode == 'companies': if mode == 'companies':
domain.append(('is_company', '=', True)) domain.append(('is_company', '=', True))

5
partner_ref_unique/readme/CONFIGURE.rst

@ -0,0 +1,5 @@
To configure this module, you need to:
#. Go to **Settings > Companies**.
#. Select a company.
#. Choose an option on section *Partners*.

10
partner_ref_unique/readme/CONTRIBUTORS.rst

@ -0,0 +1,10 @@
* `Tecnativa <https://www.tecnativa.com>`__:
* Antonio Espinosa
* Pedro M. Baeza
* Rafael Blasco
* Jairo Llopis
* Vicent Cubells
* Cristina Martín

1
partner_ref_unique/readme/DESCRIPTION.rst

@ -0,0 +1 @@
This module allows add an unique constraint to partner ref field.

6
partner_ref_unique/readme/USAGE.rst

@ -0,0 +1,6 @@
#. Go to any partner in **Contacts > Contacts**
#. Try to create two partners with the same ref.
* If you selcted the option 'All partners' you can't create two partners with the same ref.
* If you selcted the option 'Only companies' you can't create two companies with the same ref.
* If you selcted the option 'None' you can create two partners with the same ref.

2
partner_ref_unique/tests/__init__.py

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright 2017 Tecnativa - Vicent Cubells
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import test_res_partner_ref from . import test_res_partner_ref

5
partner_ref_unique/tests/test_res_partner_ref.py

@ -1,9 +1,8 @@
# -*- coding: utf-8 -*-
# Copyright 2017 Tecnativa - Vicent Cubells # Copyright 2017 Tecnativa - Vicent Cubells
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp.tests import common
from openerp.exceptions import ValidationError
from odoo.tests import common
from odoo.exceptions import ValidationError
class TestResPartnerRefUnique(common.SavepointCase): class TestResPartnerRefUnique(common.SavepointCase):

12
partner_ref_unique/views/res_company_view.xml

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2016 Antiun Ingenieria S.L. - Antonio Espinosa
<!-- Copyright 2016 Antonio Espinosa
Copyright 2017 Tecnativa - Vicent Cubells Copyright 2017 Tecnativa - Vicent Cubells
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). --> License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -->
<odoo> <odoo>
@ -9,13 +9,11 @@
<field name="model">res.company</field> <field name="model">res.company</field>
<field name="inherit_id" ref="base.view_company_form"/> <field name="inherit_id" ref="base.view_company_form"/>
<field name="arch" type="xml"> <field name="arch" type="xml">
<page name="configuration" position="inside">
<group>
<group name="partner" string="Partners">
<field name="partner_ref_unique"/>
</group>
<group name="social_media" position="before">
<group name="partner" string="Partners">
<field name="partner_ref_unique"/>
</group> </group>
</page>
</group>
</field> </field>
</record> </record>

Loading…
Cancel
Save