This repository has been archived by the owner on Jan 6, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
product.py
63 lines (51 loc) · 2.09 KB
/
product.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
from trytond.model import DeactivableMixin, ModelSQL, ModelView, fields
from trytond.modules.product_classification.product import (
ClassificationMixin, classification_tree)
from trytond.pool import PoolMeta
class Template(metaclass=PoolMeta):
__name__ = 'product.template'
@classmethod
def _get_classification(cls):
return super(Template, cls)._get_classification() + [
'product.taxon', 'product.cultivar']
class Taxon(classification_tree('product.taxon'), ModelSQL, ModelView):
'Taxon'
__name__ = 'product.taxon'
rank = fields.Selection([
('domain', 'Domain'),
('kingdom', 'Kingdom'),
('phylum', 'Phylum'),
('division', 'Division'),
('class', 'Class'),
('order', 'Order'),
('family', 'Family'),
('tribe', 'Tribe'),
('genus', 'Genus'),
('section', 'Section'),
('series', 'Series'),
('species', 'Species'),
('variety', 'Variety'),
('form', 'Form'),
], "Type", sort=False)
class Cultivar(ClassificationMixin, ModelSQL, ModelView):
'Cultivar'
__name__ = 'product.cultivar'
taxon = fields.Many2One('product.taxon', 'Taxon', required=True)
groups = fields.Many2Many('product.cultivar-product.cultivar.group',
'cultivar', 'group', 'Groups')
class CultivarGroup(DeactivableMixin, ModelSQL, ModelView):
'Cultivar Group'
__name__ = 'product.cultivar.group'
name = fields.Char('Name', translate=True)
cultivars = fields.Many2Many('product.cultivar-product.cultivar.group',
'group', 'cultivar', 'Cultivars')
class Cultivar_CultivarGroup(ModelSQL):
'Cultivar-CultivarGroup'
__name__ = 'product.cultivar-product.cultivar.group'
cultivar = fields.Many2One(
'product.cultivar', "Cultivar", required=True)
group = fields.Many2One(
'product.cultivar.group', "Group", required=True)
# TODO Grex