[FIX] effect name change for generated controller and model onto doc

This commit is contained in:
Xavier Morel 2014-04-11 12:09:51 +02:00
parent 729258ed9d
commit 8bcc42d4d0
12 changed files with 74 additions and 74 deletions

View File

@ -40,10 +40,10 @@ This builds a basic module for you:
├── __openerp__.py ├── __openerp__.py
├── controllers ├── controllers
│   ├── __init__.py │   ├── __init__.py
│   └── my_controller.py │   └── academy.py
├── models ├── models
│   ├── __init__.py │   ├── __init__.py
│   └── my_model.py │   └── academy.py
└── security └── security
└── ir.model.access.csv └── ir.model.access.csv
@ -68,7 +68,7 @@ Let's prettify things a bit: instead of returning just a bit of text,
we can return a page, and use a tool like bootstrap_ to get a we can return a page, and use a tool like bootstrap_ to get a
nicer rendering than the default. nicer rendering than the default.
Go to :file:`academy/controllers/my_controller.py` and change the string Go to :file:`academy/controllers/academy.py` and change the string
returned by the ``index`` method to get a more page-ish output: returned by the ``index`` method to get a more page-ish output:
.. patch:: .. patch::

View File

@ -1,11 +1,11 @@
# HG changeset patch # HG changeset patch
# Parent a76a9a0e0668f4191bdc383a0d4b3173f44b39b1 # Parent d06b1f422ac5672c4a4c34bb3a50e98df42f3e31
diff --git a/controllers/my_controller.py b/controllers/my_controller.py diff --git a/controllers/academy.py b/controllers/academy.py
--- a/controllers/my_controller.py --- a/controllers/academy.py
+++ b/controllers/my_controller.py +++ b/controllers/academy.py
@@ -6,4 +6,16 @@ from openerp.addons.web.controllers impo @@ -6,4 +6,16 @@ from openerp.addons.web.controllers impo
class my_controller(main.Home): class academy(main.Home):
@http.route('/', auth='none') @http.route('/', auth='none')
def index(self): def index(self):
- return "Hello, world!" - return "Hello, world!"

View File

@ -1,5 +1,5 @@
# HG changeset patch # HG changeset patch
# Parent 9042ace1e3e8175155d9dbed75657222a371cdb6 # Parent fef5ecf2dad4b7bdcc9a760545c2689187bb15f9
diff --git a/__openerp__.py b/__openerp__.py diff --git a/__openerp__.py b/__openerp__.py
--- a/__openerp__.py --- a/__openerp__.py
@ -12,11 +12,11 @@ diff --git a/__openerp__.py b/__openerp__.py
], ],
'tests': [ 'tests': [
], ],
diff --git a/controllers/my_controller.py b/controllers/my_controller.py diff --git a/controllers/academy.py b/controllers/academy.py
--- a/controllers/my_controller.py --- a/controllers/academy.py
+++ b/controllers/my_controller.py +++ b/controllers/academy.py
@@ -6,10 +6,15 @@ from openerp.addons.web.controllers impo @@ -6,10 +6,15 @@ from openerp.addons.web.controllers impo
class my_controller(main.Home): class academy(main.Home):
@http.route('/', auth='public') @http.route('/', auth='public')
def index(self): def index(self):
+ cr, uid, context = http.request.cr, http.request.uid, http.request.context + cr, uid, context = http.request.cr, http.request.uid, http.request.context
@ -60,9 +60,9 @@ new file mode 100644
+ </record> + </record>
+ </data> + </data>
+</openerp> +</openerp>
diff --git a/models/my_model.py b/models/my_model.py diff --git a/models/academy.py b/models/academy.py
--- a/models/my_model.py --- a/models/academy.py
+++ b/models/my_model.py +++ b/models/academy.py
@@ -8,3 +8,12 @@ class TeachingAssistants(orm.Model): @@ -8,3 +8,12 @@ class TeachingAssistants(orm.Model):
'name': fields.char(), 'name': fields.char(),
'biography': fields.html(), 'biography': fields.html(),

View File

