Browse Source
Merge pull request #1458 from EBII/11-update_onchange_helper
Merge pull request #1458 from EBII/11-update_onchange_helper
11 update onchange helperpull/1466/head
Jordi Ballester Alomar
6 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 57 additions and 65 deletions
-
11onchange_helper/README.rst
-
1onchange_helper/models/__init__.py
-
80onchange_helper/models/base.py
-
1onchange_helper/tests/__init__.py
-
29onchange_helper/tests/test_onchange_helper.py
@ -1,3 +1,2 @@ |
|||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). |
|||
|
|||
from . import base |
@ -1,3 +1,2 @@ |
|||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). |
|||
|
|||
from . import test_onchange_helper |
@ -1,28 +1,13 @@ |
|||
# Copyright 2017 Onestein (<http://www.onestein.eu>) |
|||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). |
|||
|
|||
from odoo.tests.common import TransactionCase |
|||
import odoo.tests.common as common |
|||
|
|||
|
|||
class TestOnchangeHelper(TransactionCase): |
|||
class TestOnchangeHelper(common.TransactionCase): |
|||
|
|||
def test01_partner_parent(self): |
|||
main_partner = self.env.ref('base.main_partner') |
|||
input_vals = dict(partner_id=main_partner.id) |
|||
updated_vals = self.env['res.partner'].play_onchanges( |
|||
input_vals, |
|||
['parent_id'] |
|||
) |
|||
self.assertIn('commercial_partner_id', updated_vals) |
|||
self.assertIn('display_name', updated_vals) |
|||
self.assertIn('partner_id', updated_vals) |
|||
|
|||
def test02_partner_country(self): |
|||
partner_demo = self.env.ref('base.partner_demo') |
|||
input_vals = {'partner_id': partner_demo.id} |
|||
updated_vals = self.env['res.partner'].play_onchanges( |
|||
input_vals, |
|||
['country_id'] |
|||
) |
|||
self.assertIn('contact_address', updated_vals) |
|||
self.assertIn('partner_id', updated_vals) |
|||
def test_playing_onchange_on_model(self): |
|||
result = self.env['res.partner'].play_onchanges({ |
|||
'company_type': 'company', |
|||
}, ['company_type']) |
|||
self.assertEqual(result['is_company'], True) |
Write
Preview
Loading…
Cancel
Save
Reference in new issue