Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IMP] product_attribute_types (#1275)
added onchange to fill numeric_value using values name
- Loading branch information
1 parent
042d143
commit 5dc7dfc
Showing
4 changed files
with
51 additions
and
5 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
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# -*- coding: utf-8 -*- | ||
# © 2016 Mikel Arregi Etxaniz - AvanzOSC | ||
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html | ||
from . import test_product_attribute_types |
31 changes: 31 additions & 0 deletions
31
product_attribute_types/tests/test_product_attribute_types.py
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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# -*- coding: utf-8 -*- | ||
# © 2016 Mikel Arregi Etxaniz - AvanzOSC | ||
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html | ||
import openerp.tests.common as common | ||
|
||
|
||
class TestProductAttributeTypes(common.TransactionCase): | ||
|
||
def setUp(self): | ||
super(TestProductAttributeTypes, self).setUp() | ||
self.attribute_model = self.env['product.attribute'] | ||
self.attribute_value_model = self.env['product.attribute.value'] | ||
self.attribute = self.attribute_model.create( | ||
{ | ||
'name': 'attr1', | ||
'attr_type': 'numeric' | ||
} | ||
) | ||
self.attribute_value = self.attribute_value_model.create( | ||
{ | ||
'name': 'value1', | ||
'attribute_id': self.attribute.id | ||
} | ||
) | ||
|
||
def test_onchange_numeric_value_name(self): | ||
self.attribute_value.name = '3' | ||
self.attribute_value.onchange_name() | ||
self.assertEquals(self.attribute_value.numeric_value, | ||
float(self.attribute_value.name), | ||
'Numeric value properly assigned') |