@ -43,19 +43,19 @@ new file mode 100644
+++ b/controllers/__init__.py +++ b/controllers/__init__.py
@@ -0,0 +1,3 @@ @@ -0,0 +1,3 @@
+# -*- coding: utf-8 -*- +# -*- coding: utf-8 -*-
+import my_controller +import academy
+ +
diff --git a/controllers/my_controller.py b/controllers/my_controller.py diff --git a/controllers/academy.py b/controllers/academy.py
new file mode 100644 new file mode 100644
--- /dev/null --- /dev/null
+++ b/controllers/my_controller.py +++ b/controllers/academy.py
@@ -0,0 +1,9 @@ @@ -0,0 +1,9 @@
+# -*- coding: utf-8 -*- +# -*- coding: utf-8 -*-
+ +
+from openerp import http +from openerp import http
+from openerp.addons.web.controllers import main +from openerp.addons.web.controllers import main
+ +
+class my_controller(main.Home): +class academy(main.Home):
+ @http.route('/', auth='none') + @http.route('/', auth='none')
+ def index(self): + def index(self):
+ return "Hello, world!" + return "Hello, world!"
@ -65,18 +65,18 @@ new file mode 100644
+++ b/models/__init__.py +++ b/models/__init__.py
@@ -0,0 +1,3 @@ @@ -0,0 +1,3 @@
+# -*- coding: utf-8 -*- +# -*- coding: utf-8 -*-
+import my_model +import academy
+ +
diff --git a/models/my_model.py b/models/my_model.py diff --git a/models/academy.py b/models/academy.py
new file mode 100644 new file mode 100644
--- /dev/null --- /dev/null
+++ b/models/my_model.py +++ b/models/academy.py
@@ -0,0 +1,9 @@ @@ -0,0 +1,9 @@
+# -*- coding: utf-8 -*- +# -*- coding: utf-8 -*-
+from openerp.osv import orm, fields +from openerp.osv import orm, fields
+ +
+class my_model(orm.Model): +class academy(orm.Model):
+ _name = "academy.my_model" + _name = "academy.academy"
+ +
+ _columns = { + _columns = {
+ 'name': fields.char(), + 'name': fields.char(),
@ -87,4 +87,4 @@ new file mode 100644
+++ b/security/ir.model.access.csv +++ b/security/ir.model.access.csv
@@ -0,0 +1,2 @@ @@ -0,0 +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_my_model,access_academy_my_model,model_academy_my_model,,1,0,0,0 +access_academy_academy,access_academy_academy,model_academy_academy,,1,0,0,0

View File

@ -1,9 +1,9 @@
# HG changeset patch # HG changeset patch
# Parent a615de71be483d88acca032ad5d35072c87999c0 # Parent e95e38d7a1c75741d1f7babf1fe6590b8227888e
diff --git a/controllers/my_controller.py b/controllers/my_controller.py diff --git a/controllers/academy.py b/controllers/academy.py
--- a/controllers/my_controller.py --- a/controllers/academy.py
+++ b/controllers/my_controller.py +++ b/controllers/academy.py
@@ -3,9 +3,22 @@ @@ -3,9 +3,22 @@
from openerp import http from openerp import http
from openerp.addons.web.controllers import main from openerp.addons.web.controllers import main
@ -16,7 +16,7 @@ diff --git a/controllers/my_controller.py b/controllers/my_controller.py
+ {'name': "Tanya Harris"}, + {'name': "Tanya Harris"},
+] +]
+ +
class my_controller(main.Home): class academy(main.Home):
@http.route('/', auth='none') @http.route('/', auth='none')
def index(self): def index(self):
+ tas = [ + tas = [
@ -27,7 +27,7 @@ diff --git a/controllers/my_controller.py b/controllers/my_controller.py
return """<!doctype html> return """<!doctype html>
<html> <html>
<head> <head>
@@ -16,6 +29,26 @@ class my_controller(main.Home): @@ -16,6 +29,26 @@ class academy(main.Home):
<h1>Introduction to a thing</h1> <h1>Introduction to a thing</h1>
<h2>Course description</h2> <h2>Course description</h2>
<p>Course introduction</p> <p>Course introduction</p>

View File

@ -1,9 +1,9 @@
# HG changeset patch # HG changeset patch
# Parent 8cbdbbeaf1d89c9a4e4d03e2392ddcc79a648206 # Parent 313d7c760558b24461a544063de061d00fdf7059
diff --git a/models/my_model.py b/models/my_model.py diff --git a/models/academy.py b/models/academy.py
--- a/models/my_model.py --- a/models/academy.py
+++ b/models/my_model.py +++ b/models/academy.py
@@ -6,4 +6,5 @@ class TeachingAssistants(orm.Model): @@ -6,4 +6,5 @@ class TeachingAssistants(orm.Model):
_columns = { _columns = {

View File

@ -1,9 +1,9 @@
# HG changeset patch # HG changeset patch
# Parent b6ba23a3c284db481f14d9ea573e0baf8d3320e8 # Parent 21954f9743a937b8185a5e717fe6af0e92660c55
diff --git a/controllers/my_controller.py b/controllers/my_controller.py diff --git a/controllers/academy.py b/controllers/academy.py
--- a/controllers/my_controller.py --- a/controllers/academy.py
+++ b/controllers/my_controller.py +++ b/controllers/academy.py
@@ -3,19 +3,13 @@ @@ -3,19 +3,13 @@
from openerp import http from openerp import http
from openerp.addons.web.controllers import main from openerp.addons.web.controllers import main
@ -16,7 +16,7 @@ diff --git a/controllers/my_controller.py b/controllers/my_controller.py
- {'name': "Tanya Harris"}, - {'name': "Tanya Harris"},
-] -]
- -
class my_controller(main.Home): class academy(main.Home):
@http.route('/', auth='public') @http.route('/', auth='public')
def index(self): def index(self):
+ tas = http.request.registry['academy.tas'].search_read( + tas = http.request.registry['academy.tas'].search_read(
@ -27,15 +27,15 @@ diff --git a/controllers/my_controller.py b/controllers/my_controller.py
}) })
@http.route('/tas/<int:id>/', auth='public', website=True) @http.route('/tas/<int:id>/', auth='public', website=True)
diff --git a/models/my_model.py b/models/my_model.py diff --git a/models/academy.py b/models/academy.py
--- a/models/my_model.py --- a/models/academy.py
+++ b/models/my_model.py +++ b/models/academy.py
@@ -1,8 +1,8 @@ @@ -1,8 +1,8 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from openerp.osv import orm, fields from openerp.osv import orm, fields
-class my_model(orm.Model): -class academy(orm.Model):
- _name = "academy.my_model" - _name = "academy.academy"
+class TeachingAssistants(orm.Model): +class TeachingAssistants(orm.Model):
+ _name = "academy.tas" + _name = "academy.tas"
@ -46,5 +46,5 @@ diff --git a/security/ir.model.access.csv b/security/ir.model.access.csv
+++ b/security/ir.model.access.csv +++ b/security/ir.model.access.csv
@@ -1,2 +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_my_model,access_academy_my_model,model_academy_my_model,,1,0,0,0 -access_academy_academy,access_academy_academy,model_academy_academy,,1,0,0,0
+access_academy_tas,access_academy_tas,model_academy_tas,,1,0,0,0 +access_academy_tas,access_academy_tas,model_academy_tas,,1,0,0,0

