Skip to content

Commit d177a06

Browse files
cede-odooprbo-odoo
authored andcommitted
[ADD] website airproof: add solution for website theme tutorial
closes odoo#764 Signed-off-by: Antoine Vandevenne (anv) <[email protected]>
1 parent 4c650f3 commit d177a06

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+3187
-0
lines changed

bookprice_sale/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Part of Odoo. See LICENSE file for full copyright and licensing details.
2+
from . import model

bookprice_sale/__manifest__.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
'name': "book_price_sale",
3+
'version': "1.0",
4+
'summary': "Add book_price field in sales order line and invoice order line in sales app",
5+
'description': """
6+
This module will add a button book_price in the sales order line and invoice order line in the sales app.
7+
""",
8+
'author': "priyansi borda",
9+
'depends': ['sale'],
10+
'data': [
11+
"view/sales_order_line_view.xml",
12+
"view/invoice_order_line_view.xml"
13+
],
14+
'application': False,
15+
'installable': True,
16+
'license': 'LGPL-3',
17+
}

bookprice_sale/model/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Part of Odoo. See LICENSE file for full copyright and licensing details.
2+
from . import sale_order_line
3+
from . import account_move_line
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
from odoo import api, fields, models
2+
3+
4+
class AccountMoveLine(models.Model):
5+
_inherit = "account.move.line"
6+
7+
book_price = fields.Float(string="Book Price", compute="_compute_book_price", store=True)
8+
9+
@api.depends("quantity", "product_id.lst_price")
10+
def _compute_book_price(self):
11+
for record in self:
12+
if record.product_id:
13+
record.book_price = record.quantity * record.product_id.lst_price
14+
else:
15+
record.book_price = 0.0
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
from odoo import api, fields, models
2+
3+
4+
class SalesOrderLine(models.Model):
5+
_inherit = "sale.order.line"
6+
7+
book_price = fields.Float(string="Book Price", compute="_compute_book_price", store=True)
8+
9+
@api.depends("product_uom_qty", "product_id.lst_price")
10+
def _compute_book_price(self):
11+
for record in self:
12+
if record.product_id:
13+
record.book_price = record.product_uom_qty * record.product_id.lst_price
14+
else:
15+
record.book_price = 0.0
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<odoo>
2+
<record id="view_account_move_form_inherit_bookprice" model="ir.ui.view">
3+
<field name="name">view.account.move.form.inherit.bookprice</field>
4+
<field name="model">account.move</field>
5+
<field name="inherit_id" ref="account.view_move_form"/>
6+
<field name="arch" type="xml">
7+
<xpath expr="//field[@name='quantity']" position="before">
8+
<field name="book_price"/>
9+
</xpath>
10+
</field>
11+
</record>
12+
</odoo>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<odoo>
2+
<record id="view_sales_order_line_form_inherit_bookprice" model="ir.ui.view">
3+
<field name="name">view.sales.order.line.form.inherit.bookprice</field>
4+
<field name="model">sale.order</field>
5+
<field name="inherit_id" ref="sale.view_order_form"/>
6+
<field name="arch" type="xml">
7+
<xpath expr="//field[@name='order_line']/list//field[@name='price_unit']" position="before">
8+
<field name="book_price"/>
9+
</xpath>
10+
</field>
11+
</record>
12+
</odoo>

website_airproof/README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Odoo Tutorial : Build a website theme
2+
3+
This branch contains the code necessary for the creation of the website for our Airproof example.
4+
Example used to illustrate the exercises given in the Odoo tutorial: Build a website theme.
5+
6+
Here is the final design of the 4 pages of Airproof that will be created throughout this tutorial.
7+
8+
**Home**
9+
![Airproof home page](airproof-home-page.jpg)
10+
11+
**Contact page**
12+
![Airproof contact page](airproof-contact-page.jpg)
13+
14+
**Shop page**
15+
![Airproof shop page](airproof-shop-page.jpg)
16+
17+
**Product page**
18+
![Airproof product page](airproof-product-page.jpg)

website_airproof/__init__.py

Whitespace-only changes.

website_airproof/__manifest__.py

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{
2+
'name': 'Airproof Theme',
3+
'description': 'Airproof Theme - Drones, modelling, camera',
4+
'category': 'Website/Theme',
5+
# 'version': '18.0.1.0',
6+
'author': 'PSBE Designers',
7+
'license': 'LGPL-3',
8+
'depends': ['website_sale', 'website_sale_wishlist', 'website_blog', 'website_mass_mailing'],
9+
'data': [
10+
# Options
11+
'data/presets.xml',
12+
# Menu
13+
'data/menu.xml',
14+
# Shapes
15+
'data/shapes.xml',
16+
# Pages
17+
'data/pages/home.xml',
18+
'data/pages/contact.xml',
19+
# Frontend
20+
'views/website_templates.xml',
21+
'views/website_sale_templates.xml',
22+
'views/website_sale_wishlist_templates.xml',
23+
# Snippets
24+
'views/snippets/options.xml',
25+
'views/snippets/s_airproof_carousel.xml',
26+
# Images
27+
'data/images.xml',
28+
],
29+
'assets': {
30+
'web._assets_primary_variables': [
31+
'website_airproof/static/src/scss/primary_variables.scss',
32+
],
33+
'web._assets_frontend_helpers': [
34+
('prepend', 'website_airproof/static/src/scss/bootstrap_overridden.scss'),
35+
],
36+
'web.assets_frontend': [
37+
# SCSS
38+
'website_airproof/static/src/scss/components/mouse_follower.scss',
39+
'website_airproof/static/src/scss/layout/header.scss',
40+
'website_airproof/static/src/scss/pages/product_page.scss',
41+
'website_airproof/static/src/scss/pages/shop.scss',
42+
'website_airproof/static/src/scss/snippets/caroussel.scss',
43+
'website_airproof/static/src/scss/snippets/newsletter.scss',
44+
'website_airproof/static/src/snippets/s_airproof_carousel/000.scss',
45+
# JS
46+
'website_airproof/static/src/js/mouse_follower.js',
47+
],
48+
},
49+
}

0 commit comments

Comments
 (0)