|
@ -1,23 +1,21 @@ |
|
|
# -*- coding: utf-8 -*- |
|
|
# -*- coding: utf-8 -*- |
|
|
"""These tests try to mimic the behavior of the UI form. |
|
|
"""These tests try to mimic the behavior of the UI form. |
|
|
|
|
|
|
|
|
The form operates in onchange mode, and has only some limitations that must be |
|
|
|
|
|
met. |
|
|
|
|
|
|
|
|
The form operates in onchange mode, with its limitations. |
|
|
""" |
|
|
""" |
|
|
|
|
|
|
|
|
from openerp.tests.common import TransactionCase |
|
|
|
|
|
|
|
|
from .base import OnChangeCase |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class PartnerCompanyCase(TransactionCase): |
|
|
|
|
|
|
|
|
class PartnerCompanyCase(OnChangeCase): |
|
|
|
|
|
is_company = True |
|
|
|
|
|
|
|
|
def test_create_from_form(self): |
|
|
def test_create_from_form(self): |
|
|
"""A user creates a company from the form.""" |
|
|
"""A user creates a company from the form.""" |
|
|
name = u"Sôme company" |
|
|
name = u"Sôme company" |
|
|
with self.env.do_in_onchange(): |
|
|
with self.env.do_in_onchange(): |
|
|
# User presses ``new`` |
|
|
# User presses ``new`` |
|
|
partner = self.env["res.partner"].create({}) |
|
|
|
|
|
|
|
|
|
|
|
# User ensures it is a company |
|
|
|
|
|
partner.is_company = True |
|
|
|
|
|
|
|
|
partner = self.new_partner() |
|
|
|
|
|
|
|
|
# User sets a name, which triggers onchanges |
|
|
# User sets a name, which triggers onchanges |
|
|
partner.name = name |
|
|
partner.name = name |
|
@ -34,10 +32,7 @@ class PartnerCompanyCase(TransactionCase): |
|
|
""" |
|
|
""" |
|
|
with self.env.do_in_onchange(): |
|
|
with self.env.do_in_onchange(): |
|
|
# User presses ``new`` |
|
|
# User presses ``new`` |
|
|
partner = self.env["res.partner"].create({}) |
|
|
|
|
|
|
|
|
|
|
|
# User ensures it is a company |
|
|
|
|
|
partner.is_company = True |
|
|
|
|
|
|
|
|
partner = self.new_partner() |
|
|
|
|
|
|
|
|
# User sets a name, which triggers onchanges |
|
|
# User sets a name, which triggers onchanges |
|
|
partner.name = u"Foó" |
|
|
partner.name = u"Foó" |
|
@ -51,16 +46,13 @@ class PartnerCompanyCase(TransactionCase): |
|
|
self.assertEqual(partner.lastname, False) |
|
|
self.assertEqual(partner.lastname, False) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class PartnerContactCase(TransactionCase): |
|
|
|
|
|
|
|
|
class PartnerContactCase(OnChangeCase): |
|
|
def test_create_from_form_only_firstname(self): |
|
|
def test_create_from_form_only_firstname(self): |
|
|
"""A user creates a contact with only the firstname from the form.""" |
|
|
"""A user creates a contact with only the firstname from the form.""" |
|
|
firstname = u"Fïrst" |
|
|
firstname = u"Fïrst" |
|
|
with self.env.do_in_onchange(): |
|
|
with self.env.do_in_onchange(): |
|
|
# User presses ``new`` |
|
|
# User presses ``new`` |
|
|
partner = self.env["res.partner"].create({}) |
|
|
|
|
|
|
|
|
|
|
|
# User ensures it is not a company |
|
|
|
|
|
partner.is_company = False |
|
|
|
|
|
|
|
|
partner = self.new_partner() |
|
|
|
|
|
|
|
|
# Changes firstname, which triggers onchanges |
|
|
# Changes firstname, which triggers onchanges |
|
|
partner.firstname = firstname |
|
|
partner.firstname = firstname |
|
@ -76,10 +68,7 @@ class PartnerContactCase(TransactionCase): |
|
|
lastname = u"Läst" |
|
|
lastname = u"Läst" |
|
|
with self.env.do_in_onchange(): |
|
|
with self.env.do_in_onchange(): |
|
|
# User presses ``new`` |
|
|
# User presses ``new`` |
|
|
partner = self.env["res.partner"].create({}) |
|
|
|
|
|
|
|
|
|
|
|
# User ensures it is not a company |
|
|
|
|
|
partner.is_company = False |
|
|
|
|
|
|
|
|
partner = self.new_partner() |
|
|
|
|
|
|
|
|
# Changes lastname, which triggers onchanges |
|
|
# Changes lastname, which triggers onchanges |
|
|
partner.lastname = lastname |
|
|
partner.lastname = lastname |
|
@ -96,10 +85,7 @@ class PartnerContactCase(TransactionCase): |
|
|
lastname = u"Läst" |
|
|
lastname = u"Läst" |
|
|
with self.env.do_in_onchange(): |
|
|
with self.env.do_in_onchange(): |
|
|
# User presses ``new`` |
|
|
# User presses ``new`` |
|
|
partner = self.env["res.partner"].create({}) |
|
|
|
|
|
|
|
|
|
|
|
# User ensures it is not a company |
|
|
|
|
|
partner.is_company = False |
|
|
|
|
|
|
|
|
partner = self.new_partner() |
|
|
|
|
|
|
|
|
# Changes firstname, which triggers onchanges |
|
|
# Changes firstname, which triggers onchanges |
|
|
partner.firstname = firstname |
|
|
partner.firstname = firstname |
|
|