View File

@ -1,10 +1,10 @@
# HG changeset patch # HG changeset patch
# Parent 548ab57454752e9575323e26d0471669c78172f6 # Parent 466d19929560c2a60c347990ea44730ae40ec36d
diff --git a/controllers/my_controller.py b/controllers/my_controller.py diff --git a/controllers/academy.py b/controllers/academy.py
--- a/controllers/my_controller.py --- a/controllers/academy.py
+++ b/controllers/my_controller.py +++ b/controllers/academy.py
@@ -12,6 +12,8 @@ class my_controller(main.Home): @@ -12,6 +12,8 @@ class academy(main.Home):
'tas': tas, 'tas': tas,
}) })

View File

@ -1,5 +1,5 @@
# HG changeset patch # HG changeset patch
# Parent 0792d59a4a456e1ce70d8aa4cb1784632883d714 # Parent 5342fd2d61587d3ab2c29f88e813b9a402eaa808
diff --git a/__openerp__.py b/__openerp__.py diff --git a/__openerp__.py b/__openerp__.py
--- a/__openerp__.py --- a/__openerp__.py
@ -16,11 +16,11 @@ diff --git a/__openerp__.py b/__openerp__.py
'tests': [ 'tests': [
], ],
} }
diff --git a/controllers/my_controller.py b/controllers/my_controller.py diff --git a/controllers/academy.py b/controllers/academy.py
--- a/controllers/my_controller.py --- a/controllers/academy.py
+++ b/controllers/my_controller.py +++ b/controllers/academy.py
@@ -14,41 +14,18 @@ teaching_assistants = [ @@ -14,41 +14,18 @@ teaching_assistants = [
class my_controller(main.Home): class academy(main.Home):
@http.route('/', auth='none') @http.route('/', auth='none')
def index(self): def index(self):
+ cr, uid, context = http.request.cr, http.request.uid, http.request.context + cr, uid, context = http.request.cr, http.request.uid, http.request.context

View File

@ -1,10 +1,10 @@
# HG changeset patch # HG changeset patch
# Parent 1d6a01fae0bb650ea0de8437b3983a29f66463ed # Parent f7adcd9a5a8e0dc1c7438f94dde2faefd6406a30
diff --git a/controllers/my_controller.py b/controllers/my_controller.py diff --git a/controllers/academy.py b/controllers/academy.py
--- a/controllers/my_controller.py --- a/controllers/academy.py
+++ b/controllers/my_controller.py +++ b/controllers/academy.py
@@ -15,7 +15,7 @@ class my_controller(main.Home): @@ -15,7 +15,7 @@ class academy(main.Home):
@http.route('/', auth='none') @http.route('/', auth='none')
def index(self): def index(self):
tas = [ tas = [
@ -13,7 +13,7 @@ diff --git a/controllers/my_controller.py b/controllers/my_controller.py
for i, ta in enumerate(teaching_assistants) for i, ta in enumerate(teaching_assistants)
] ]
@@ -39,7 +39,7 @@ class my_controller(main.Home): @@ -39,7 +39,7 @@ class academy(main.Home):
'tas': '\n'.join(tas) 'tas': '\n'.join(tas)
} }
@ -22,7 +22,7 @@ diff --git a/controllers/my_controller.py b/controllers/my_controller.py
def ta(self, id): def ta(self, id):
return """<!doctype html> return """<!doctype html>
<html> <html>
@@ -51,4 +51,4 @@ class my_controller(main.Home): @@ -51,4 +51,4 @@ class academy(main.Home):
<h1>%(name)s</h1> <h1>%(name)s</h1>
</body> </body>
</html> </html>

