Browse Source

[FIX] partner_contact: Fix Travis

pull/714/head
Pedro M. Baeza 8 years ago
committed by Oihane Crucelaegui
parent
commit
fc447bab27
  1. 2
      partner_contact_birthdate/__manifest__.py
  2. 9
      partner_contact_birthdate/models/res_partner.py
  3. 9
      partner_contact_birthdate/tests/test_birthdate.py

2
partner_contact_birthdate/__manifest__.py

@ -4,7 +4,7 @@
{ {
"name": "Contact's birthdate", "name": "Contact's birthdate",
"version": "10.0.1.0.0",
"version": "10.0.1.1.0",
"author": "Tecnativa," "author": "Tecnativa,"
"Odoo Community Association (OCA)", "Odoo Community Association (OCA)",
"category": "Customer Relationship Management", "category": "Customer Relationship Management",

9
partner_contact_birthdate/models/res_partner.py

@ -1,7 +1,7 @@
# -*- 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 odoo import _, api, fields, models
from odoo import api, fields, models
import logging import logging
@ -30,9 +30,4 @@ class ResPartner(models.Model):
@api.one @api.one
def _birthdate_inverse(self): def _birthdate_inverse(self):
"""Convert the old Char date to the new Date format.""" """Convert the old Char date to the new Date format."""
try:
self.birthdate_date = self.birthdate
except ValueError:
_logger.warn(
_("Could not convert '{0.birthdate}' to date in "
"res.partner {0.id} ({0.name}). Skipping.").format(self))
self.birthdate_date = self.birthdate

9
partner_contact_birthdate/tests/test_birthdate.py

@ -28,12 +28,7 @@ class BadCase(TransactionCase):
def setUp(self): def setUp(self):
super(BadCase, self).setUp() super(BadCase, self).setUp()
self.partner = self.env["res.partner"].create({"name": str(self)}) self.partner = self.env["res.partner"].create({"name": str(self)})
self.birthdate = date.today()
def tearDown(self):
self.assertNotEqual(self.partner.birthdate,
self.partner.birthdate_date)
super(BadCase, self).tearDown()
def test_old_to_new(self): def test_old_to_new(self):
self.partner.birthdate = "Not a date"
with self.assertRaises(ValueError):
self.partner.birthdate = "Not a date"
Loading…
Cancel
Save