Skip to content

Commit a8d2dc7

Browse files
committed
Add local-addons and config
1 parent a4c4e5f commit a8d2dc7

File tree

14 files changed

+194
-0
lines changed

14 files changed

+194
-0
lines changed

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ venv/
109109
ENV/
110110
env.bak/
111111
venv.bak/
112+
venv-odoo-14.0
112113

113114
# Spyder project settings
114115
.spyderproject
@@ -127,3 +128,6 @@ dmypy.json
127128

128129
# Pyre type checker
129130
.pyre/
131+
132+
# Folders
133+
odoo/

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Odoo 14 Development Cookbook

local-addons/my_library/__init__.py

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from . import models
2+
from . import controllers
3+
from . import wizard
+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
'name': 'My Library',
3+
'summary': 'Manage books easily',
4+
'description': 'Manage Library',
5+
'author': 'Wytze Jan Riedstra',
6+
'website': 'https://www.example.com',
7+
'category': 'Uncategorized',
8+
'version': '14.0.1',
9+
'depends': ['base'],
10+
'data': [
11+
'security/groups.xml',
12+
'security/ir.model.access.csv',
13+
'views/library_book.xml'
14+
],
15+
'demo': ['demo.xml']
16+
}

local-addons/my_library/controllers/__init__.py

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import library_book
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
from importlib.metadata import requires
2+
from unicodedata import digit
3+
from odoo import models, fields
4+
5+
6+
class LibraryBook(models.Model):
7+
_name = 'library.book'
8+
_description = 'Library Book'
9+
_order = 'date_release desc, name'
10+
_rec_name = 'short_name'
11+
name = fields.Char('Title', required=True)
12+
short_name = fields.Char('Short Title', required=True)
13+
notes = fields.Text('Internal Notes')
14+
state = fields.Selection(
15+
[('draft', 'Not Available'),
16+
('available', 'Available'),
17+
('lost', 'Lost')],
18+
'State')
19+
description = fields.Html('Description')
20+
cover = fields.Binary('Book Cover')
21+
out_of_print = fields.Boolean('Out of Print?')
22+
date_release = fields.Date('Release Date')
23+
date_updated = fields.Datetime('Last Updated')
24+
pages = fields.Integer('Number of Pages')
25+
reader_rating = fields.Float(
26+
'Reader Average Rating',
27+
digits=(14, 4), # Optional precision decimals
28+
)
29+
author_ids = fields.Many2many(
30+
'res.partner',
31+
string='Authors'
32+
)
33+
cost_price = fields.Float(
34+
'Book Cost', digits='Book Price')
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version='1.0' encoding='utf-8'?>
2+
<odoo>
3+
<record id='group_librarian' model='res.groups'>
4+
<field name='name'>Librarians</field>
5+
<field name='users' eval="[(4, ref('base.user_admin'))]" />
6+
</record>
7+
</odoo>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
2+
acl_book,library.book_default,model_library_book,,1,0,0,0
3+
acl_book_librarian,library.book_librarian,model_library_book,group_librarian,1,1,1,1
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
<?xml version='1.0' encoding='utf-8'?>
2+
<odoo>
3+
<record id='library_book_action' model='ir.actions.act_window'>
4+
<field name='name'>Library Books</field>
5+
<field name='res_model'>library.book</field>
6+
<field name="view_mode">tree,form</field>
7+
</record>
8+
9+
<menuitem name='My Library' id='library_base_menu' />
10+
<menuitem name='Books' id='library_book_menu' parent='library_base_menu' action='library_book_action' />
11+
12+
<record id='library_book_view_form' model='ir.ui.view'>
13+
<field name='name'>Library Book Form</field>
14+
<field name='model'>library.book</field>
15+
<field name='arch' type='xml'>
16+
<form>
17+
<group>
18+
<group>
19+
<field name='name' />
20+
<field name='author_ids' widget='many2many_tags' />
21+
<field name='state' />
22+
<field name='pages' />
23+
<field name='cost_price' />
24+
<field name='notes' />
25+
</group>
26+
<group>
27+
<field name='short_name' />
28+
<field name='date_release' />
29+
<field name='date_updated' />
30+
<field name='cover' widget='image' class='oe_avater' />
31+
<field name='reader_rating' />
32+
</group>
33+
</group>
34+
<group>
35+
<field name="description" />
36+
</group>
37+
</form>
38+
</field>
39+
</record>
40+
41+
<record id='library_book_view_tree' model='ir.ui.view'>
42+
<field name='name'>Library Book List</field>
43+
<field name='model'>library.book</field>
44+
<field name='arch' type='xml'>
45+
<tree>
46+
<field name='name' />
47+
<field name='date_release' />
48+
</tree>
49+
</field>
50+
</record>
51+
52+
<record id='library_book_view_search' model='ir.ui.view'>
53+
<field name='name'>Library Book Search</field>
54+
<field name='model'>library.book</field>
55+
<field name='arch' type='xml'>
56+
<search>
57+
<field name='name' />
58+
<field name='author_ids' />
59+
<filter string='No Authors'
60+
name="without_author"
61+
domain="[('author_ids','=',False)]" />
62+
</search>
63+
</field>
64+
</record>
65+
</odoo>

local-addons/my_library/views/views.xml

Whitespace-only changes.

local-addons/my_library/wizard/__init__.py

Whitespace-only changes.

myodoo.cfg

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
[options]
2+
addons_path = /home/odoo/vscode/tutorials/odoo-14-development-cookbook/odoo-dev/odoo/odoo/addons,/home/odoo/vscode/tutorials/odoo-14-development-cookbook/odoo-dev/odoo/addons,/home/odoo/vscode/tutorials/odoo-14-development-cookbook/odoo-dev/local-addons
3+
admin_passwd = admin
4+
csv_internal_sep = ,
5+
data_dir = /home/odoo/.local/share/Odoo
6+
db_host = False
7+
db_maxconn = 64
8+
db_name = odoo-14-test
9+
db_password = False
10+
db_port = False
11+
db_sslmode = prefer
12+
db_template = template0
13+
db_user = False
14+
dbfilter = ^odoo-14-test$
15+
demo = {}
16+
email_from = False
17+
geoip_database = /usr/share/GeoIP/GeoLite2-City.mmdb
18+
http_enable = True
19+
http_interface =
20+
http_port = 8069
21+
import_partial =
22+
limit_memory_hard = 2684354560
23+
limit_memory_soft = 2147483648
24+
limit_request = 8192
25+
limit_time_cpu = 60
26+
limit_time_real = 120
27+
limit_time_real_cron = -1
28+
list_db = True
29+
log_db = False
30+
log_db_level = warning
31+
log_handler = :INFO
32+
log_level = info
33+
logfile =
34+
longpolling_port = 8072
35+
max_cron_threads = 2
36+
osv_memory_age_limit = False
37+
osv_memory_count_limit = False
38+
pg_path =
39+
pidfile =
40+
proxy_mode = False
41+
reportgz = False
42+
screencasts =
43+
screenshots = /tmp/odoo_tests
44+
server_wide_modules = base,web
45+
smtp_password = False
46+
smtp_port = 25
47+
smtp_server = localhost
48+
smtp_ssl = False
49+
smtp_user = False
50+
syslog = False
51+
test_enable = False
52+
test_file =
53+
test_tags = None
54+
transient_age_limit = 1.0
55+
translate_modules = ['all']
56+
unaccent = False
57+
upgrade_path =
58+
without_demo = False
59+
workers = 0
60+

0 commit comments

Comments
 (0)