View File

@ -1,5 +1,5 @@
# HG changeset patch # HG changeset patch
# Parent f84f5783ecf4eabd018fd27548423b5cefc1d2dc # Parent dce817856f7995c3220ef7261c26b83006c3627e
diff --git a/__openerp__.py b/__openerp__.py diff --git a/__openerp__.py b/__openerp__.py
--- a/__openerp__.py --- a/__openerp__.py
@ -13,11 +13,11 @@ diff --git a/__openerp__.py b/__openerp__.py
'data': [ 'data': [
'security/ir.model.access.csv', 'security/ir.model.access.csv',
'views/templates.xml', 'views/templates.xml',
diff --git a/controllers/my_controller.py b/controllers/my_controller.py diff --git a/controllers/academy.py b/controllers/academy.py
--- a/controllers/my_controller.py --- a/controllers/academy.py
+++ b/controllers/my_controller.py +++ b/controllers/academy.py
@@ -14,18 +14,10 @@ teaching_assistants = [ @@ -14,18 +14,10 @@ teaching_assistants = [
class my_controller(main.Home): class academy(main.Home):
@http.route('/', auth='none') @http.route('/', auth='none')
def index(self): def index(self):
- cr, uid, context = http.request.cr, http.request.uid, http.request.context - cr, uid, context = http.request.cr, http.request.uid, http.request.context

View File

@ -1,13 +1,13 @@
# HG changeset patch # HG changeset patch
# Parent 341dd9480911ad71df915449944e21275a1f32c6 # Parent 006b3182bb96e16310fd6fc4be808bd5698f1ab6
diff --git a/controllers/my_controller.py b/controllers/my_controller.py diff --git a/controllers/academy.py b/controllers/academy.py
--- a/controllers/my_controller.py --- a/controllers/academy.py
+++ b/controllers/my_controller.py +++ b/controllers/academy.py
@@ -12,12 +12,12 @@ teaching_assistants = [ @@ -12,12 +12,12 @@ teaching_assistants = [
] ]
class my_controller(main.Home): class academy(main.Home):
- @http.route('/', auth='none') - @http.route('/', auth='none')
+ @http.route('/', auth='public') + @http.route('/', auth='public')
def index(self): def index(self):