Skip to content

Commit 6a756c1

Browse files
committed
[IMP] boiler plate for custom website theme
1 parent 4032c93 commit 6a756c1

File tree

2 files changed

+147
-0
lines changed

2 files changed

+147
-0
lines changed

boiler-plate/odoo.sh

100644100755
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
#!/bin/bash
22
# make a directory
33

4+
# testing
5+
# new comment
6+
7+
48
mkdir module_name
59

610
# go to current directory

boiler-plate/odoo_theme.sh

Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
#!/bin/bash
2+
# make a directory
3+
4+
mkdir my_theme
5+
6+
# go to current directory
7+
cd my_theme
8+
9+
# making odoo standard structure
10+
mkdir views
11+
mkdir static
12+
13+
# __init__ file
14+
touch __init__.py
15+
echo "# -*- coding: utf-8 -*-
16+
# Part of Odoo. See LICENSE file for full copyright and licensing details.
17+
18+
" > __init__.py
19+
20+
# __manifest__ file
21+
touch __manifest__.py
22+
echo "# -*- coding: utf-8 -*-
23+
# Part of Odoo. See LICENSE file for full copyright and licensing details.
24+
{
25+
'name': 'My theme',
26+
'version': '16.0.0.1',
27+
'category': 'Hidden',
28+
'description': '''
29+
Odoo website E-comm theme
30+
''',
31+
'depends': ['website',],
32+
# add dependency if required
33+
# 'website_mail_group', 'website_sale', 'website_sale_wishlist',
34+
'data': [
35+
36+
# data
37+
'data/options.xml',
38+
# 'data/images.xml',
39+
40+
# pages
41+
'data/pages/homepage.xml',
42+
43+
# views
44+
'views/header.xml',
45+
'views/footer.xml',
46+
47+
# snippets
48+
'views/snippets/options.xml',
49+
'views/snippets/s_shopper_rating.xml',
50+
],
51+
'assets': {
52+
# override primary variable's like fonts, color etc
53+
'web._assets_primary_variables': [
54+
'my_theme/static/src/scss/primary_variables.scss',
55+
],
56+
'web.assets_frontend': [
57+
58+
# layout
59+
# 'my_theme/static/src/scss/layout/header.scss',
60+
# 'my_theme/static/src/scss/layout/footer.scss',
61+
],
62+
},
63+
'application': True,
64+
'auto_install': False,
65+
'license': 'LGPL-3',
66+
}
67+
" > __manifest__.py
68+
69+
#
70+
cd views
71+
touch footer.xml
72+
echo '<?xml version="1.0" encoding="UTF-8"?>
73+
74+
<!-- replace all `` to single string -->
75+
76+
<odoo>
77+
78+
<template id="footer_opt" inherit_id="website.snippet_options" name="My theme - Link">
79+
<xpath expr="//we-select[@data-variable=`footer-template`]" position="inside">
80+
<we-button title="My theme name shows on footer selection"
81+
data-customize-website-views="my_theme.my_footer_name"
82+
data-customize-website-variable="`My Theme`"
83+
data-img="/my_theme/static/src/img/_wbuilder/footer_header_opt.svg"/>
84+
</xpath>
85+
</template>
86+
87+
<record id="shopper.my_footer_name" model="ir.ui.view">
88+
<field name="name">Shooper Footer</field>
89+
<field name="type">qweb</field>
90+
<field name="key">my_theme.my_footer_name</field>
91+
<field name="inherit_id" ref="website.layout" />
92+
<field name="mode">extension</field>
93+
<field name="arch" type="xml">
94+
<xpath expr="//div[@id=`footer`]" position="replace">
95+
<div id="footer" class="oe_structure oe_structure_solo" t-ignore="true" t-if="not no_footer">
96+
<!-- Code goes here for snippets -->
97+
</div>
98+
</xpath>
99+
</field>
100+
</record>
101+
102+
103+
</odoo>
104+
105+
' > footer.xml
106+
107+
touch header.xml
108+
echo '<?xml version="1.0" encoding="UTF-8"?>
109+
110+
<!-- replace all `` to single string -->
111+
112+
<odoo>
113+
<!-- Theme Heade Options -->
114+
<template id="header_option" inherit_id="website.snippet_options" name="My header">
115+
<xpath expr="//we-select[@data-variable=`header-template`]" position="inside">
116+
<we-button title="My header name that shows in header selection"
117+
data-customize-website-views="my_theme.my_header_name"
118+
data-customize-website-variable="`my_theme`"
119+
data-img="/my_theme/static/src/img/_wbuilder/footer_header_opt.svg"/>
120+
</xpath>
121+
</template>
122+
123+
<!-- Theame Header Layout -->
124+
<record id="my_header_name" model="ir.ui.view">
125+
<field name="name">my_theme Header</field>
126+
<field name="type">qweb</field>
127+
<field name="key">my_theme.my_header_name</field>
128+
<field name="inherit_id" ref="website.layout"/>
129+
<field name="mode">extension</field>
130+
<field name="arch" type="xml">
131+
<xpath expr="//header//nav" position="replace">
132+
133+
<-- Snippet code goes here -->
134+
135+
</xpath>
136+
</field>
137+
</record>
138+
139+
140+
141+
</odoo>
142+
143+
' > header.xml

0 commit comments

Comments
 (0)