Browse Source

[MIG] Migration partner_contact_birthdate partner_contact_gender part… (#315)

[MIG] Migration partner_contact_birthdate partner_contact_gender partner_contact_personal_information_page to v10
pull/714/head
invitu 8 years ago
committed by Oihane Crucelaegui
parent
commit
e6f687ef56
  1. 1
      partner_contact_birthdate/__init__.py
  2. 8
      partner_contact_birthdate/__manifest__.py
  3. 5
      partner_contact_birthdate/data/res_partner.yml
  4. 10
      partner_contact_birthdate/hooks.py
  5. 9
      partner_contact_birthdate/models/res_partner.py
  6. 2
      partner_contact_birthdate/views/res_partner.xml

1
partner_contact_birthdate/__init__.py

@ -2,3 +2,4 @@
# Copyright (C) 2014-2015 Grupo ESOC <www.grupoesoc.es> # Copyright (C) 2014-2015 Grupo ESOC <www.grupoesoc.es>
# 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
from .hooks import post_init_hook

8
partner_contact_birthdate/__openerp__.py → partner_contact_birthdate/__manifest__.py

@ -4,16 +4,18 @@
{ {
"name": "Contact's birthdate", "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)", "Odoo Community Association (OCA)",
"category": "Customer Relationship Management", "category": "Customer Relationship Management",
"website": "https://odoo-community.org/",
"website": "https://www.tecnativa.com/",
"depends": [ "depends": [
"partner_contact_personal_information_page", "partner_contact_personal_information_page",
], ],
"data": [ "data": [
"views/res_partner.xml", "views/res_partner.xml",
], ],
"post_init_hook": "post_init_hook",
"license": "AGPL-3",
'installable': True, 'installable': True,
} }

5
partner_contact_birthdate/data/res_partner.yml

@ -1,5 +0,0 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2014-2015 Grupo ESOC <www.grupoesoc.es>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
- !function {model: res.partner, name: _birthdate_install}

10
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()

9
partner_contact_birthdate/models/res_partner.py

@ -1,14 +1,14 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright (C) 2014-2015 Grupo ESOC <www.grupoesoc.es> # Copyright (C) 2014-2015 Grupo ESOC <www.grupoesoc.es>
# 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 _, api, fields, models
from odoo import _, api, fields, models
import logging import logging
_logger = logging.getLogger(__name__) _logger = logging.getLogger(__name__)
class Partner(models.Model):
class ResPartner(models.Model):
"""Partner with birth date in date format.""" """Partner with birth date in date format."""
_inherit = "res.partner" _inherit = "res.partner"
@ -36,8 +36,3 @@ class Partner(models.Model):
_logger.warn( _logger.warn(
_("Could not convert '{0.birthdate}' to date in " _("Could not convert '{0.birthdate}' to date in "
"res.partner {0.id} ({0.name}). Skipping.").format(self)) "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()

2
partner_contact_birthdate/views/res_partner.xml

@ -3,7 +3,6 @@
© 2015 Grupo ESOC Ingeniería de Servicios, S.L.U. --> © 2015 Grupo ESOC Ingeniería de Servicios, S.L.U. -->
<odoo> <odoo>
<record id="view_personal_information_birthdate_date" model="ir.ui.view"> <record id="view_personal_information_birthdate_date" model="ir.ui.view">
<field name="name">Birthdate Date field</field> <field name="name">Birthdate Date field</field>
<field name="model">res.partner</field> <field name="model">res.partner</field>
@ -16,5 +15,4 @@
</data> </data>
</field> </field>
</record> </record>
</odoo> </odoo>
Loading…
Cancel
Save