forked from OCA/server-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FWP] - Forward porting changes from OCA#1253
- Loading branch information
1 parent
ea30f4c
commit 6b76c1b
Showing
4 changed files
with
82 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,14 @@ | ||
# Copyright 2016-2017 Akretion (http://www.akretion.com) | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
{'name': 'Onchange Helper', | ||
'version': '12.0.1.0.0', | ||
'summary': 'Technical module that ease execution of onchange in Python code', | ||
'author': 'Akretion,Camptocamp,Odoo Community Association (OCA)', | ||
'website': 'https://github.com/OCA/server-tools', | ||
'license': 'AGPL-3', | ||
'category': 'Generic Modules', | ||
'depends': ['base'], | ||
'installable': True, | ||
} | ||
{ | ||
'name': 'Onchange Helper', | ||
'version': '12.0.1.0.0', | ||
'summary': 'Technical module that ease execution of onchange in Python code', | ||
'author': 'Akretion,Camptocamp,Odoo Community Association (OCA)', | ||
'website': 'https://github.com/OCA/server-tools', | ||
'license': 'AGPL-3', | ||
'category': 'Generic Modules', | ||
'depends': ['base'], | ||
'installable': True, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,13 +5,11 @@ | |
|
||
|
||
class TestOnchangeHelper(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'] | ||
input_vals, ['parent_id'] | ||
) | ||
self.assertIn('commercial_partner_id', updated_vals) | ||
self.assertIn('display_name', updated_vals) | ||
|
@@ -21,8 +19,25 @@ 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'] | ||
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) | ||
|
||
def test_playing_onchange_on_record(self): | ||
company = self.env.ref('base.main_company') | ||
result = company.play_onchanges( | ||
{'email': '[email protected]'}, ['email'] | ||
) | ||
self.assertEqual( | ||
result['rml_footer'], | ||
u'Phone: +1 555 123 8069 | Email: [email protected] | ' | ||
u'Website: http://www.example.com', | ||
) | ||
self.assertEqual(company.email, u'[email protected]') |