diff --git a/doc/howto/howto_website.rst b/doc/howto/howto_website.rst index 0ca53e49610..7eccd24935f 100644 --- a/doc/howto/howto_website.rst +++ b/doc/howto/howto_website.rst @@ -22,31 +22,15 @@ In OpenERP, doing things takes the form of creating modules, and these modules customize the behavior of the OpenERP installation. The first step is thus to create a module: -.. todo:: code generator in oe? +.. code:: shell-session - * Create empty module (mandatory name, category) - * Create controller (parent class?) - * Create model (concrete/abstract? Inherit?) - * Add field? + > oe scaffold Academy -* Create a new folder called :file:`academy` in a module directory, inside it - create an empty file called :file:`__openerp__.py` with the following - content: +.. patch:: + :hidden: - .. patch:: - -* Create a second file :file:`controllers.py`. This is where the code - interacting directly with your web browser will live. For starters, just - include the following in it: - - .. patch:: - -* Finally, create a third file :file:`__init__.py` containing just: - - .. patch:: - - This makes :file:`controllers.py` "visible" to openerp (by running the code - it holds). +This builds a basic module for you, ignore anything in the ``models`` and +``security`` directories for now. .. todo:: @@ -66,8 +50,8 @@ display). Let's prettify things a bit: instead of returning just a bit of text, we can return a page, and use a tool/library like bootstrap_ to get a nicer rendering than the default. -Change the string returned by the ``index`` method to get a more page-ish -output: +Go to :file:`academy/controllers/my_controller.py` and change the string +returned by the ``index`` method to get a more page-ish output: .. patch:: diff --git a/doc/howto/howto_website/basic-controller b/doc/howto/howto_website/basic-controller deleted file mode 100644 index 4415d9516bc..00000000000 --- a/doc/howto/howto_website/basic-controller +++ /dev/null @@ -1,15 +0,0 @@ -# HG changeset patch -# Parent 458a542843918f6899fe64bfe1cead00972ef68a - -diff --git a/controllers.py b/controllers.py -new file mode 100644 ---- /dev/null -+++ b/controllers.py -@@ -0,0 +1,7 @@ -+from openerp import http -+from openerp.addons.web.controllers import main -+ -+class Home(main.Home): -+ @http.route('/', auth='none') -+ def index(self): -+ return "Hello, world!" diff --git a/doc/howto/howto_website/basic-page b/doc/howto/howto_website/basic-page index 5a60c346acf..9e6c9d9abc7 100644 --- a/doc/howto/howto_website/basic-page +++ b/doc/howto/howto_website/basic-page @@ -1,11 +1,11 @@ # HG changeset patch -# Parent b377930cec8f9445882bb3268f9f5fac71dd8c15 +# Parent a76a9a0e0668f4191bdc383a0d4b3173f44b39b1 -diff --git a/controllers.py b/controllers.py ---- a/controllers.py -+++ b/controllers.py -@@ -4,4 +4,21 @@ from openerp.addons.web.controllers impo - class Home(main.Home): +diff --git a/controllers/my_controller.py b/controllers/my_controller.py +--- a/controllers/my_controller.py ++++ b/controllers/my_controller.py +@@ -6,4 +6,16 @@ from openerp.addons.web.controllers impo + class my_controller(main.Home): @http.route('/', auth='none') def index(self): - return "Hello, world!" @@ -18,12 +18,7 @@ diff --git a/controllers.py b/controllers.py + +

Introduction to a thing

+

Course description

-+

-+ This course will provide a basic introduction to a thing, for -+ motivated students with no prior experience in things. The course -+ will focus on the discovery of things and the planning and -+ organization necessary to handle things. -+

++

Course introduction

