Change _order for new dict implementation
This commit is contained in:
1 parent
bccb45ea72
commit
057e0dd6c7
2 files changed
+13
-3
No files matched your search
+5
-1
@@ -5,7 +5,6 @@ class Category(OSV):
|
||||
"Product Category"
|
||||
_name = "product.category"
|
||||
_description = __doc__
|
||||
_order = "parent,name"
|
||||
|
||||
name = fields.Char('Name', size=64, required=True)
|
||||
complete_name = fields.Function('get_complete_name', type="char", string='Complete Name')
|
||||
@@ -13,6 +12,11 @@ class Category(OSV):
|
||||
childs = fields.One2Many('product.category', 'parent',
|
||||
string='Childs')
|
||||
|
||||
def __init__(self):
|
||||
super(Category, self).__init__()
|
||||
self._order.insert(0, ('parent', 'ASC'))
|
||||
self._order.insert(1, ('name', 'ASC'))
|
||||
|
||||
def get_complete_name(self, cursor, user, ids, name, arg, context):
|
||||
res = self.name_get(cursor, user, ids, context)
|
||||
return dict(res)
|
||||
|
||||
@@ -8,10 +8,13 @@ class UomCategory(OSV):
|
||||
'Product uom category'
|
||||
_name = 'product.uom.category'
|
||||
_description = __doc__
|
||||
_order = 'name'
|
||||
name = fields.Char('Name', size=64, required=True)
|
||||
uoms = fields.One2Many('product.uom', 'category', 'Unit of Measures')
|
||||
|
||||
def __init__(self):
|
||||
super(UomCategory, self).__init__()
|
||||
self._order.insert(0, ('name', 'ASC'))
|
||||
|
||||
UomCategory()
|
||||
|
||||
|
||||
@@ -19,7 +22,6 @@ class Uom(OSV):
|
||||
'Unit of measure'
|
||||
_name = 'product.uom'
|
||||
_description = __doc__
|
||||
_order = 'name'
|
||||
name = fields.Char('Name', size=64, required=True, states=STATES,)
|
||||
symbol = fields.Char('Symbol', size=10, required=True, states=STATES,)
|
||||
category = fields.Many2One('product.uom.category', 'UOM Category',
|
||||
@@ -37,6 +39,10 @@ class Uom(OSV):
|
||||
required=True, states=STATES,)
|
||||
active = fields.Boolean('Active')
|
||||
|
||||
def __init__(self):
|
||||
super(Uom, self).__init__()
|
||||
self._order.insert(0, ('name', 'ASC'))
|
||||
|
||||
def default_rate(self, cursor, user, context=None):
|
||||
return 1.0
|
||||
|
||||
|
||||
Reference in new issue
Block a user