-
Notifications
You must be signed in to change notification settings - Fork 0
/
product.py
54 lines (38 loc) · 1.29 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
from trytond.model import ModelSQL, ModelView, fields
LANGUAGES = [
('English', 'English'),
('Hindi', 'Hindi'),
]
class Author(ModelSQL, ModelView):
"Author"
_name = "party.author"
_description = __doc__
books = fields.One2Many('product.book', 'author', 'Books')
Author()
class Publisher(ModelSQL, ModelView):
"Publisher"
_name = "party.publisher"
_descriptiom = __doc__
books = fields.One2Many('product.book', 'publisher', 'Books')
party = fields.Many2One('party.party', 'Party')
Publisher()
class Book(ModelSQL, ModelView):
"Book"
_name = "product.book"
_description = __doc__
products = fields.One2Many('product.product', 'book', 'Products')
title = fields.Char('Title', required=True)
author = fields.Many2One('party.author', 'Author', required=True)
isbn10 = fields.Integer('ISBN-10')
isbn13 = fields.Integer('ISBN-13')
publishing_year = fields.Integer('Publishing Year')
number_of_pages = fields.Integer('Number of Pages')
language = fields.Selection(LANGUAGES, 'Language', required=True)
description = fields.Text('Desciption')
Book()
class Product(ModelSQL, ModelView):
"Product"
_name = "product.product"
_description = __doc__
book = fields.Many2One('product.book', 'Book')
Product()