+ + +""" diff --git a/doc/howto/howto_website/data-to-demo b/doc/howto/howto_website/data-to-demo index 4c0797f0543..2be34f484cf 100644 --- a/doc/howto/howto_website/data-to-demo +++ b/doc/howto/howto_website/data-to-demo @@ -1,11 +1,12 @@ # HG changeset patch -# Parent 2af29a429acda61e5e567997dad78a673e011796 +# Parent 8799d7578ebf7aa0d81f0dbafa959f8abd106dff + diff --git a/__openerp__.py b/__openerp__.py --- a/__openerp__.py +++ b/__openerp__.py -@@ -5,7 +5,9 @@ +@@ -19,8 +19,10 @@ 'data': [ - 'ir.model.access.csv', + 'security/ir.model.access.csv', 'views/templates.xml', - 'data/teaching_assistants.xml', - 'data/lectures.xml', @@ -13,8 +14,9 @@ diff --git a/__openerp__.py b/__openerp__.py + 'demo': [ + 'demo/teaching_assistants.xml', + 'demo/lectures.xml', - ] - } + ], + 'tests': [ + ], diff --git a/data/lectures.xml b/demo/lectures.xml rename from data/lectures.xml rename to demo/lectures.xml diff --git a/doc/howto/howto_website/lectures-action-and-menus b/doc/howto/howto_website/lectures-action-and-menus index 2f851491c9a..3ca5c055f39 100644 --- a/doc/howto/howto_website/lectures-action-and-menus +++ b/doc/howto/howto_website/lectures-action-and-menus @@ -1,11 +1,12 @@ # HG changeset patch -# Parent 419f2476f7485ffc81eced5233f323c3bea76100 +# Parent f8963c3ab009d422767aaaaa29f8ce08f84ac299 + diff --git a/__openerp__.py b/__openerp__.py --- a/__openerp__.py +++ b/__openerp__.py -@@ -5,6 +5,7 @@ +@@ -19,6 +19,7 @@ 'data': [ - 'ir.model.access.csv', + 'security/ir.model.access.csv', 'views/templates.xml', + 'data/views.xml', ], diff --git a/doc/howto/howto_website/lectures-model-add b/doc/howto/howto_website/lectures-model-add index dd53130721d..a467817faad 100644 --- a/doc/howto/howto_website/lectures-model-add +++ b/doc/howto/howto_website/lectures-model-add @@ -1,21 +1,22 @@ # HG changeset patch -# Parent 65912bc56408d6bf61b2023a79a48e06a22fe9e2 +# Parent 9042ace1e3e8175155d9dbed75657222a371cdb6 diff --git a/__openerp__.py b/__openerp__.py --- a/__openerp__.py +++ b/__openerp__.py -@@ -6,5 +6,6 @@ - 'ir.model.access.csv', +@@ -20,6 +20,7 @@ + 'security/ir.model.access.csv', 'views/templates.xml', 'data/teaching_assistants.xml', + 'data/lectures.xml', - ] - } -diff --git a/controllers.py b/controllers.py ---- a/controllers.py -+++ b/controllers.py -@@ -4,10 +4,15 @@ from openerp.addons.web.controllers impo - class Home(main.Home): + ], + 'tests': [ + ], +diff --git a/controllers/my_controller.py b/controllers/my_controller.py +--- a/controllers/my_controller.py ++++ b/controllers/my_controller.py +@@ -6,10 +6,15 @@ from openerp.addons.web.controllers impo + class my_controller(main.Home): @http.route('/', auth='public') def index(self): + cr, uid, context = http.request.cr, http.request.uid, http.request.context @@ -59,17 +60,10 @@ new file mode 100644 + + + -diff --git a/ir.model.access.csv b/ir.model.access.csv ---- a/ir.model.access.csv -+++ b/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_tas,access_academy_tas,model_academy_tas,,1,0,0,0 -+access_academy_lectures,access_academy_lectures,model_academy_lectures,,1,0,0,0 -diff --git a/models.py b/models.py ---- a/models.py -+++ b/models.py -@@ -9,3 +9,12 @@ class TeachingAssistants(orm.Model): +diff --git a/models/my_model.py b/models/my_model.py +--- a/models/my_model.py ++++ b/models/my_model.py +@@ -8,3 +8,12 @@ class TeachingAssistants(orm.Model): 'name': fields.char(), 'biography': fields.html(), } @@ -82,6 +76,14 @@ diff --git a/models.py b/models.py + 'name': fields.char(required=True), + 'date': fields.date(required=True), + } +diff --git a/security/ir.model.access.csv b/security/ir.model.access.csv +--- a/security/ir.model.access.csv ++++ b/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_tas,access_academy_tas,model_academy_tas,,1,0,0,0 ++access_academy_lectures,access_academy_lectures,model_academy_lectures,,1,0,0,0 +\ No newline at end of file diff --git a/views/templates.xml b/views/templates.xml --- a/views/templates.xml +++ b/views/templates.xml diff --git a/doc/howto/howto_website/manifest b/doc/howto/howto_website/manifest index 3cf359c9b30..3c81585b522 100644 --- a/doc/howto/howto_website/manifest +++ b/doc/howto/howto_website/manifest @@ -1,11 +1,90 @@ # HG changeset patch # Parent 0000000000000000000000000000000000000000 + +diff --git a/__init__.py b/__init__.py +new file mode 100644 +--- /dev/null ++++ b/__init__.py +@@ -0,0 +1,4 @@ ++# -*- coding: utf-8 -*- ++import controllers ++import models ++ diff --git a/__openerp__.py b/__openerp__.py new file mode 100644 --- /dev/null +++ b/__openerp__.py -@@ -0,0 +1,4 @@ +@@ -0,0 +1,22 @@ ++# -*- coding: utf-8 -*- +{ + 'name': "Academy", -+ 'category': "Tools", ++ # short description, used as subtitles on modules listings ++ 'summary': "", ++ # long description of module purpose ++ 'description': """ ++""", ++ # Who you are ++ 'author': "", ++ 'website': "", ++ ++ # categories can be used to filter modules in modules listing ++ 'category': 'Uncategorized', ++ 'version': '0.1', ++ ++ # any module necessary for this one to work correctly ++ 'depends': ['web'], ++ 'data': ['security/ir.model.access.csv'], ++ 'tests': [ ++ ], +} +diff --git a/controllers/__init__.py b/controllers/__init__.py +new file mode 100644 +--- /dev/null ++++ b/controllers/__init__.py +@@ -0,0 +1,3 @@ ++# -*- coding: utf-8 -*- ++import my_controller ++ +diff --git a/controllers/my_controller.py b/controllers/my_controller.py +new file mode 100644 +--- /dev/null ++++ b/controllers/my_controller.py +@@ -0,0 +1,9 @@ ++# -*- coding: utf-8 -*- ++ ++from openerp import http ++from openerp.addons.web.controllers import main ++ ++class my_controller(main.Home): ++ @http.route('/', auth='none') ++ def index(self): ++ return "Hello, world!" +diff --git a/models/__init__.py b/models/__init__.py +new file mode 100644 +--- /dev/null ++++ b/models/__init__.py +@@ -0,0 +1,3 @@ ++# -*- coding: utf-8 -*- ++import my_model ++ +diff --git a/models/my_model.py b/models/my_model.py +new file mode 100644 +--- /dev/null ++++ b/models/my_model.py +@@ -0,0 +1,9 @@ ++# -*- coding: utf-8 -*- ++from openerp.osv import orm, fields ++ ++class my_model(orm.Model): ++ _name = "academy.my_model" ++ ++ _columns = { ++ 'name': fields.char(), ++ } +diff --git a/security/ir.model.access.csv b/security/ir.model.access.csv +new file mode 100644 +--- /dev/null ++++ b/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_my_model,access_academy_my_model,model_academy_my_model,,1,0,0,0 diff --git a/doc/howto/howto_website/module-init b/doc/howto/howto_website/module-init deleted file mode 100644 index 4484236edc9..00000000000 --- a/doc/howto/howto_website/module-init +++ /dev/null @@ -1,8 +0,0 @@ -# HG changeset patch -# Parent 2d3441ff4321c4a931940e64fcfb2fe54bd0ad17 -diff --git a/__init__.py b/__init__.py -new file mode 100644 ---- /dev/null -+++ b/__init__.py -@@ -0,0 +1,1 @@ -+import controllers diff --git a/doc/howto/howto_website/series b/doc/howto/howto_website/series index e8b52f313a3..d34c6476bb7 100644 --- a/doc/howto/howto_website/series +++ b/doc/howto/howto_website/series @@ -1,6 +1,4 @@ manifest -basic-controller -module-init basic-page ta-controller url-pattern diff --git a/doc/howto/howto_website/ta-controller b/doc/howto/howto_website/ta-controller index 5b8d0b799d5..080111bb4d4 100644 --- a/doc/howto/howto_website/ta-controller +++ b/doc/howto/howto_website/ta-controller @@ -1,10 +1,10 @@ # HG changeset patch -# Parent 30a859b5dc378c0da751537b1342e8d22775ad44 +# Parent a615de71be483d88acca032ad5d35072c87999c0 -diff --git a/controllers.py b/controllers.py ---- a/controllers.py -+++ b/controllers.py -@@ -1,9 +1,22 @@ +diff --git a/controllers/my_controller.py b/controllers/my_controller.py +--- a/controllers/my_controller.py ++++ b/controllers/my_controller.py +@@ -3,9 +3,22 @@ from openerp import http from openerp.addons.web.controllers import main @@ -16,7 +16,7 @@ diff --git a/controllers.py b/controllers.py + {'name': "Tanya Harris"}, +] + - class Home(main.Home): + class my_controller(main.Home): @http.route('/', auth='none') def index(self): + tas = [ @@ -27,10 +27,10 @@ diff --git a/controllers.py b/controllers.py return """ -@@ -19,6 +32,26 @@ class Home(main.Home): - will focus on the discovery of things and the planning and - organization necessary to handle things. -

+@@ -16,6 +29,26 @@ class my_controller(main.Home): +

Introduction to a thing

+

Course description

+

Course introduction

+

Teaching Assistants

+