Browse Source

Fix and test partner_contact_birthdate too.

Fix flake8 error too.
pull/170/head
Jairo Llopis 9 years ago
parent
commit
f2ba28e980
  1. 3
      partner_contact_birthdate/models.py
  2. 2
      partner_contact_birthdate/tests/__init__.py
  3. 27
      partner_contact_birthdate/tests/test_delete.py
  4. 7
      partner_firstname/__openerp__.py
  5. 1
      partner_firstname/tests/test_delete.py

3
partner_contact_birthdate/models.py

@ -40,7 +40,8 @@ class Partner(models.Model):
@api.depends("birthdate_date")
def _birthdate_compute(self):
"""Store a string of the new date in the old field."""
self.birthdate = self.birthdate_date
if self.exists():
self.birthdate = self.birthdate_date
@api.one
def _birthdate_inverse(self):

2
partner_contact_birthdate/tests/__init__.py

@ -16,4 +16,4 @@
# 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/>.
from . import test_birthdate
from . import test_birthdate, test_delete

27
partner_contact_birthdate/tests/test_delete.py

@ -0,0 +1,27 @@
# -*- coding: utf-8 -*-
# © 2015 Grupo ESOC
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp.tests.common import TransactionCase
class CompanyCase(TransactionCase):
model = "res.partner"
context = {"default_is_company": True}
def test_computing_after_unlink(self):
"""Test what happens if recomputed after unlinking.
This test might seem useless, but really this happens when module
``partner_relations`` is installed.
See https://github.com/OCA/partner-contact/issues/154.
"""
data = {"name": u"Söme name", "birthdate": "2015-09-28"}
record = self.env[self.model].with_context(**self.context).create(data)
record.unlink()
record.recompute()
class PersonCase(CompanyCase):
context = {"default_is_company": False}

7
partner_firstname/__openerp__.py

@ -21,12 +21,13 @@
{
'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,Odoo Community Association (OCA)",
'version': '8.0.2.1.1',
'author': "Camptocamp, Grupo ESOC, Odoo Community Association (OCA)",
"license": "AGPL-3",
'maintainer': 'Camptocamp, Acsone',
'category': 'Extra Tools',
'website': 'http://www.camptocamp.com, http://www.acsone.eu',
'website':
'http://www.camptocamp.com, http://www.acsone.eu, http://grupoesoc.es',
'depends': ['base'],
'data': [
'views/res_partner.xml',

1
partner_firstname/tests/test_delete.py

@ -4,7 +4,6 @@
from openerp.tests.common import TransactionCase
from .base import MailInstalled
from .. import exceptions as ex
class CompanyCase(TransactionCase):

Loading…
Cancel
Save