From 1dd40e9b39ae7945bcceb11c929def5ce8f2f741 Mon Sep 17 00:00:00 2001 From: Sylvain GARANCHER Date: Thu, 6 Oct 2016 23:51:40 +0200 Subject: [PATCH] [MIG] Migrate partner_firstname to v10 --- partner_firstname/__manifest__.py | 7 +- partner_firstname/models/res_partner.py | 4 +- partner_firstname/models/res_user.py | 2 +- partner_firstname/tests/base.py | 2 +- partner_firstname/tests/test_create.py | 2 +- partner_firstname/tests/test_defaults.py | 2 +- partner_firstname/tests/test_delete.py | 2 +- partner_firstname/tests/test_empty.py | 2 +- partner_firstname/tests/test_user_onchange.py | 2 +- partner_firstname/views/res_partner.xml | 156 +++++++++--------- partner_firstname/views/res_user.xml | 50 +++--- 11 files changed, 109 insertions(+), 122 deletions(-) diff --git a/partner_firstname/__manifest__.py b/partner_firstname/__manifest__.py index 8b6d7a550..086f313b0 100644 --- a/partner_firstname/__manifest__.py +++ b/partner_firstname/__manifest__.py @@ -7,7 +7,7 @@ { 'name': 'Partner first name and last name', 'summary': "Split first name and last name for non company partners", - 'version': '9.0.1.0.0', + 'version': '10.0.1.0.0', 'author': "Camptocamp, " "Grupo ESOC Ingeniería de Servicios, " "Odoo Community Association (OCA)", @@ -22,9 +22,6 @@ 'views/res_user.xml', 'data/res_partner.yml', ], - 'demo': [], - 'test': [], 'auto_install': False, - 'installable': False, - 'images': [] + 'installable': True, } diff --git a/partner_firstname/models/res_partner.py b/partner_firstname/models/res_partner.py index 82acceb71..8beed1c87 100644 --- a/partner_firstname/models/res_partner.py +++ b/partner_firstname/models/res_partner.py @@ -4,7 +4,7 @@ # © 2015 Grupo ESOC () # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). import logging -from openerp import api, fields, models +from odoo import api, fields, models from .. import exceptions @@ -150,7 +150,6 @@ class ResPartner(models.Model): not (self.firstname or self.lastname)): raise exceptions.EmptyNamesError(self) - @api.one @api.onchange("firstname", "lastname") def _onchange_subnames(self): """Avoid recursion when the user changes one of these fields. @@ -162,7 +161,6 @@ class ResPartner(models.Model): # See https://github.com/odoo/odoo/issues/7472#issuecomment-119503916. self.env.context = self.with_context(skip_onchange=True).env.context - @api.one @api.onchange("name") def _onchange_name(self): """Ensure :attr:`~.name` is inverted in the UI.""" diff --git a/partner_firstname/models/res_user.py b/partner_firstname/models/res_user.py index efe6f9a9f..cea1aa332 100644 --- a/partner_firstname/models/res_user.py +++ b/partner_firstname/models/res_user.py @@ -4,7 +4,7 @@ # © 2015 Grupo ESOC () # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). import logging -from openerp import api, models +from odoo import api, models _logger = logging.getLogger(__name__) diff --git a/partner_firstname/tests/base.py b/partner_firstname/tests/base.py index 15a2c795d..c6236c866 100644 --- a/partner_firstname/tests/base.py +++ b/partner_firstname/tests/base.py @@ -2,7 +2,7 @@ # © 2014 Nemry Jonathan (Acsone SA/NV) (http://www.acsone.eu) # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -from openerp.tests.common import TransactionCase +from odoo.tests.common import TransactionCase from .. import exceptions as ex diff --git a/partner_firstname/tests/test_create.py b/partner_firstname/tests/test_create.py index 8f3e06a7f..810383808 100644 --- a/partner_firstname/tests/test_create.py +++ b/partner_firstname/tests/test_create.py @@ -4,7 +4,7 @@ """Test default values for models.""" -from openerp.tests.common import TransactionCase +from odoo.tests.common import TransactionCase from .base import MailInstalled diff --git a/partner_firstname/tests/test_defaults.py b/partner_firstname/tests/test_defaults.py index ab6c3a969..304e9583d 100644 --- a/partner_firstname/tests/test_defaults.py +++ b/partner_firstname/tests/test_defaults.py @@ -4,7 +4,7 @@ """Test default values for models.""" -from openerp.tests.common import TransactionCase +from odoo.tests.common import TransactionCase from .base import MailInstalled diff --git a/partner_firstname/tests/test_delete.py b/partner_firstname/tests/test_delete.py index 0729502f1..070a92a6a 100644 --- a/partner_firstname/tests/test_delete.py +++ b/partner_firstname/tests/test_delete.py @@ -2,7 +2,7 @@ # © 2015 Grupo ESOC # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -from openerp.tests.common import TransactionCase +from odoo.tests.common import TransactionCase from .base import MailInstalled diff --git a/partner_firstname/tests/test_empty.py b/partner_firstname/tests/test_empty.py index 4728ca20c..00e51f930 100644 --- a/partner_firstname/tests/test_empty.py +++ b/partner_firstname/tests/test_empty.py @@ -6,7 +6,7 @@ To have more accurate results, remove the ``mail`` module before testing. """ -from openerp.tests.common import TransactionCase +from odoo.tests.common import TransactionCase from .base import MailInstalled from .. import exceptions as ex diff --git a/partner_firstname/tests/test_user_onchange.py b/partner_firstname/tests/test_user_onchange.py index 46fe41b74..4f0fa1052 100644 --- a/partner_firstname/tests/test_user_onchange.py +++ b/partner_firstname/tests/test_user_onchange.py @@ -2,7 +2,7 @@ # © 2016 Yannick Vaucher (Camptocamp SA) # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from openerp.tests.common import TransactionCase +from odoo.tests.common import TransactionCase class UserOnchangeCase(TransactionCase): diff --git a/partner_firstname/views/res_partner.xml b/partner_firstname/views/res_partner.xml index 85c269613..c0956ff9a 100644 --- a/partner_firstname/views/res_partner.xml +++ b/partner_firstname/views/res_partner.xml @@ -1,86 +1,82 @@ - - + + + Add firstname and lastname + res.partner + + + + + { + 'readonly': [('is_company', '=', False)], + 'required': [('is_company', '=', True)] + } + - - Add firstname and lastname - res.partner - - - - - { - 'readonly': [('is_company', '=', False)], - 'required': [('is_company', '=', True)] - } - + + + - - + { + 'readonly': [('is_company', '=', False)], + 'required': [('is_company', '=', True)] + } + - - Add firstname and surnames - res.partner - - - - - { - 'readonly': [('is_company', '=', False)], - 'required': [('is_company', '=', True)] - } - + +
+ + -
- - + { + 'readonly': [('is_company', '=', False)], + 'required': [('is_company', '=', True)] + } + - - - { - 'readonly': [('is_company', '=', False)], - 'required': [('is_company', '=', True)] - } - - - -
- - - +
+ + + + True + False + - - Add firstname and surnames - res.users - - - - - True - False - - - - - - - - - - - - - - + + + + + + + + + +