Files
tryton/category.py
T

18 lines
676 B
Python
Raw Normal View History

2014-12-02 12:55:30 +01:00
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
2018-05-12 00:49:18 +02:00
from trytond.model import ModelView, ModelSQL, fields, tree
2008-03-03 18:36:08 +01:00
2008-03-04 11:56:55 +01:00
2018-05-12 00:49:18 +02:00
class Category(tree(separator=' / '), ModelSQL, ModelView):
2008-03-03 18:36:08 +01:00
"Product Category"
2012-09-24 22:18:00 +02:00
__name__ = "product.category"
name = fields.Char('Name', required=True, translate=True)
2012-04-03 20:07:18 +02:00
parent = fields.Many2One('product.category', 'Parent', select=True)
2008-03-03 18:36:08 +01:00
childs = fields.One2Many('product.category', 'parent',
2009-03-19 19:57:09 +01:00
string='Children')
2008-03-03 18:36:08 +01:00
2012-09-24 22:18:00 +02:00
@classmethod
def __setup__(cls):
super(Category, cls).__setup__()
cls._order.insert(0, ('name', 'ASC'))