From 57df5ab98350398798178f1ea43a27659311f90d Mon Sep 17 00:00:00 2001 From: invitu Date: Fri, 11 Nov 2016 16:08:15 -1000 Subject: [PATCH] =?UTF-8?q?[MIG]=20Migration=20partner=5Fcontact=5Fbirthda?= =?UTF-8?q?te=20partner=5Fcontact=5Fgender=20part=E2=80=A6=20(#315)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [MIG] Migration partner_contact_birthdate partner_contact_gender partner_contact_personal_information_page to v10 --- partner_contact_birthdate/__init__.py | 1 + partner_contact_birthdate/__manifest__.py | 10 ++++--- .../data/res_partner.yml | 5 ---- partner_contact_birthdate/hooks.py | 10 +++++++ .../models/res_partner.py | 9 ++---- .../views/res_partner.xml | 28 +++++++++---------- partner_contact_gender/__manifest__.py | 8 +++--- partner_contact_gender/hooks.py | 5 ++-- partner_contact_gender/i18n/fr.po | 8 +++--- partner_contact_gender/models/res_partner.py | 2 +- partner_contact_gender/views/res_partner.xml | 28 ++++++++----------- .../__manifest__.py | 4 +-- .../views/res_partner.xml | 10 ++----- 13 files changed, 60 insertions(+), 68 deletions(-) delete mode 100644 partner_contact_birthdate/data/res_partner.yml create mode 100644 partner_contact_birthdate/hooks.py diff --git a/partner_contact_birthdate/__init__.py b/partner_contact_birthdate/__init__.py index 2fe0926df..00ff9b00b 100644 --- a/partner_contact_birthdate/__init__.py +++ b/partner_contact_birthdate/__init__.py @@ -2,3 +2,4 @@ # Copyright (C) 2014-2015 Grupo ESOC # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from . import models +from .hooks import post_init_hook diff --git a/partner_contact_birthdate/__manifest__.py b/partner_contact_birthdate/__manifest__.py index 12cf44737..a8566aa2a 100644 --- a/partner_contact_birthdate/__manifest__.py +++ b/partner_contact_birthdate/__manifest__.py @@ -4,16 +4,18 @@ { "name": "Contact's birthdate", - "version": "9.0.1.0.0", - "author": "Jairo Llopis," + "version": "10.0.1.0.0", + "author": "Tecnativa," "Odoo Community Association (OCA)", "category": "Customer Relationship Management", - "website": "https://odoo-community.org/", + "website": "https://www.tecnativa.com/", "depends": [ "partner_contact_personal_information_page", ], "data": [ "views/res_partner.xml", ], - 'installable': False, + "post_init_hook": "post_init_hook", + "license": "AGPL-3", + 'installable': True, } diff --git a/partner_contact_birthdate/data/res_partner.yml b/partner_contact_birthdate/data/res_partner.yml deleted file mode 100644 index d6be2f47e..000000000 --- a/partner_contact_birthdate/data/res_partner.yml +++ /dev/null @@ -1,5 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright (C) 2014-2015 Grupo ESOC -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). - -- !function {model: res.partner, name: _birthdate_install} diff --git a/partner_contact_birthdate/hooks.py b/partner_contact_birthdate/hooks.py new file mode 100644 index 000000000..f3d2ca69e --- /dev/null +++ b/partner_contact_birthdate/hooks.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- + +from odoo import SUPERUSER_ID +from odoo.api import Environment + + +def post_init_hook(cr, pool): + env = Environment(cr, SUPERUSER_ID, {}) + env['res.partner'].search( + [('birthdate', "!=", False)])._birthdate_inverse() diff --git a/partner_contact_birthdate/models/res_partner.py b/partner_contact_birthdate/models/res_partner.py index d98771922..829771d11 100644 --- a/partner_contact_birthdate/models/res_partner.py +++ b/partner_contact_birthdate/models/res_partner.py @@ -1,14 +1,14 @@ # -*- coding: utf-8 -*- # Copyright (C) 2014-2015 Grupo ESOC # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -from openerp import _, api, fields, models +from odoo import _, api, fields, models import logging _logger = logging.getLogger(__name__) -class Partner(models.Model): +class ResPartner(models.Model): """Partner with birth date in date format.""" _inherit = "res.partner" @@ -36,8 +36,3 @@ class Partner(models.Model): _logger.warn( _("Could not convert '{0.birthdate}' to date in " "res.partner {0.id} ({0.name}). Skipping.").format(self)) - - @api.model - def _birthdate_install(self): - """Export all old birthdates to the new format.""" - self.search([('birthdate', "!=", False)])._inverse_birthdate() diff --git a/partner_contact_birthdate/views/res_partner.xml b/partner_contact_birthdate/views/res_partner.xml index 49c636171..4b2d1d1ac 100644 --- a/partner_contact_birthdate/views/res_partner.xml +++ b/partner_contact_birthdate/views/res_partner.xml @@ -1,20 +1,18 @@ - - - - - Birthdate Date field - res.partner - - - - - - - - - + + + Birthdate Date field + res.partner + + + + + + + + + diff --git a/partner_contact_gender/__manifest__.py b/partner_contact_gender/__manifest__.py index 12cf6025c..ec3397f3f 100644 --- a/partner_contact_gender/__manifest__.py +++ b/partner_contact_gender/__manifest__.py @@ -5,17 +5,17 @@ { "name": "Contact gender", "summary": "Add gender field to contacts", - "version": "9.0.1.1.0", + "version": "10.0.1.1.0", "category": "Customer Relationship Management", - "website": "https://odoo-community.org/", - "author": "Grupo ESOC, Odoo Community Association (OCA)", + "website": "https://www.tecnativa.com/", + "author": "Grupo ESOC, Tecnativa, Odoo Community Association (OCA)", "contributors": [ 'Jairo Llopis ', 'Richard deMeester ', ], "license": "AGPL-3", 'application': False, - 'installable': False, + 'installable': True, 'auto_install': False, "depends": [ "partner_contact_personal_information_page", diff --git a/partner_contact_gender/hooks.py b/partner_contact_gender/hooks.py index 493dd7ef3..4b0895eaa 100644 --- a/partner_contact_gender/hooks.py +++ b/partner_contact_gender/hooks.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # © 2016 Therp BV # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -from openerp import api, SUPERUSER_ID +from odoo import api, SUPERUSER_ID def post_init_hook(cr, pool): @@ -9,8 +9,7 @@ def post_init_hook(cr, pool): gender_mappings = { 'female': env.ref('base.res_partner_title_madam') + env.ref('base.res_partner_title_miss'), - 'male': env.ref('base.res_partner_title_sir') + - env.ref('base.res_partner_title_mister'), + 'male': env.ref('base.res_partner_title_mister') } for gender, titles in gender_mappings.iteritems(): env['res.partner'].with_context(active_test=False).search([ diff --git a/partner_contact_gender/i18n/fr.po b/partner_contact_gender/i18n/fr.po index 442c2a6e9..e746f040c 100644 --- a/partner_contact_gender/i18n/fr.po +++ b/partner_contact_gender/i18n/fr.po @@ -20,22 +20,22 @@ msgstr "" #. module: partner_contact_gender #: selection:res.partner,gender:0 msgid "Female" -msgstr "" +msgstr "Femme" #. module: partner_contact_gender #: model:ir.model.fields,field_description:partner_contact_gender.field_res_partner_gender msgid "Gender" -msgstr "" +msgstr "Genre" #. module: partner_contact_gender #: selection:res.partner,gender:0 msgid "Male" -msgstr "" +msgstr "Homme" #. module: partner_contact_gender #: selection:res.partner,gender:0 msgid "Other" -msgstr "" +msgstr "Autre" #. module: partner_contact_gender #: model:ir.model,name:partner_contact_gender.model_res_partner diff --git a/partner_contact_gender/models/res_partner.py b/partner_contact_gender/models/res_partner.py index ce142e659..c83ca861d 100644 --- a/partner_contact_gender/models/res_partner.py +++ b/partner_contact_gender/models/res_partner.py @@ -2,7 +2,7 @@ # Copyright (C) 2014-2015 Grupo ESOC # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -from openerp import fields, models +from odoo import fields, models class ResPartner(models.Model): diff --git a/partner_contact_gender/views/res_partner.xml b/partner_contact_gender/views/res_partner.xml index d71d0630a..61aa538a4 100644 --- a/partner_contact_gender/views/res_partner.xml +++ b/partner_contact_gender/views/res_partner.xml @@ -1,19 +1,15 @@ - - - - Partner gender: personal info - res.partner - - - - - - - - - - - + + Partner gender: personal info + res.partner + + + + + + + + + diff --git a/partner_contact_personal_information_page/__manifest__.py b/partner_contact_personal_information_page/__manifest__.py index 6e6aededb..28113dd7b 100644 --- a/partner_contact_personal_information_page/__manifest__.py +++ b/partner_contact_personal_information_page/__manifest__.py @@ -4,7 +4,7 @@ { "name": "Personal information page for contacts", "summary": "Add a page to contacts form to put personal information", - "version": "9.0.1.0.0", + "version": "10.0.1.0.0", "category": "Customer Relationship Management", "website": "https://odoo-community.org/", "author": "Odoo Community Association (OCA)", @@ -17,7 +17,7 @@ ], "license": "AGPL-3", 'application': False, - 'installable': False, + 'installable': True, 'auto_install': False, "depends": [ "base" diff --git a/partner_contact_personal_information_page/views/res_partner.xml b/partner_contact_personal_information_page/views/res_partner.xml index d1bef3018..e762b75a2 100644 --- a/partner_contact_personal_information_page/views/res_partner.xml +++ b/partner_contact_personal_information_page/views/res_partner.xml @@ -1,7 +1,5 @@ - - Personal information page for contacts form @@ -12,14 +10,12 @@ + string="Personal Information" + attrs="{'invisible': [('is_company','=',True)]}"> - - - \ No newline at end of file +