[IMP] doc: update website to scaffold

This commit is contained in:
Xavier Morel 2015-01-28 16:13:31 +01:00
parent d17f22cde7
commit 205143cc32
25 changed files with 612 additions and 418 deletions

View File

@ -19,29 +19,19 @@ Modules customize the behavior of an Odoo installation, either by adding new
behaviors or by altering existing ones (including behaviors added by other behaviors or by altering existing ones (including behaviors added by other
modules). modules).
First let's create a *module directory* which will contain a single module in :ref:`Odoo's scaffolding <reference/cmdline/scaffold>` can setup a basic
our case but may store multiple related (a project's) or not really related module to quickly get started, simply invoke:
(a company's) modules:
.. code-block:: console .. code-block:: console
$ mkdir my-modules $ ./odoo.py scaffold Academy my-modules
then let's create the module's own directory: This will automatically create a ``my-modules`` *module directory* with an
``academy`` module inside. The directory can be an existing module directory
.. code-block:: console if you want, but the module name must be unique for the directory.
$ mkdir my-modules/academy
An Odoo module is a valid `Python package
<http://docs.python.org/2/tutorial/modules.html#packages>`_ so it needs an
empty ``__init__.py`` file.
Finally the mark of an Odoo module is the
:ref:`manifest file <reference/module/manifest>`, a Python dictionary describing
various module metadata.
.. patch:: .. patch::
:hidden:
A demonstration module A demonstration module
====================== ======================
@ -52,30 +42,25 @@ Although it does absolutely nothing yet we can install it:
* start the Odoo server * start the Odoo server
.. code-block:: console .. code-block:: console
$ ./odoo.py --addons-path addons,my-modules $ ./odoo.py --addons-path addons,my-modules
* go to http://localhost:8069 * go to http://localhost:8069
* create a new database including demonstration data * create a new database including demonstration data
* to go :menuselection:`Settings --> Modules --> Installed Modules` * to go :menuselection:`Settings --> Modules --> Local Modules`
* in the top-right corner remove the *Installed* filter and search for * in the top-right corner remove the *Installed* filter and search for
*academy* *academy*
* click the :guilabel:`Install` button for the *Academy* module * click the :guilabel:`Install` button for the *Academy* module
.. seealso::
* In a production development setting, modules should generally be created
using :ref:`Odoo's scaffolding <reference/cmdline/scaffold>` rather than by
hand
To the browser To the browser
============== ==============
:ref:`Controllers <reference/http/controllers>` interpret browser requests and :ref:`Controllers <reference/http/controllers>` interpret browser requests and
send data back. send data back.
Add a simple controller and import it (so Odoo can find it): Add a simple controller and ensure it is imported by ``__init__.py`` (so
Odoo can find it):
.. patch:: .. patch::
@ -85,8 +70,8 @@ Shut down your server (:kbd:`^C`) then restart it:
$ ./odoo.py --addons-path addons,my-modules $ ./odoo.py --addons-path addons,my-modules
and open a page to http://localhost:8069/academy/, you should see your "page" and open a page to http://localhost:8069/academy/academy/, you should see your
appear: "page" appear:
.. figure:: website/helloworld.png .. figure:: website/helloworld.png
@ -100,8 +85,8 @@ display logic. Odoo allows any Python templating system, but provides its
own :ref:`QWeb <reference/qweb>` templating system which integrates with other own :ref:`QWeb <reference/qweb>` templating system which integrates with other
Odoo features. Odoo features.
Let's create an XML file for our first template, register the template in the Create a template and ensure the template file is registered in the
manifest and alter the controller to use our template: ``__openerp__.py`` manifest, and alter the controller to use our template:
.. patch:: .. patch::
@ -109,7 +94,7 @@ The templates iterates (``t-foreach``) on all the teachers (passed through the
*template context*), and prints each teacher in its own paragraph. *template context*), and prints each teacher in its own paragraph.
Finally restart Odoo and update the module's data (to install the template) Finally restart Odoo and update the module's data (to install the template)
by going to :menuselection:`Settings --> Modules --> Installed Modules --> by going to :menuselection:`Settings --> Modules --> Local Modules -->
Academy` and clicking :guilabel:`Upgrade`. Academy` and clicking :guilabel:`Upgrade`.
.. tip:: .. tip::
@ -121,7 +106,7 @@ Academy` and clicking :guilabel:`Upgrade`.
$ odoo.py --addons-path addons,my-modules -d academy -u academy $ odoo.py --addons-path addons,my-modules -d academy -u academy
Going to http://localhost:8069/academy/ should now result in: Going to http://localhost:8069/academy/academy/ should now result in:
.. image:: website/basic-list.png .. image:: website/basic-list.png
@ -137,7 +122,8 @@ thereof, so we're now going to move our data to the database.
Defining the data model Defining the data model
----------------------- -----------------------
First define an Odoo model file and import it: Define a teacher model, and ensure it is imported from ``__init__.py`` so it
is correctly loaded:
.. patch:: .. patch::
@ -165,7 +151,7 @@ Demonstration data
The second step is to add some demonstration data to the system so it's The second step is to add some demonstration data to the system so it's
possible to test it easily. This is done by adding a ``demo`` possible to test it easily. This is done by adding a ``demo``
:ref:`data file <reference/data>` to the manifest: :ref:`data file <reference/data>`, which must be linked from the manifest:
.. patch:: .. patch::
@ -194,8 +180,8 @@ The last step is to alter model and template to use our demonstration data:
Restart the server and update the module (in order to update the manifest Restart the server and update the module (in order to update the manifest
and templates and load the demo file) then navigate to and templates and load the demo file) then navigate to
http://localhost:8069/academy/. The page should look little different: names http://localhost:8069/academy/academy/. The page should look little different:
should simply be prefixed by a number (the database identifier for the names should simply be prefixed by a number (the database identifier for the
teacher). teacher).
Website support Website support
@ -216,9 +202,9 @@ integration and a few other services (e.g. default styling, theming) via the
.. patch:: .. patch::
After restarting the server while updating the module (in order to update the After restarting the server while updating the module (in order to update the
manifest and template) access http://localhost:8069/academy/ should yield a manifest and template) access http://localhost:8069/academy/academy/ should
nicer looking page with branding and a number of built-in page elements yield a nicer looking page with branding and a number of built-in page
(top-level menu, footer, …) elements (top-level menu, footer, …)
.. image:: website/layout.png .. image:: website/layout.png
@ -396,7 +382,7 @@ let's also add views so we can see and edit a course's teacher:
It should also be possible to create new courses directly from a teacher's It should also be possible to create new courses directly from a teacher's
page, or to see all the courses a teacher gives, so add page, or to see all the courses a teacher gives, so add
:class:`the inverse relationship <openerp.fields.One2many` to the *teachers* :class:`the inverse relationship <openerp.fields.One2many>` to the *teachers*
model: model:
.. patch:: .. patch::

View File

@ -1,19 +1,23 @@
# HG changeset patch # HG changeset patch
# Parent 91c0cc5b319e7bf240d359817b8bd044769a4f5c # Parent 91c0cc5b319e7bf240d359817b8bd044769a4f5c
diff -r 91c0cc5b319e -r c77aa2c3341b academy/__openerp__.py # Parent 0a9ec16d98785205f25868bc23485569a1444cf3
--- a/academy/__openerp__.py Mon Aug 11 16:49:10 2014 +0200
+++ b/academy/__openerp__.py Mon Aug 11 16:50:01 2014 +0200 diff --git a/academy/__openerp__.py b/academy/__openerp__.py
@@ -8,6 +8,7 @@ --- a/academy/__openerp__.py
'depends': ['base'], +++ b/academy/__openerp__.py
# data files which are always installed @@ -24,7 +24,7 @@
# always loaded
'data': [ 'data': [
+ 'ir.model.access.csv', - # 'security/ir.model.access.csv',
+ 'security/ir.model.access.csv',
'templates.xml', 'templates.xml',
], ],
} # only loaded in demonstration mode
diff -r 91c0cc5b319e -r c77aa2c3341b academy/ir.model.access.csv diff --git a/academy/security/ir.model.access.csv b/academy/security/ir.model.access.csv
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 --- a/academy/security/ir.model.access.csv
+++ b/academy/ir.model.access.csv Mon Aug 11 16:50:01 2014 +0200 +++ b/academy/security/ir.model.access.csv
@@ -0,0 +1,2 @@ @@ -1,2 +1,2 @@
+id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
-access_academy_academy,academy.academy,model_academy_academy,,1,0,0,0
+access_academy_teachers,access_academy_teachers,model_academy_teachers,,1,0,0,0 +access_academy_teachers,access_academy_teachers,model_academy_teachers,,1,0,0,0

View File

@ -1,19 +1,22 @@
# HG changeset patch # HG changeset patch
# Parent 78b4476f35cbef86ee4f858daf843e3b932fb9fa # Parent 78b4476f35cbef86ee4f858daf843e3b932fb9fa
diff -r 78b4476f35cb -r d5ad2ad84a5d academy/__init__.py # Parent 0a4f5e3206a0738201a40d2d1a88f41fdbbc98bf
--- a/academy/__init__.py Mon Aug 11 16:09:21 2014 +0200
+++ b/academy/__init__.py Mon Aug 11 16:12:38 2014 +0200 diff --git a/academy/controllers.py b/academy/controllers.py
@@ -0,0 +1,1 @@ --- a/academy/controllers.py
+from . import controllers +++ b/academy/controllers.py
diff -r 78b4476f35cb -r d5ad2ad84a5d academy/controllers.py @@ -1,10 +1,10 @@
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 # -*- coding: utf-8 -*-
+++ b/academy/controllers.py Mon Aug 11 16:12:38 2014 +0200 from openerp import http
@@ -0,0 +1,8 @@
+# -*- coding: utf-8 -*- -# class Academy(http.Controller):
+from openerp import http -# @http.route('/academy/academy/', auth='public')
+ -# def index(self, **kw):
-# return "Hello, world"
+class Academy(http.Controller): +class Academy(http.Controller):
+ @http.route('/academy/', auth='public') + @http.route('/academy/academy/', auth='public')
+ def index(self): + def index(self, **kw):
+ return "Hello, world!" + return "Hello, world"
+
# @http.route('/academy/academy/objects/', auth='public')
# def list(self, **kw):

View File

@ -1,19 +1,18 @@
# HG changeset patch # HG changeset patch
# Parent 3e800beb7db0f9f05bfd4db275c86e8903d4f127 # Parent 3e800beb7db0f9f05bfd4db275c86e8903d4f127
diff -r 3e800beb7db0 -r 91c0cc5b319e academy/__init__.py # Parent 4082801768b28c2871920e41d23b7879763e763e
--- a/academy/__init__.py Mon Aug 11 16:36:15 2014 +0200
+++ b/academy/__init__.py Mon Aug 11 16:49:10 2014 +0200 diff --git a/academy/models.py b/academy/models.py
@@ -1,1 +1,2 @@ --- a/academy/models.py
from . import controllers +++ b/academy/models.py
+from . import models @@ -2,7 +2,7 @@
diff -r 3e800beb7db0 -r 91c0cc5b319e academy/models.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 from openerp import models, fields, api
+++ b/academy/models.py Mon Aug 11 16:49:10 2014 +0200
@@ -0,0 +1,7 @@ -# class academy(models.Model):
+from openerp import fields -# _name = 'academy.academy'
+from openerp import models
+
+class Teachers(models.Model): +class Teachers(models.Model):
+ _name = 'academy.teachers' + _name = 'academy.teachers'
+
-# name = fields.Char()
+ name = fields.Char() + name = fields.Char()

View File

@ -1,21 +1,23 @@
# HG changeset patch # HG changeset patch
# Parent 4814709fe1c52515f5108623c2c8f0bce57ffac0 # Parent 4814709fe1c52515f5108623c2c8f0bce57ffac0
diff -r 4814709fe1c5 -r 216904cc7636 academy/models.py # Parent 926b3fdd1bba025d9543bb85ac40159b392ba13c
--- a/academy/models.py Tue Aug 12 17:18:59 2014 +0200
+++ b/academy/models.py Tue Aug 12 17:24:44 2014 +0200 diff --git a/academy/models.py b/academy/models.py
@@ -5,3 +5,4 @@ class Teachers(models.Model): --- a/academy/models.py
+++ b/academy/models.py
@@ -6,3 +6,4 @@ class Teachers(models.Model):
_name = 'academy.teachers' _name = 'academy.teachers'
name = fields.Char() name = fields.Char()
+ biography = fields.Html() + biography = fields.Html()
diff -r 4814709fe1c5 -r 216904cc7636 academy/templates.xml diff --git a/academy/templates.xml b/academy/templates.xml
--- a/academy/templates.xml Tue Aug 12 17:18:59 2014 +0200 --- a/academy/templates.xml
+++ b/academy/templates.xml Tue Aug 12 17:24:44 2014 +0200 +++ b/academy/templates.xml
@@ -21,6 +21,7 @@ @@ -21,6 +21,7 @@
<div class="oe_structure"> <div class="oe_structure">
<div class="container"> <div class="container">
<h3><t t-esc="person.name"/></h3> <h3><t t-esc="person.name"/></h3>
+ <div><t t-esc="person.biography"/></div> + <div><t t-esc="person.biography"/></div>
</div> </div>
</div> </div>
<div class="oe_structure"/> <div class="oe_structure"/>

View File

@ -1,16 +1,18 @@
# HG changeset patch # HG changeset patch
# Parent 216904cc7636679adbf1a5a211070e739c59c3a8 # Parent 216904cc7636679adbf1a5a211070e739c59c3a8
diff -r 216904cc7636 -r d5b8a2de3e35 academy/templates.xml # Parent edeaf1ebff99c9b3d7cbe1925ca3d2ece519ba52
--- a/academy/templates.xml Tue Aug 12 17:24:44 2014 +0200
+++ b/academy/templates.xml Tue Aug 12 17:25:15 2014 +0200 diff --git a/academy/templates.xml b/academy/templates.xml
--- a/academy/templates.xml
+++ b/academy/templates.xml
@@ -20,8 +20,8 @@ @@ -20,8 +20,8 @@
<div class="oe_structure"/> <div class="oe_structure"/>
<div class="oe_structure"> <div class="oe_structure">
<div class="container"> <div class="container">
- <h3><t t-esc="person.name"/></h3> - <h3><t t-esc="person.name"/></h3>
- <div><t t-esc="person.biography"/></div> - <div><t t-esc="person.biography"/></div>
+ <h3 t-field="person.name"/> + <h3 t-field="person.name"/>
+ <div t-field="person.biography"/> + <div t-field="person.biography"/>
</div> </div>
</div> </div>
<div class="oe_structure"/> <div class="oe_structure"/>

View File

@ -1,9 +1,11 @@
# HG changeset patch # HG changeset patch
# Parent 957395d27f63dfdb2ea0dacdbe72bc35e724ddcc # Parent 957395d27f63dfdb2ea0dacdbe72bc35e724ddcc
diff -r 957395d27f63 -r 6106208621f0 academy/models.py # Parent 7156498d3cffb6128e73da2e351f2b5af5f7be63
--- a/academy/models.py Wed Aug 13 15:06:30 2014 +0200
+++ b/academy/models.py Wed Aug 13 16:32:26 2014 +0200 diff --git a/academy/models.py b/academy/models.py
@@ -11,6 +11,7 @@ class Teachers(models.Model): --- a/academy/models.py
+++ b/academy/models.py
@@ -12,6 +12,7 @@ class Teachers(models.Model):
class Courses(models.Model): class Courses(models.Model):
_name = 'academy.courses' _name = 'academy.courses'
@ -11,9 +13,9 @@ diff -r 957395d27f63 -r 6106208621f0 academy/models.py
name = fields.Char() name = fields.Char()
teacher_id = fields.Many2one('academy.teachers', string="Teacher") teacher_id = fields.Many2one('academy.teachers', string="Teacher")
diff -r 957395d27f63 -r 6106208621f0 academy/views.xml diff --git a/academy/views.xml b/academy/views.xml
--- a/academy/views.xml Wed Aug 13 15:06:30 2014 +0200 --- a/academy/views.xml
+++ b/academy/views.xml Wed Aug 13 16:32:26 2014 +0200 +++ b/academy/views.xml
@@ -60,6 +60,10 @@ @@ -60,6 +60,10 @@
<label for="teacher_id"/> <label for="teacher_id"/>
<field name="teacher_id"/> <field name="teacher_id"/>

View File

@ -1,10 +1,12 @@
# HG changeset patch # HG changeset patch
# Parent 122340f4360287bbc53f54e53ac609a8e7237796 # Parent 122340f4360287bbc53f54e53ac609a8e7237796
diff -r 122340f43602 -r 91ffd360f3ff academy/controllers.py # Parent 1f9194514fa81c49b9bc7922a010513d816a0c2e
--- a/academy/controllers.py Tue Aug 12 16:52:38 2014 +0200
+++ b/academy/controllers.py Tue Aug 12 17:02:14 2014 +0200 diff --git a/academy/controllers.py b/academy/controllers.py
@@ -9,7 +9,9 @@ class Academy(http.Controller): --- a/academy/controllers.py
'teachers': Teachers.search([]), +++ b/academy/controllers.py
@@ -9,9 +9,11 @@ class Academy(http.Controller):
'teachers': Teachers.search([])
}) })
- @http.route('/academy/<int:id>/', auth='public', website=True) - @http.route('/academy/<int:id>/', auth='public', website=True)
@ -16,24 +18,27 @@ diff -r 122340f43602 -r 91ffd360f3ff academy/controllers.py
+ 'person': teacher + 'person': teacher
+ }) + })
diff -r 122340f43602 -r 91ffd360f3ff academy/templates.xml
--- a/academy/templates.xml Tue Aug 12 16:52:38 2014 +0200 # @http.route('/academy/academy/objects/', auth='public')
+++ b/academy/templates.xml Tue Aug 12 17:02:14 2014 +0200 diff --git a/academy/templates.xml b/academy/templates.xml
@@ -11,4 +11,17 @@ --- a/academy/templates.xml
</div> +++ b/academy/templates.xml
</t> @@ -12,6 +12,18 @@
</template> </div>
+ </t>
+ <template id="biography"> </template>
+ <t t-call="website.layout"> + <template id="biography">
+ <t t-set="title">Academy</t> + <t t-call="website.layout">
+ <div class="oe_structure"/> + <t t-set="title">Academy</t>
+ <div class="oe_structure"> + <div class="oe_structure"/>
+ <div class="container"> + <div class="oe_structure">
+ <p><t t-esc="person.id"/> <t t-esc="person.name"/></p> + <div class="container">
+ </div> + <p><t t-esc="person.id"/> <t t-esc="person.name"/></p>
+ </div> + </div>
+ <div class="oe_structure"/> + </div>
+ </t> + <div class="oe_structure"/>
+ </template> + </t>
</data></openerp> + </template>
<!-- <template id="object"> -->
<!-- <h1><t t-esc="object.display_name"/></h1> -->
<!-- <dl> -->

View File

@ -1,17 +1,11 @@
# HG changeset patch # HG changeset patch
# Parent c3705f93fcea86a279f2c31204cc0c2914e784d8 # Parent c3705f93fcea86a279f2c31204cc0c2914e784d8
# Parent 8f2d190d879cdf6464bd61f7994b8b582befcafd
diff --git a/academy/ir.model.access.csv b/academy/ir.model.access.csv
--- a/academy/ir.model.access.csv
+++ b/academy/ir.model.access.csv
@@ -1,2 +1,3 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_academy_teachers,access_academy_teachers,model_academy_teachers,,1,0,0,0
+access_academy_courses,access_academy_courses,model_academy_courses,,1,0,0,0
diff --git a/academy/models.py b/academy/models.py diff --git a/academy/models.py b/academy/models.py
--- a/academy/models.py --- a/academy/models.py
+++ b/academy/models.py +++ b/academy/models.py
@@ -6,3 +6,9 @@ class Teachers(models.Model): @@ -7,3 +7,9 @@ class Teachers(models.Model):
name = fields.Char() name = fields.Char()
biography = fields.Html() biography = fields.Html()
@ -21,3 +15,11 @@ diff --git a/academy/models.py b/academy/models.py
+ +
+ name = fields.Char() + name = fields.Char()
+ teacher_id = fields.Many2one('academy.teachers', string="Teacher") + teacher_id = fields.Many2one('academy.teachers', string="Teacher")
diff --git a/academy/security/ir.model.access.csv b/academy/security/ir.model.access.csv
--- a/academy/security/ir.model.access.csv
+++ b/academy/security/ir.model.access.csv
@@ -1,2 +1,3 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_academy_teachers,access_academy_teachers,model_academy_teachers,,1,0,0,0
+access_academy_courses,access_academy_courses,model_academy_courses,,1,0,0,0
\ No newline at end of file

View File

@ -1,16 +1,21 @@
# HG changeset patch # HG changeset patch
# Parent 1708c59c9731207e06ca84529c839c571e622481 # Parent 1708c59c9731207e06ca84529c839c571e622481
diff -r 1708c59c9731 -r c706c2ec2832 academy/templates.xml # Parent ac472417df8770ce9b6922968aa86779a86be35c
--- a/academy/templates.xml Thu Aug 14 14:53:52 2014 +0200
+++ b/academy/templates.xml Thu Aug 14 16:08:10 2014 +0200 diff --git a/academy/templates.xml b/academy/templates.xml
@@ -28,4 +28,10 @@ --- a/academy/templates.xml
<div class="oe_structure"/> +++ b/academy/templates.xml
</t> @@ -28,6 +28,13 @@
</template> <div class="oe_structure"/>
</t>
</template>
+ +
+ <template id="product_item_hide_no_price" inherit_id="website_sale.products_item"> + <template id="product_item_hide_no_price" inherit_id="website_sale.products_item">
+ <xpath expr="//div[hasclass('product_price')]/b" position="attributes"> + <xpath expr="//div[hasclass('product_price')]/b" position="attributes">
+ <attribute name="t-if">product.price &gt; 0</attribute> + <attribute name="t-if">product.price &gt; 0</attribute>
+ </xpath> + </xpath>
+ </template> + </template>
</data></openerp> +
<!-- <template id="object"> -->
<!-- <h1><t t-esc="object.display_name"/></h1> -->
<!-- <dl> -->

View File

@ -1,16 +1,17 @@
# HG changeset patch # HG changeset patch
# Parent 2ee7212e5de4702dff08d9b5e4268e7dc261d038 # Parent 2ee7212e5de4702dff08d9b5e4268e7dc261d038
# Parent 4ca7b848bb60c3573de7ed41a28b4b65186a5725
diff --git a/academy/__openerp__.py b/academy/__openerp__.py diff --git a/academy/__openerp__.py b/academy/__openerp__.py
--- a/academy/__openerp__.py --- a/academy/__openerp__.py
+++ b/academy/__openerp__.py +++ b/academy/__openerp__.py
@@ -11,6 +11,7 @@ @@ -27,6 +27,7 @@
'ir.model.access.csv', 'security/ir.model.access.csv',
'templates.xml', 'templates.xml',
'views.xml', 'views.xml',
+ 'data.xml', + 'data.xml',
], ],
# data files which are only installed in "demonstration mode" # only loaded in demonstration mode
'demo': [ 'demo': [
diff --git a/academy/data.xml b/academy/data.xml diff --git a/academy/data.xml b/academy/data.xml
new file mode 100644 new file mode 100644
@ -26,47 +27,41 @@ new file mode 100644
diff --git a/academy/demo.xml b/academy/demo.xml diff --git a/academy/demo.xml b/academy/demo.xml
--- a/academy/demo.xml --- a/academy/demo.xml
+++ b/academy/demo.xml +++ b/academy/demo.xml
@@ -8,4 +8,29 @@ @@ -9,5 +9,30 @@
<record id="vaughn" model="academy.teachers"> <record id="vaughn" model="academy.teachers">
<field name="name">Lester Vaughn</field> <field name="name">Lester Vaughn</field>
</record> </record>
+ +
+ <record id="course0" model="product.template"> + <record id="course0" model="product.template">
+ <field name="name">Course 0</field> + <field name="name">Course 0</field>
+ <field name="teacher_id" ref="padilla"/> + <field name="teacher_id" ref="padilla"/>
+ <field name="public_categ_ids" eval="[(4, ref('academy.category_courses'), False)]"/> + <field name="public_categ_ids" eval="[(4, ref('academy.category_courses'), False)]"/>
+ <field name="website_published">True</field> + <field name="website_published">True</field>
+ <field name="list_price" type="float">0</field> + <field name="list_price" type="float">0</field>
+ <field name="type">service</field> + <field name="type">service</field>
+ </record> + </record>
+ <record id="course1" model="product.template"> + <record id="course1" model="product.template">
+ <field name="name">Course 1</field> + <field name="name">Course 1</field>
+ <field name="teacher_id" ref="padilla"/> + <field name="teacher_id" ref="padilla"/>
+ <field name="public_categ_ids" eval="[(4, ref('academy.category_courses'), False)]"/> + <field name="public_categ_ids" eval="[(4, ref('academy.category_courses'), False)]"/>
+ <field name="website_published">True</field> + <field name="website_published">True</field>
+ <field name="list_price" type="float">0</field> + <field name="list_price" type="float">0</field>
+ <field name="type">service</field> + <field name="type">service</field>
+ </record> + </record>
+ <record id="course2" model="product.template"> + <record id="course2" model="product.template">
+ <field name="name">Course 2</field> + <field name="name">Course 2</field>
+ <field name="teacher_id" ref="vaughn"/> + <field name="teacher_id" ref="vaughn"/>
+ <field name="public_categ_ids" eval="[(4, ref('academy.category_courses'), False)]"/> + <field name="public_categ_ids" eval="[(4, ref('academy.category_courses'), False)]"/>
+ <field name="website_published">True</field> + <field name="website_published">True</field>
+ <field name="list_price" type="float">0</field> + <field name="list_price" type="float">0</field>
+ <field name="type">service</field> + <field name="type">service</field>
+ </record> + </record>
</data></openerp> </data>
diff --git a/academy/ir.model.access.csv b/academy/ir.model.access.csv </openerp>
--- a/academy/ir.model.access.csv
+++ b/academy/ir.model.access.csv
@@ -1,3 +1,2 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_academy_teachers,access_academy_teachers,model_academy_teachers,,1,0,0,0
-access_academy_courses,access_academy_courses,model_academy_courses,,1,0,0,0
diff --git a/academy/models.py b/academy/models.py diff --git a/academy/models.py b/academy/models.py
--- a/academy/models.py --- a/academy/models.py
+++ b/academy/models.py +++ b/academy/models.py
@@ -7,11 +7,9 @@ class Teachers(models.Model): @@ -8,11 +8,9 @@ class Teachers(models.Model):
name = fields.Char() name = fields.Char()
biography = fields.Html() biography = fields.Html()
@ -80,6 +75,16 @@ diff --git a/academy/models.py b/academy/models.py
- name = fields.Char() - name = fields.Char()
teacher_id = fields.Many2one('academy.teachers', string="Teacher") teacher_id = fields.Many2one('academy.teachers', string="Teacher")
diff --git a/academy/security/ir.model.access.csv b/academy/security/ir.model.access.csv
--- a/academy/security/ir.model.access.csv
+++ b/academy/security/ir.model.access.csv
@@ -1,3 +1,2 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
-access_academy_teachers,access_academy_teachers,model_academy_teachers,,1,0,0,0
-access_academy_courses,access_academy_courses,model_academy_courses,,1,0,0,0
\ No newline at end of file
+access_academy_teachers,access_academy_teachers,model_academy_teachers,,1,0,0,0
\ No newline at end of file
diff --git a/academy/views.xml b/academy/views.xml diff --git a/academy/views.xml b/academy/views.xml
--- a/academy/views.xml --- a/academy/views.xml
+++ b/academy/views.xml +++ b/academy/views.xml

View File

@ -1,14 +1,18 @@
# HG changeset patch # HG changeset patch
# Parent c706c2ec28328a65a8aee6a7ba7d06896468c1e3 # Parent c706c2ec28328a65a8aee6a7ba7d06896468c1e3
diff -r c706c2ec2832 -r f85b481451bb academy/templates.xml # Parent 053262442acdbe3c803c29ce35002ec69452c5fd
--- a/academy/templates.xml Thu Aug 14 16:08:10 2014 +0200
+++ b/academy/templates.xml Thu Aug 14 16:30:49 2014 +0200 diff --git a/academy/templates.xml b/academy/templates.xml
@@ -34,4 +34,8 @@ --- a/academy/templates.xml
<attribute name="t-if">product.price &gt; 0</attribute> +++ b/academy/templates.xml
</xpath> @@ -35,6 +35,10 @@
</template> </xpath>
</template>
+ <record id="website_sale.products_categories" model="ir.ui.view">
+ <field name="active" eval="True"/>
+ </record>
+ +
+ <record id="website_sale.products_categories" model="ir.ui.view"> <!-- <template id="object"> -->
+ <field name="active" eval="True"/> <!-- <h1><t t-esc="object.display_name"/></h1> -->
+ </record> <!-- <dl> -->
</data></openerp>

View File

@ -1,29 +1,30 @@
# HG changeset patch # HG changeset patch
# Parent f0a3629abb17ca9f4dddd8885321d9ca5de14b55 # Parent f0a3629abb17ca9f4dddd8885321d9ca5de14b55
diff -r f0a3629abb17 -r 7ae0db4c2ddf academy/controllers.py # Parent 4c1c3d77ba8ad35dc759405a0db39a6eae943b0f
--- a/academy/controllers.py Tue Aug 12 11:21:05 2014 +0200
+++ b/academy/controllers.py Tue Aug 12 11:24:14 2014 +0200 diff --git a/academy/controllers.py b/academy/controllers.py
@@ -4,7 +4,7 @@ from openerp import http --- a/academy/controllers.py
+++ b/academy/controllers.py
@@ -4,8 +4,9 @@ from openerp import http
class Academy(http.Controller): class Academy(http.Controller):
@http.route('/academy/', auth='public') @http.route('/academy/academy/', auth='public')
def index(self): def index(self, **kw):
+ Teachers = http.request.env['academy.teachers'] + Teachers = http.request.env['academy.teachers']
return http.request.render('academy.index', { return http.request.render('academy.index', {
- 'teachers': ["Diana Padilla", "Jody Caroll", "Lester Vaughn"], - 'teachers': ["Diana Padilla", "Jody Caroll", "Lester Vaughn"],
+ 'teachers': Teachers.search([]), + 'teachers': Teachers.search([])
}) })
-
diff -r f0a3629abb17 -r 7ae0db4c2ddf academy/templates.xml # @http.route('/academy/academy/objects/', auth='public')
--- a/academy/templates.xml Tue Aug 12 11:21:05 2014 +0200 diff --git a/academy/templates.xml b/academy/templates.xml
+++ b/academy/templates.xml Tue Aug 12 11:24:14 2014 +0200 --- a/academy/templates.xml
@@ -2,7 +2,7 @@ +++ b/academy/templates.xml
<template id="index"> @@ -3,7 +3,7 @@
<title>Academy</title> <template id="index">
<t t-foreach="teachers" t-as="teacher"> <title>Academy</title>
- <p><t t-esc="teacher"/></p> <t t-foreach="teachers" t-as="teacher">
+ <p><t t-esc="teacher.id"/> <t t-esc="teacher.name"/></p> - <p><t t-esc="teacher"/></p>
</t> + <p><t t-esc="teacher.id"/> <t t-esc="teacher.name"/></p>
</template> </t>
-</data></openerp> </template>
\ No newline at end of file <!-- <template id="object"> -->
+</data></openerp>

View File

@ -1,29 +1,42 @@
# HG changeset patch # HG changeset patch
# Parent c77aa2c3341b9ab3a4e9ed05874e8a278fe69453 # Parent c77aa2c3341b9ab3a4e9ed05874e8a278fe69453
diff -r c77aa2c3341b -r f0a3629abb17 academy/__openerp__.py # Parent f416ab6c60f9cb3a803d30ff4dbff880eaa44a65
--- a/academy/__openerp__.py Mon Aug 11 16:50:01 2014 +0200
+++ b/academy/__openerp__.py Tue Aug 12 11:21:05 2014 +0200 diff --git a/academy/demo.xml b/academy/demo.xml
@@ -11,4 +11,8 @@ --- a/academy/demo.xml
'ir.model.access.csv', +++ b/academy/demo.xml
'templates.xml', @@ -1,25 +1,13 @@
], <openerp>
+ # data files which are only installed in "demonstration mode" <data>
+ 'demo': [ - <!-- -->
+ 'demo.xml', - <!-- <record id="object0" model="academy.academy"> -->
+ ], - <!-- <field name="name">Object 0</field> -->
} - <!-- </record> -->
diff -r c77aa2c3341b -r f0a3629abb17 academy/demo.xml - <!-- -->
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 - <!-- <record id="object1" model="academy.academy"> -->
+++ b/academy/demo.xml Tue Aug 12 11:21:05 2014 +0200 - <!-- <field name="name">Object 1</field> -->
@@ -0,0 +1,11 @@ - <!-- </record> -->
+<openerp><data> - <!-- -->
+ <record id="padilla" model="academy.teachers"> - <!-- <record id="object2" model="academy.academy"> -->
+ <field name="name">Diana Padilla</field> - <!-- <field name="name">Object 2</field> -->
+ </record> - <!-- </record> -->
+ <record id="carroll" model="academy.teachers"> - <!-- -->
+ <field name="name">Jody Carroll</field> - <!-- <record id="object3" model="academy.academy"> -->
+ </record> - <!-- <field name="name">Object 3</field> -->
+ <record id="vaughn" model="academy.teachers"> - <!-- </record> -->
+ <field name="name">Lester Vaughn</field> - <!-- -->
+ </record> - <!-- <record id="object4" model="academy.academy"> -->
+</data></openerp> - <!-- <field name="name">Object 4</field> -->
- <!-- </record> -->
- <!-- -->
+ <record id="padilla" model="academy.teachers">
+ <field name="name">Diana Padilla</field>
+ </record>
+ <record id="carroll" model="academy.teachers">
+ <field name="name">Jody Carroll</field>
+ </record>
+ <record id="vaughn" model="academy.teachers">
+ <field name="name">Lester Vaughn</field>
+ </record>
</data>
</openerp>

View File

@ -1,14 +1,16 @@
# HG changeset patch # HG changeset patch
# Parent f3ad3f919b49bc70c87e1500ec0d39f741243b3d # Parent f3ad3f919b49bc70c87e1500ec0d39f741243b3d
diff -r f3ad3f919b49 -r c3d04f578b76 academy/templates.xml # Parent 07a68419287382d7dd9d600c8b813c3c37a88864
--- a/academy/templates.xml Tue Aug 12 17:30:53 2014 +0200
+++ b/academy/templates.xml Tue Aug 12 17:34:31 2014 +0200 diff --git a/academy/templates.xml b/academy/templates.xml
--- a/academy/templates.xml
+++ b/academy/templates.xml
@@ -21,7 +21,7 @@ @@ -21,7 +21,7 @@
<div class="oe_structure"> <div class="oe_structure">
<div class="container"> <div class="container">
<h3 t-field="person.name"/> <h3 t-field="person.name"/>
- <p>Last modified: <i t-field="person.write_date"/></p> - <p>Last modified: <i t-field="person.write_date"/></p>
+ <p>Last modified: <i t-field="person.write_date" t-field-options='{"format": "long"}'/></p> + <p>Last modified: <i t-field="person.write_date" t-field-options='{"format": "long"}'/></p>
<div t-field="person.biography"/> <div t-field="person.biography"/>
</div> </div>
</div> </div>

View File

@ -1,13 +1,15 @@
# HG changeset patch # HG changeset patch
# Parent d5b8a2de3e35c26c29f85ce500d41ccd2373c508 # Parent d5b8a2de3e35c26c29f85ce500d41ccd2373c508
diff -r d5b8a2de3e35 -r f3ad3f919b49 academy/templates.xml # Parent 65d27383542ef9214ff9e2c308aa54b042cff2d9
--- a/academy/templates.xml Tue Aug 12 17:25:15 2014 +0200
+++ b/academy/templates.xml Tue Aug 12 17:30:53 2014 +0200 diff --git a/academy/templates.xml b/academy/templates.xml
--- a/academy/templates.xml
+++ b/academy/templates.xml
@@ -21,6 +21,7 @@ @@ -21,6 +21,7 @@
<div class="oe_structure"> <div class="oe_structure">
<div class="container"> <div class="container">
<h3 t-field="person.name"/> <h3 t-field="person.name"/>
+ <p>Last modified: <i t-field="person.write_date"/></p> + <p>Last modified: <i t-field="person.write_date"/></p>
<div t-field="person.biography"/> <div t-field="person.biography"/>
</div> </div>
</div> </div>

View File

@ -1,14 +1,16 @@
# HG changeset patch # HG changeset patch
# Parent c3d04f578b762612422e09777e0ac5b3863d6ea6 # Parent c3d04f578b762612422e09777e0ac5b3863d6ea6
diff -r c3d04f578b76 -r c8cc9e66a270 academy/templates.xml # Parent 0bc39fe6579c4e48b61e77bc970da2e1784f1a67
--- a/academy/templates.xml Tue Aug 12 17:34:31 2014 +0200
+++ b/academy/templates.xml Wed Aug 13 10:11:49 2014 +0200 diff --git a/academy/templates.xml b/academy/templates.xml
--- a/academy/templates.xml
+++ b/academy/templates.xml
@@ -21,7 +21,7 @@ @@ -21,7 +21,7 @@
<div class="oe_structure"> <div class="oe_structure">
<div class="container"> <div class="container">
<h3 t-field="person.name"/> <h3 t-field="person.name"/>
- <p>Last modified: <i t-field="person.write_date" t-field-options='{"format": "long"}'/></p> - <p>Last modified: <i t-field="person.write_date" t-field-options='{"format": "long"}'/></p>
+ <p>Last modified: <i t-field="person.write_date" t-field-options='{"widget": "relative"}'/></p> + <p>Last modified: <i t-field="person.write_date" t-field-options='{"widget": "relative"}'/></p>
<div t-field="person.biography"/> <div t-field="person.biography"/>
</div> </div>
</div> </div>

View File

@ -1,19 +1,153 @@
# HG changeset patch # HG changeset patch
# Parent 0000000000000000000000000000000000000000 # Parent 0000000000000000000000000000000000000000
# Parent 0000000000000000000000000000000000000000
diff --git a/academy/__init__.py b/academy/__init__.py diff --git a/academy/__init__.py b/academy/__init__.py
new file mode 100644 new file mode 100644
--- /dev/null
+++ b/academy/__init__.py
@@ -0,0 +1,3 @@
+# -*- coding: utf-8 -*-
+import controllers
+import models
diff --git a/academy/__openerp__.py b/academy/__openerp__.py diff --git a/academy/__openerp__.py b/academy/__openerp__.py
new file mode 100644 new file mode 100644
--- /dev/null --- /dev/null
+++ b/academy/__openerp__.py +++ b/academy/__openerp__.py
@@ -0,0 +1,9 @@ @@ -0,0 +1,34 @@
+# -*- coding: utf-8 -*-
+{ +{
+ # The human-readable name of your module, displayed in the interface
+ 'name': "Academy", + 'name': "Academy",
+ # A more extensive description +
+ 'summary': """
+ Short (1 phrase/line) summary of the module's purpose, used as
+ subtitle on modules listing or apps.openerp.com""",
+
+ 'description': """ + 'description': """
+ Long description of module's purpose
+ """, + """,
+ # Which modules must be installed for this one to work +
+ 'author': "Your Company",
+ 'website': "http://www.yourcompany.com",
+
+ # Categories can be used to filter modules in modules listing
+ # Check https://github.com/odoo/odoo/blob/master/openerp/addons/base/module/module_data.xml
+ # for the full list
+ 'category': 'Uncategorized',
+ 'version': '0.1',
+
+ # any module necessary for this one to work correctly
+ 'depends': ['base'], + 'depends': ['base'],
+
+ # always loaded
+ 'data': [
+ # 'security/ir.model.access.csv',
+ 'templates.xml',
+ ],
+ # only loaded in demonstration mode
+ 'demo': [
+ 'demo.xml',
+ ],
+} +}
diff --git a/academy/controllers.py b/academy/controllers.py
new file mode 100644
--- /dev/null
+++ b/academy/controllers.py
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+from openerp import http
+
+# class Academy(http.Controller):
+# @http.route('/academy/academy/', auth='public')
+# def index(self, **kw):
+# return "Hello, world"
+
+# @http.route('/academy/academy/objects/', auth='public')
+# def list(self, **kw):
+# return http.request.render('academy.listing', {
+# 'root': '/academy/academy',
+# 'objects': http.request.env['academy.academy'].search([]),
+# })
+
+# @http.route('/academy/academy/objects/<model("academy.academy"):obj>/', auth='public')
+# def object(self, obj, **kw):
+# return http.request.render('academy.object', {
+# 'object': obj
+# })
diff --git a/academy/demo.xml b/academy/demo.xml
new file mode 100644
--- /dev/null
+++ b/academy/demo.xml
@@ -0,0 +1,25 @@
+<openerp>
+ <data>
+ <!-- -->
+ <!-- <record id="object0" model="academy.academy"> -->
+ <!-- <field name="name">Object 0</field> -->
+ <!-- </record> -->
+ <!-- -->
+ <!-- <record id="object1" model="academy.academy"> -->
+ <!-- <field name="name">Object 1</field> -->
+ <!-- </record> -->
+ <!-- -->
+ <!-- <record id="object2" model="academy.academy"> -->
+ <!-- <field name="name">Object 2</field> -->
+ <!-- </record> -->
+ <!-- -->
+ <!-- <record id="object3" model="academy.academy"> -->
+ <!-- <field name="name">Object 3</field> -->
+ <!-- </record> -->
+ <!-- -->
+ <!-- <record id="object4" model="academy.academy"> -->
+ <!-- <field name="name">Object 4</field> -->
+ <!-- </record> -->
+ <!-- -->
+ </data>
+</openerp>
diff --git a/academy/models.py b/academy/models.py
new file mode 100644
--- /dev/null
+++ b/academy/models.py
@@ -0,0 +1,8 @@
+# -*- coding: utf-8 -*-
+
+from openerp import models, fields, api
+
+# class academy(models.Model):
+# _name = 'academy.academy'
+
+# name = fields.Char()
diff --git a/academy/security/ir.model.access.csv b/academy/security/ir.model.access.csv
new file mode 100644
--- /dev/null
+++ b/academy/security/ir.model.access.csv
@@ -0,0 +1,2 @@
+id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
+access_academy_academy,academy.academy,model_academy_academy,,1,0,0,0
diff --git a/academy/templates.xml b/academy/templates.xml
new file mode 100644
--- /dev/null
+++ b/academy/templates.xml
@@ -0,0 +1,22 @@
+<openerp>
+ <data>
+ <!-- <template id="listing"> -->
+ <!-- <ul> -->
+ <!-- <li t-foreach="objects" t-as="object"> -->
+ <!-- <a t-attf-href="#{ root }/objects/#{ object.id }"> -->
+ <!-- <t t-esc="object.display_name"/> -->
+ <!-- </a> -->
+ <!-- </li> -->
+ <!-- </ul> -->
+ <!-- </template> -->
+ <!-- <template id="object"> -->
+ <!-- <h1><t t-esc="object.display_name"/></h1> -->
+ <!-- <dl> -->
+ <!-- <t t-foreach="object._fields" t-as="field"> -->
+ <!-- <dt><t t-esc="field"/></dt> -->
+ <!-- <dd><t t-esc="object[field]"/></dd> -->
+ <!-- </t> -->
+ <!-- </dl> -->
+ <!-- </template> -->
+ </data>
+</openerp>

View File

@ -1,14 +1,16 @@
# HG changeset patch # HG changeset patch
# Parent 6106208621f01d5aea67727f09adf5c5b2a38642 # Parent 6106208621f01d5aea67727f09adf5c5b2a38642
diff -r 6106208621f0 -r f882c3b2e7af academy/__openerp__.py # Parent ae97cfb61fd0e1a47727a9d8ed4a702116254eff
--- a/academy/__openerp__.py Wed Aug 13 16:32:26 2014 +0200
+++ b/academy/__openerp__.py Thu Aug 14 11:44:51 2014 +0200 diff --git a/academy/__openerp__.py b/academy/__openerp__.py
@@ -5,7 +5,7 @@ --- a/academy/__openerp__.py
'description': """ +++ b/academy/__openerp__.py
""", @@ -20,7 +20,7 @@
# Which modules must be installed for this one to work 'version': '0.1',
# any module necessary for this one to work correctly
- 'depends': ['website'], - 'depends': ['website'],
+ 'depends': ['website_sale'], + 'depends': ['website_sale'],
# data files which are always installed
# always loaded
'data': [ 'data': [
'ir.model.access.csv',

View File

@ -1,14 +1,19 @@
# HG changeset patch # HG changeset patch
# Parent 0795247fa6cbb63238941f3dd26a8b6144fa71ee # Parent 0795247fa6cbb63238941f3dd26a8b6144fa71ee
diff -r 0795247fa6cb -r e9d9740fa185 academy/controllers.py # Parent f66ff336f8ed20e022660bd74a43af1b44a1f275
--- a/academy/controllers.py Tue Aug 12 11:27:14 2014 +0200
+++ b/academy/controllers.py Tue Aug 12 16:51:29 2014 +0200 diff --git a/academy/controllers.py b/academy/controllers.py
@@ -8,3 +8,8 @@ class Academy(http.Controller): --- a/academy/controllers.py
return http.request.render('academy.index', { +++ b/academy/controllers.py
'teachers': Teachers.search([]), @@ -9,6 +9,11 @@ class Academy(http.Controller):
'teachers': Teachers.search([])
}) })
+
+ @http.route('/academy/<name>/', auth='public', website=True) + @http.route('/academy/<name>/', auth='public', website=True)
+ def teacher(self, name): + def teacher(self, name):
+ return '<h1>{}</h1>'.format(name) + return '<h1>{}</h1>'.format(name)
+ +
+
# @http.route('/academy/academy/objects/', auth='public')
# def list(self, **kw):
# return http.request.render('academy.listing', {

View File

@ -1,10 +1,12 @@
# HG changeset patch # HG changeset patch
# Parent e9d9740fa1852c80541c6b5b94280c8ec74cc4bb # Parent e9d9740fa1852c80541c6b5b94280c8ec74cc4bb
diff -r e9d9740fa185 -r 122340f43602 academy/controllers.py # Parent cf501446e2f8d7a059ef7bd16866ed03c8f2a04f
--- a/academy/controllers.py Tue Aug 12 16:51:29 2014 +0200
+++ b/academy/controllers.py Tue Aug 12 16:52:38 2014 +0200 diff --git a/academy/controllers.py b/academy/controllers.py
@@ -9,7 +9,7 @@ class Academy(http.Controller): --- a/academy/controllers.py
'teachers': Teachers.search([]), +++ b/academy/controllers.py
@@ -9,9 +9,9 @@ class Academy(http.Controller):
'teachers': Teachers.search([])
}) })
- @http.route('/academy/<name>/', auth='public', website=True) - @http.route('/academy/<name>/', auth='public', website=True)
@ -14,3 +16,5 @@ diff -r e9d9740fa185 -r 122340f43602 academy/controllers.py
+ def teacher(self, id): + def teacher(self, id):
+ return '<h1>{} ({})</h1>'.format(id, type(id).__name__) + return '<h1>{} ({})</h1>'.format(id, type(id).__name__)
# @http.route('/academy/academy/objects/', auth='public')

View File

@ -1,26 +1,27 @@
# HG changeset patch # HG changeset patch
# Parent 91ffd360f3ffd44acb605c09753498b3d5f3f210 # Parent 91ffd360f3ffd44acb605c09753498b3d5f3f210
# Parent 976a92eff9104d355cb86a0b41e883a19e75e923
diff --git a/academy/templates.xml b/academy/templates.xml diff --git a/academy/templates.xml b/academy/templates.xml
--- a/academy/templates.xml --- a/academy/templates.xml
+++ b/academy/templates.xml +++ b/academy/templates.xml
@@ -5,7 +5,9 @@ @@ -6,7 +6,9 @@
<div class="oe_structure"> <div class="oe_structure">
<div class="container"> <div class="container">
<t t-foreach="teachers" t-as="teacher"> <t t-foreach="teachers" t-as="teacher">
- <p><t t-esc="teacher.id"/> <t t-esc="teacher.name"/></p> - <p><t t-esc="teacher.id"/> <t t-esc="teacher.name"/></p>
+ <p><a t-attf-href="/academy/{{ slug(teacher) }}"> + <p><a t-attf-href="/academy/{{ slug(teacher) }}">
+ <t t-esc="teacher.name"/></a> + <t t-esc="teacher.name"/></a>
+ </p> + </p>
</t> </t>
</div> </div>
</div> </div>
@@ -18,7 +20,7 @@ @@ -18,7 +20,7 @@
<div class="oe_structure"/> <div class="oe_structure"/>
<div class="oe_structure"> <div class="oe_structure">
<div class="container"> <div class="container">
- <p><t t-esc="person.id"/> <t t-esc="person.name"/></p> - <p><t t-esc="person.id"/> <t t-esc="person.name"/></p>
+ <h3><t t-esc="person.name"/></h3> + <h3><t t-esc="person.name"/></h3>
</div> </div>
</div> </div>
<div class="oe_structure"/> <div class="oe_structure"/>

View File

@ -1,19 +1,22 @@
# HG changeset patch # HG changeset patch
# Parent c8cc9e66a2701dad6589ff1d950e1cb7738d0854 # Parent c8cc9e66a2701dad6589ff1d950e1cb7738d0854
diff -r c8cc9e66a270 -r 0201053e995d academy/__openerp__.py # Parent 44a09b8865d418cda8b7c46dfb70fadc86e22184
--- a/academy/__openerp__.py Wed Aug 13 10:11:49 2014 +0200
+++ b/academy/__openerp__.py Wed Aug 13 11:04:49 2014 +0200 diff --git a/academy/__openerp__.py b/academy/__openerp__.py
@@ -10,6 +10,7 @@ --- a/academy/__openerp__.py
+++ b/academy/__openerp__.py
@@ -26,6 +26,7 @@
'data': [ 'data': [
'ir.model.access.csv', 'security/ir.model.access.csv',
'templates.xml', 'templates.xml',
+ 'views.xml', + 'views.xml',
], ],
# data files which are only installed in "demonstration mode" # only loaded in demonstration mode
'demo': [ 'demo': [
diff -r c8cc9e66a270 -r 0201053e995d academy/views.xml diff --git a/academy/views.xml b/academy/views.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 new file mode 100644
+++ b/academy/views.xml Wed Aug 13 11:04:49 2014 +0200 --- /dev/null
+++ b/academy/views.xml
@@ -0,0 +1,13 @@ @@ -0,0 +1,13 @@
+<openerp><data> +<openerp><data>
+ <record id="action_academy_teachers" model="ir.actions.act_window"> + <record id="action_academy_teachers" model="ir.actions.act_window">

View File

@ -1,39 +1,42 @@
# HG changeset patch # HG changeset patch
# Parent d5ad2ad84a5db0668e4e08fefb6e3f628c2e14d1 # Parent d5ad2ad84a5db0668e4e08fefb6e3f628c2e14d1
diff -r d5ad2ad84a5d -r 3e800beb7db0 academy/__openerp__.py # Parent e65c9826721cb2421131399bc9223e03b482d38f
--- a/academy/__openerp__.py Mon Aug 11 16:12:38 2014 +0200
+++ b/academy/__openerp__.py Mon Aug 11 16:36:15 2014 +0200 diff --git a/academy/controllers.py b/academy/controllers.py
@@ -6,4 +6,8 @@ --- a/academy/controllers.py
""", +++ b/academy/controllers.py
# Which modules must be installed for this one to work @@ -4,7 +4,9 @@ from openerp import http
'depends': ['base'],
+ # data files which are always installed
+ 'data': [
+ 'templates.xml',
+ ],
}
diff -r d5ad2ad84a5d -r 3e800beb7db0 academy/controllers.py
--- a/academy/controllers.py Mon Aug 11 16:12:38 2014 +0200
+++ b/academy/controllers.py Mon Aug 11 16:36:15 2014 +0200
@@ -4,5 +4,7 @@ from openerp import http
class Academy(http.Controller): class Academy(http.Controller):
@http.route('/academy/', auth='public') @http.route('/academy/academy/', auth='public')
def index(self): def index(self, **kw):
- return "Hello, world!" - return "Hello, world"
+ return http.request.render('academy.index', { + return http.request.render('academy.index', {
+ 'teachers': ["Diana Padilla", "Jody Caroll", "Lester Vaughn"], + 'teachers': ["Diana Padilla", "Jody Caroll", "Lester Vaughn"],
+ }) + })
diff -r d5ad2ad84a5d -r 3e800beb7db0 academy/templates.xml # @http.route('/academy/academy/objects/', auth='public')
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 # def list(self, **kw):
+++ b/academy/templates.xml Mon Aug 11 16:36:15 2014 +0200 diff --git a/academy/templates.xml b/academy/templates.xml
@@ -0,0 +1,8 @@ --- a/academy/templates.xml
+<openerp><data> +++ b/academy/templates.xml
+ <template id="index"> @@ -1,14 +1,11 @@
+ <title>Academy</title> <openerp>
+ <t t-foreach="teachers" t-as="teacher"> <data>
+ <p><t t-esc="teacher"/></p> - <!-- <template id="listing"> -->
+ </t> - <!-- <ul> -->
+ </template> - <!-- <li t-foreach="objects" t-as="object"> -->
+</data></openerp> - <!-- <a t-attf-href="#{ root }/objects/#{ object.id }"> -->
\ No newline at end of file - <!-- <t t-esc="object.display_name"/> -->
- <!-- </a> -->
- <!-- </li> -->
- <!-- </ul> -->
- <!-- </template> -->
+ <template id="index">
+ <title>Academy</title>
+ <t t-foreach="teachers" t-as="teacher">
+ <p><t t-esc="teacher"/></p>
+ </t>
+ </template>
<!-- <template id="object"> -->
<!-- <h1><t t-esc="object.display_name"/></h1> -->
<!-- <dl> -->

View File

@ -1,47 +1,50 @@
# HG changeset patch # HG changeset patch
# Parent 7ae0db4c2ddf5d0f7f58db2af8976fcec905cc4e # Parent 7ae0db4c2ddf5d0f7f58db2af8976fcec905cc4e
diff -r 7ae0db4c2ddf -r 0795247fa6cb academy/__openerp__.py # Parent 06f959831b14dd5d2e0a57d3e14bf919e18f8e3a
--- a/academy/__openerp__.py Tue Aug 12 11:24:14 2014 +0200
+++ b/academy/__openerp__.py Tue Aug 12 11:27:14 2014 +0200 diff --git a/academy/__openerp__.py b/academy/__openerp__.py
@@ -5,7 +5,7 @@ --- a/academy/__openerp__.py
'description': """ +++ b/academy/__openerp__.py
""", @@ -20,7 +20,7 @@
# Which modules must be installed for this one to work 'version': '0.1',
# any module necessary for this one to work correctly
- 'depends': ['base'], - 'depends': ['base'],
+ 'depends': ['website'], + 'depends': ['website'],
# data files which are always installed
# always loaded
'data': [ 'data': [
'ir.model.access.csv', diff --git a/academy/controllers.py b/academy/controllers.py
diff -r 7ae0db4c2ddf -r 0795247fa6cb academy/controllers.py --- a/academy/controllers.py
--- a/academy/controllers.py Tue Aug 12 11:24:14 2014 +0200 +++ b/academy/controllers.py
+++ b/academy/controllers.py Tue Aug 12 11:27:14 2014 +0200
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
from openerp import http from openerp import http
class Academy(http.Controller): class Academy(http.Controller):
- @http.route('/academy/', auth='public') - @http.route('/academy/academy/', auth='public')
+ @http.route('/academy/', auth='public', website=True) + @http.route('/academy/academy/', auth='public', website=True)
def index(self): def index(self, **kw):
Teachers = http.request.env['academy.teachers'] Teachers = http.request.env['academy.teachers']
return http.request.render('academy.index', { return http.request.render('academy.index', {
diff -r 7ae0db4c2ddf -r 0795247fa6cb academy/templates.xml diff --git a/academy/templates.xml b/academy/templates.xml
--- a/academy/templates.xml Tue Aug 12 11:24:14 2014 +0200 --- a/academy/templates.xml
+++ b/academy/templates.xml Tue Aug 12 11:27:14 2014 +0200 +++ b/academy/templates.xml
@@ -1,8 +1,14 @@ @@ -1,9 +1,15 @@
<openerp><data> <openerp>
<template id="index"> <data>
- <title>Academy</title> <template id="index">
- <t t-foreach="teachers" t-as="teacher"> - <title>Academy</title>
- <p><t t-esc="teacher.id"/> <t t-esc="teacher.name"/></p> - <t t-foreach="teachers" t-as="teacher">
+ <t t-call="website.layout"> - <p><t t-esc="teacher.id"/> <t t-esc="teacher.name"/></p>
+ <t t-set="title">Academy</t> + <t t-call="website.layout">
+ <div class="oe_structure"> + <t t-set="title">Academy</t>
+ <div class="container"> + <div class="oe_structure">
+ <t t-foreach="teachers" t-as="teacher"> + <div class="container">
+ <p><t t-esc="teacher.id"/> <t t-esc="teacher.name"/></p> + <t t-foreach="teachers" t-as="teacher">
+ </t> + <p><t t-esc="teacher.id"/> <t t-esc="teacher.name"/></p>
+ </div> + </t>
+ </div> + </div>
</t> + </div>
</template> </t>
</data></openerp> </template>
<!-- <template id="object"> -->