Browse Source

Merge pull request #307 from CompassionCH/8.0

FIX birthdate date install
pull/390/head
Pedro M. Baeza 8 years ago
committed by GitHub
parent
commit
abecf1b31c
  1. 1
      partner_contact_birthdate/__init__.py
  2. 1
      partner_contact_birthdate/__openerp__.py
  3. 19
      partner_contact_birthdate/data/res_partner.yml
  4. 10
      partner_contact_birthdate/hooks.py
  5. 5
      partner_contact_birthdate/models.py

1
partner_contact_birthdate/__init__.py

@ -17,3 +17,4 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from . import models
from .hooks import post_init_hook

1
partner_contact_birthdate/__openerp__.py

@ -28,4 +28,5 @@
"data": [
"views/res_partner.xml",
],
"post_init_hook": "post_init_hook",
}

19
partner_contact_birthdate/data/res_partner.yml

@ -1,19 +0,0 @@
# -*- coding: utf-8 -*-
# Odoo, Open Source Management Solution
# Copyright (C) 2014-2015 Grupo ESOC <www.grupoesoc.es>
#
# 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 <http://www.gnu.org/licenses/>.
- !function {model: res.partner, name: _birthdate_install}

10
partner_contact_birthdate/hooks.py

@ -0,0 +1,10 @@
# -*- coding: utf-8 -*-
from openerp import SUPERUSER_ID
from openerp.api import Environment
def post_init_hook(cr, pool):
env = Environment(cr, SUPERUSER_ID, {})
env['res.partner'].search(
[('birthdate', "!=", False)])._birthdate_inverse()

5
partner_contact_birthdate/models.py

@ -51,8 +51,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()
Loading…
Cancel
Save