From efb51adf4d1f3799f76672e763d5ca8d14251a79 Mon Sep 17 00:00:00 2001 From: Yannick Vaucher Date: Tue, 12 Jan 2016 16:35:28 +0100 Subject: [PATCH] [PORT] partner_firstname to 9.0 - add missing authors - use reduced license header - move models in models directory - adapt views - show firstname, lastname only in edit mode - use company_type in views instead of is_company - adapt constraint on contacts --- partner_firstname/README.rst | 17 +++++ partner_firstname/__init__.py | 21 +----- partner_firstname/__openerp__.py | 28 ++------ partner_firstname/exceptions.py | 18 +----- partner_firstname/models/__init__.py | 4 ++ .../{models.py => models/partner.py} | 34 ++++------ partner_firstname/views/res_partner.xml | 64 ++++++++----------- partner_firstname/views/res_user.xml | 2 +- 8 files changed, 73 insertions(+), 115 deletions(-) create mode 100644 partner_firstname/models/__init__.py rename partner_firstname/{models.py => models/partner.py} (87%) diff --git a/partner_firstname/README.rst b/partner_firstname/README.rst index 5602d35ee..7c9bf10e9 100644 --- a/partner_firstname/README.rst +++ b/partner_firstname/README.rst @@ -39,11 +39,28 @@ Contributors ------------ * Nicolas Bessi +* Yannick Vaucher +* Vincent Renaville +* Guewen Baconnier +* Holger Brunn * Jonathan Nemry * Olivier Laurent +* Sandy Carter +* Alexis de Lattre +* Lorenzo Battistini * Hans Henrik Gabelgaard * Jairo Llopis * Adrien Peiffer +* Ronald Portier +* Sylvain Van Hoof +* Pedro Baeza + +Translations +------------ + +* Danish: Hans Henrik Gabelgaard +* Italian: Leonardo Donelli +* Spanish: Antonio Espinosa Maintainer ---------- diff --git a/partner_firstname/__init__.py b/partner_firstname/__init__.py index 4cdd79b3f..8a9bba4af 100644 --- a/partner_firstname/__init__.py +++ b/partner_firstname/__init__.py @@ -1,21 +1,4 @@ # -*- coding: utf-8 -*- - -# Author: Nicolas Bessi. Copyright Camptocamp SA -# Copyright (C) -# 2014: Agile Business Group () -# 2015: Grupo ESOC -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . - +# © 2013 Nicolas Bessi (Camptocamp SA) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from . import models diff --git a/partner_firstname/__openerp__.py b/partner_firstname/__openerp__.py index 6d8517cee..a308f30ac 100644 --- a/partner_firstname/__openerp__.py +++ b/partner_firstname/__openerp__.py @@ -1,28 +1,14 @@ # -*- coding: utf-8 -*- - -# Author: Nicolas Bessi. Copyright Camptocamp SA -# Copyright (C) -# 2014: Agile Business Group () -# 2015: Grupo ESOC -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . +# © 2013 Nicolas Bessi (Camptocamp SA) +# © 2014 Agile Business Group () +# © 2015 Grupo ESOC () +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). { 'name': 'Partner first name and last name', 'summary': "Split first name and last name for non company partners", - 'version': '8.0.2.1.0', - "author": "Camptocamp, " + 'version': '9.0.1.0.0', + 'author': "Camptocamp, " "Grupo ESOC Ingeniería de Servicios, " "Odoo Community Association (OCA)", "license": "AGPL-3", @@ -39,6 +25,6 @@ 'demo': [], 'test': [], 'auto_install': False, - 'installable': False, + 'installable': True, 'images': [] } diff --git a/partner_firstname/exceptions.py b/partner_firstname/exceptions.py index a75429514..d2fdea566 100644 --- a/partner_firstname/exceptions.py +++ b/partner_firstname/exceptions.py @@ -1,20 +1,6 @@ # -*- coding: utf-8 -*- -# Odoo, Open Source Management Solution -# Copyright (C) 2014-2015 Grupo ESOC -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . - +# © 2014-2015 Grupo ESOC () +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from openerp import _, exceptions diff --git a/partner_firstname/models/__init__.py b/partner_firstname/models/__init__.py new file mode 100644 index 000000000..4e1de1d72 --- /dev/null +++ b/partner_firstname/models/__init__.py @@ -0,0 +1,4 @@ +# -*- coding: utf-8 -*- +# © 2013 Nicolas Bessi (Camptocamp SA) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +from . import partner diff --git a/partner_firstname/models.py b/partner_firstname/models/partner.py similarity index 87% rename from partner_firstname/models.py rename to partner_firstname/models/partner.py index fe2b5aa09..3c8c87645 100644 --- a/partner_firstname/models.py +++ b/partner_firstname/models/partner.py @@ -1,26 +1,11 @@ # -*- coding: utf-8 -*- - -# Author: Nicolas Bessi. Copyright Camptocamp SA -# Copyright (C) -# 2014: Agile Business Group () -# 2015: Grupo ESOC -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . - +# © 2013 Nicolas Bessi (Camptocamp SA) +# © 2014 Agile Business Group () +# © 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 . import exceptions +from .. import exceptions _logger = logging.getLogger(__name__) @@ -202,3 +187,12 @@ class ResPartner(models.Model): # Force calculations there records._inverse_name() _logger.info("%d partners updated installing module.", len(records)) + + # As name is computed after sql_constraint check, we modify it to accept + # to write when at least one name field is filled + _sql_constraints = [ + ('check_name', + "CHECK( (type='contact' AND (name IS NOT NULL OR" + " firstname IS NOT NULL OR lastname IS NOT NULL)) or" + " (type!='contact') )", 'Contacts require a name.'), + ] diff --git a/partner_firstname/views/res_partner.xml b/partner_firstname/views/res_partner.xml index 0838628eb..85c269613 100644 --- a/partner_firstname/views/res_partner.xml +++ b/partner_firstname/views/res_partner.xml @@ -15,7 +15,7 @@ } - + - - - - - - - - +
- -