Merge lp:~oemedical-commiter/oemedical/trunk-ImprovingDocs into lp:oemedical

Proposed by Nhomar - Vauxoo
Status: Merged
Merged at revision: 68
Proposed branch: lp:~oemedical-commiter/oemedical/trunk-ImprovingDocs
Merge into: lp:oemedical
Diff against target: 448 lines (+313/-22)
10 files modified
oemedical/oemedical_appointment/oemedical_appointment.py (+1/-3)
web_doc_oemedical/controllers/main.py (+1/-3)
web_doc_oemedical/doc/_templates/sidebarintro.html (+16/-11)
web_doc_oemedical/doc/_templates/sidebarlogo.html (+0/-3)
web_doc_oemedical/doc/_themes/flask/theme.conf (+2/-2)
web_doc_oemedical/doc/api_oemedical_index.rst (+6/-0)
web_doc_oemedical/doc/conf.py (+15/-0)
web_doc_oemedical/doc/contribute.rst (+184/-0)
web_doc_oemedical/doc/index.rst (+8/-0)
web_doc_oemedical/doc/snnipets/snnipets.py (+80/-0)
To merge this branch: bzr merge lp:~oemedical-commiter/oemedical/trunk-ImprovingDocs
Reviewer Review Type Date Requested Status
Parthiv Patel Pending
Review via email: mp+137492@code.launchpad.net

Description of the change

Some improvement in doc.
Create minimal structure, some work to do yet.
Just to be sure it is merged, befoce continue with documentation process.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'oemedical/oemedical_appointment/oemedical_appointment.py'
2--- oemedical/oemedical_appointment/oemedical_appointment.py 2012-12-01 10:08:17 +0000
3+++ oemedical/oemedical_appointment/oemedical_appointment.py 2012-12-03 07:05:27 +0000
4@@ -25,7 +25,7 @@
5
6 class OeMedicalAppointment(osv.osv):
7 _name = 'oemedical.appointment'
8-
9+ _description = 'Appointments in OeMedical'
10 _columns = {
11 'consultations': fields.many2one('product.product',
12 string='Consultation Services', ),
13@@ -56,6 +56,4 @@
14 'name': lambda obj, cr, uid, context:
15 obj.pool.get('ir.sequence').get(cr, uid, 'oemedical.appointment'),
16 }
17-
18-OeMedicalAppointment()
19 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
20
21=== modified file 'web_doc_oemedical/controllers/main.py'
22--- web_doc_oemedical/controllers/main.py 2012-12-02 05:23:06 +0000
23+++ web_doc_oemedical/controllers/main.py 2012-12-03 07:05:27 +0000
24@@ -30,9 +30,7 @@
25 '''
26 whereami=os.path.dirname(os.path.realpath(__file__))
27
28- f = open(os.path.join("%s/../_build/html/%s"%(whereami, name), "r")
29- html = f.read()
30- return html
31+ return ''
32
33
34 class OeMedicalDoc(web.http.Controller):
35
36=== added file 'web_doc_oemedical/doc/_static/icon-sidebar.png'
37Binary files web_doc_oemedical/doc/_static/icon-sidebar.png 1970-01-01 00:00:00 +0000 and web_doc_oemedical/doc/_static/icon-sidebar.png 2012-12-03 07:05:27 +0000 differ
38=== added file 'web_doc_oemedical/doc/_static/icon.png'
39Binary files web_doc_oemedical/doc/_static/icon.png 1970-01-01 00:00:00 +0000 and web_doc_oemedical/doc/_static/icon.png 2012-12-03 07:05:27 +0000 differ
40=== modified file 'web_doc_oemedical/doc/_templates/sidebarintro.html'
41--- web_doc_oemedical/doc/_templates/sidebarintro.html 2012-12-02 05:06:35 +0000
42+++ web_doc_oemedical/doc/_templates/sidebarintro.html 2012-12-03 07:05:27 +0000
43@@ -1,16 +1,21 @@
44-<p class="logo"><a href="http://doc.openerp.com/">
45- <img class="logo" src="{{ pathto('_static/openerp.png', 1) }}" alt="Logo"/>
46-</a></p>
47-
48-<h3>Other Docs</h3>
49-<ul>
50- <li><a href="http://doc.openerp.com/trunk/developers">OpenERP Developers Documentation</a></li>
51- <li><a href="http://doc.openerp.com/trunk/developers/web">OpenERP Web Developers Documentation</a></li>
52- <li><a href="http://doc.openerp.com/trunk/users">OpenERP Users Documentation</a></li>
53-</ul>
54-
55 <h3>Useful Links</h3>
56 <ul>
57+ <li><a href="http://www.oemedical.org/">OeMedical Community Site</a></li>
58 <li><a href="http://www.openerp.com/">The OpenERP website</a></li>
59 <li><a href="http://python.org/">The Python programming language</a></li>
60 </ul>
61+<h3>External Docs</h3>
62+<p>
63+You must have this docs present to understand the OeMedical Documentation.
64+</p>
65+<ul>
66+ <li><a href="http://doc.openerp.com/trunk/developers">OpenERP Developers</a></li>
67+ <li><a href="http://doc.openerp.com/trunk/developers/web">OpenERP Web Developers</a></li>
68+ <li><a href="http://doc.openerp.com/trunk/users">OpenERP Users</a></li>
69+ <li><a href="http://doc.openerp.com/v6.1/contribute/index.html#how-to-contribute-link">OpenERP Community</a></li>
70+ <li><a href="http://doc.openerp.com/v6.1/usability_book/index.html#usability-link">Useability Guidelines</a></li>
71+</ul>
72+<h4>Social Networks</h4>
73+<a class="twitter-timeline" data-dnt=true href="https://twitter.com/oemedicalteam" data-widget-id="275457328831139840">Tweets by @oemedicalteam</a>
74+<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
75+
76
77=== modified file 'web_doc_oemedical/doc/_templates/sidebarlogo.html'
78--- web_doc_oemedical/doc/_templates/sidebarlogo.html 2012-12-02 05:06:35 +0000
79+++ web_doc_oemedical/doc/_templates/sidebarlogo.html 2012-12-03 07:05:27 +0000
80@@ -1,3 +0,0 @@
81-<p class="logo"><a href="{{ pathto(master_doc) }}">
82- <img class="logo" src="{{ pathto('_static/openerp.png', 1) }}" alt="Logo"/>
83-</a></p>
84
85=== modified file 'web_doc_oemedical/doc/_themes/flask/theme.conf'
86--- web_doc_oemedical/doc/_themes/flask/theme.conf 2012-12-02 05:06:35 +0000
87+++ web_doc_oemedical/doc/_themes/flask/theme.conf 2012-12-03 07:05:27 +0000
88@@ -4,6 +4,6 @@
89 pygments_style = flask_theme_support.FlaskyStyle
90
91 [options]
92-index_logo = ''
93-index_logo_height = 120px
94+index_logo = 'icon.png'
95+index_logo_height = 60px
96 touch_icon =
97
98=== modified file 'web_doc_oemedical/doc/api_oemedical_index.rst'
99--- web_doc_oemedical/doc/api_oemedical_index.rst 2012-12-02 05:06:35 +0000
100+++ web_doc_oemedical/doc/api_oemedical_index.rst 2012-12-03 07:05:27 +0000
101@@ -1,3 +1,9 @@
102 ============================
103 OeMedical API Documentation.
104 ============================
105+
106+.. autoclass:: oemedical_appointment.OeMedicalAppointment
107+ :special-members: __all__
108+
109+.. autoclass:: oemedical_patient.OeMedicalPatient
110+ :special-members: __all__
111
112=== modified file 'web_doc_oemedical/doc/conf.py'
113--- web_doc_oemedical/doc/conf.py 2012-12-02 05:06:35 +0000
114+++ web_doc_oemedical/doc/conf.py 2012-12-03 07:05:27 +0000
115@@ -17,8 +17,20 @@
116 # add these directories to sys.path here. If the directory is relative to the
117 # documentation root, use os.path.abspath to make it absolute, like shown here.
118 #sys.path.insert(0, os.path.abspath('.'))
119+#Necesary to import osv.osv in autodoc
120+SERVERPATH = "/home/nhomar/instancias/7.0/server/openerp"
121+#Necesary to import openerp in autodoc
122+OPENERPPATH = "/home/nhomar/instancias/7.0/server"
123+#OeMEdical Relative path.
124+OEMEDICALPATH = '../../oemedical'
125 sys.path.append(os.path.abspath('_themes'))
126 sys.path.append(os.path.abspath('..'))
127+sys.path.append(SERVERPATH)
128+sys.path.append(OPENERPPATH)
129+#sys.path.append(os.path.abspath(OEMEDICALPATH))
130+for oemModule in os.listdir(OEMEDICALPATH):
131+ sys.path.append(os.path.join(OEMEDICALPATH,oemModule))
132+
133 #Uncomment this line to include all models and methods documentations
134 #sys.path.append(os.path.abspath('../model'))
135
136@@ -31,6 +43,8 @@
137 # coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
138 extensions = ['sphinx.ext.autodoc', 'sphinx.ext.intersphinx', 'sphinx.ext.todo', 'sphinx.ext.viewcode']
139
140+autodoc_default_flags = ['members', 'undoc-members', 'linenos']
141+
142 # Add any paths that contain templates here, relative to this directory.
143 templates_path = ['_templates']
144
145@@ -115,6 +129,7 @@
146 # The name of an image file (relative to this directory) to place at the top
147 # of the sidebar.
148 #html_logo = None
149+html_logo = 'icon-sidebar.png'
150
151 # The name of an image file (within the static path) to use as favicon of the
152 # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
153
154=== added file 'web_doc_oemedical/doc/contribute.rst'
155--- web_doc_oemedical/doc/contribute.rst 1970-01-01 00:00:00 +0000
156+++ web_doc_oemedical/doc/contribute.rst 2012-12-03 07:05:27 +0000
157@@ -0,0 +1,184 @@
158+.. sectnum::
159+ :start: 1
160+
161+All the coding guidelines of OeMEdical is based on
162+`OpenERP guidelines for coding.`_
163+
164+Some exceptions in Styles are in this code that you must to follow to approve
165+`merge proposals`_ and ensure the quality of the system.
166+
167+Coding Styles
168++++++++++++++
169+
170+What will be considered good or bad code to merge in core.
171+
172+Your code should be pep8 compliant.
173+-----------------------------------
174+
175+In order to be sure our code is of high wuality, is important use some
176+conventions in the python world the most accepted is the `pep8 convention`_,
177+we will use it in this project.
178+
179+If you develop in a linux enviroment you can install ``pep8`` program:
180+
181+.. code-block:: guess
182+
183+ sudo apt-get install pep8
184+
185+With this program you will be able to test your code before the `merge proposals`_
186+or even test the code of other person to help us to answer with Q&A reasons
187+before commit or merge changes.
188+
189+i.e:
190+
191+.. code-block:: guess
192+
193+ pep8 yourpythonfile.py
194+
195+It will return a set of results about the quality of your code see
196+``pep8 --help`` for more information.
197+
198+About new objects
199+-----------------
200+
201+A new object is this one that for functional or design reasons is not included
202+on the core of OpenERP.
203+
204+New classes signature.
205+''''''''''''''''''''''
206+
207+All new classes must start with ``OeMedicalName`` see it in `CamelCase`.
208+
209+i.e.:
210+
211+.. literalinclude:: snnipets/snnipets.py
212+ :lines: 2
213+
214+New Object name.
215+''''''''''''''''
216+
217+All new objects will complay with OpenERP standard it means separated by one dot
218+between words.
219+
220+i.e.
221+
222+.. literalinclude:: snnipets/snnipets.py
223+ :lines: 15
224+
225+New method signature.
226+'''''''''''''''''''''
227+
228+All new methods will be named with `snake_case`.
229+
230+File management for new objects
231+'''''''''''''''''''''''''''''''
232+
233+All new objects will be in a new folder, with both xml and py files, see
234+``oemedical`` modules for some example.
235+
236+About Openerp Version.
237+----------------------
238+
239+In version 1.0 of OeMedical we decide work with version 7.0 of OpenERP, for
240+this reason some specific conventions must be verified.
241+
242+Views 7.0 compatibles.
243+''''''''''''''''''''''
244+
245+All views that use OeMedical will comply with version 7.0 of OpenERP.
246+
247+About Data for Standards.
248+-------------------------
249+
250+Data loaded should be in an extra module called oemedical_yourstandard_data,
251+to separate data errors from model errors, frequently data dont change too much,
252+because it is based on Standards.
253+
254+.. warning::
255+
256+ If the data is necesary for the correct work of your module this rule
257+ do not apply
258+
259+About Complementary Modules.
260+----------------------------
261+
262+Modules that improve functionality working with the core of openerp, should be
263+in an extra module, it means.
264+
265+i.e:
266+
267+* Creation of Automated invoices and commercial management: oemedical_account
268+* Relation with sale orders: oemedical_sale
269+* Relation with purchase: oemedical_purchase
270+
271+Avoid use names not self descriptive, as `oemedical_purchase_ext`, the correct
272+sufix should say what it is improving.
273+
274+Useability Guidelines.
275+----------------------
276+
277+If a model is inherited, we should create them own view with them own action,
278+to be sure the user is able to use this model in its functional context without
279+unnecesary information in this function.
280+
281+Technical requirements.
282+-----------------------
283+
284+If a model impact some kind of a more than 3 steps flow, the object ``MUST`` have
285+Workflow.
286+
287+Documentation Guidelines
288+++++++++++++++++++++++++
289+
290+In order to be sure the useabilty and to avoid not re-use the job of others
291+members of community will not be merged any module or improvement that is not
292+correct documented.
293+
294+How Documentation will be included.
295+-----------------------------------
296+
297+All documentation will be in a web_doc_yourmodule module to be able to embed documentation compiled with sphinx in the same server.
298+
299+.. note::
300+
301+ TODO: Put some example or link to a branch with a basic template for this
302+ kind of module.
303+
304+Guidelines to document your improvement.
305+----------------------------------------
306+
307+We must try to document following `pep-0257 convention`_.
308+
309+As the standard is a little extense we share some useful snnipets, with some
310+examples.
311+
312+.. literalinclude:: snnipets/snnipets.py
313+ :lines: 48-66
314+
315+It is important understand that the documentation with pep standards just
316+propose some good practices from the technical point of view, to be sure all
317+is correct and all community involved has the correct approach about what
318+document and how, some premises are listed below, and the community can propose
319+another ones to follow, in the middle this methodology can be reviewed and
320+improved.
321+
322+About comments in code:
323+-----------------------
324+
325+At least the model is still on development, we must avoid code commented,
326+all commentaries must be usuables by sphinx to use `autodoc`_ embebed.
327+
328+Try to commit with a really `explicit`_ message to avoid unecessary comments
329+
330+.. footer::
331+
332+ All discussion regading this guidelines is in Launchpad on this topic, you can
333+ collaborate in this `discussion`_
334+
335+.. _pep-0257 convention: http://www.python.org/dev/peps/pep-0257/
336+.. _OpenERP guidelines for coding.: http://doc.openerp.com/v6.1/contribute/15_guidelines/coding_guidelines.html
337+.. _merge proposals: https://help.launchpad.net/Code/Review?action=show&redirect=BranchMergeProposals
338+.. _explicit: http://doc.openerp.com/v6.1/contribute/15_guidelines/coding_guidelines_framework.html#bazaar-is-your-historian
339+.. _pep8 convention: http://www.python.org/dev/peps/pep-0008/
340+.. _autodoc: http://sphinx-doc.org/ext/autodoc.html#directive-autoattribute
341+.. _discussion: https://blueprints.launchpad.net/oemedical/+spec/coding-guidelines
342
343=== modified file 'web_doc_oemedical/doc/index.rst'
344--- web_doc_oemedical/doc/index.rst 2012-12-02 05:06:35 +0000
345+++ web_doc_oemedical/doc/index.rst 2012-12-03 07:05:27 +0000
346@@ -32,6 +32,14 @@
347 OeMedical API.
348 ''''''''''''''
349
350+Coding Guidelines
351++++++++++++++++++
352+
353+.. toctree::
354+ :maxdepth: 2
355+
356+ contribute.rst
357+
358 .. toctree::
359 :maxdepth: 2
360
361
362=== added directory 'web_doc_oemedical/doc/snnipets'
363=== added file 'web_doc_oemedical/doc/snnipets/snnipets.py'
364--- web_doc_oemedical/doc/snnipets/snnipets.py 1970-01-01 00:00:00 +0000
365+++ web_doc_oemedical/doc/snnipets/snnipets.py 2012-12-03 07:05:27 +0000
366@@ -0,0 +1,80 @@
367+# -*- encoding: utf-8 -*-
368+class OeMedicalAppointment(osv.osv):
369+ '''
370+ DocString for a new object.
371+ Is important say here where will be the menu to test this object.
372+ Mention the reason whay it was created, if it is necesary link
373+ some `external <http://externaldoc.com>`_
374+ especitication about why it was created.
375+
376+ Probably, there an object on OpenERP base that already comply with your
377+ needs and in this case it will be easyiest to propose a redisign of the
378+ feature, or propose a better solution, in other hand it can be used as
379+ reference for other features if it is documented enought.
380+ '''
381+ _name = 'oemedical.appointment'
382+ _description = 'Appointments in OeMedical'
383+ _columns = {
384+ 'consultations': fields.many2one('product.product',
385+ string='Consultation Services', ),
386+ 'patient': fields.many2one('oemedical.patient', string='Patient',
387+ required=True, select=True),
388+ 'name': fields.char(size=256, string='Appointment ID', readonly=True),
389+ 'appointment_date': fields.datetime(string='Date and Time'),
390+ 'doctor': fields.many2one('oemedical.physician',
391+ string='Physician',select=True),
392+ 'comments': fields.text(string='Comments'),
393+ 'appointment_type': fields.selection([
394+ ('ambulatory', 'Ambulatory'),
395+ ('outpatient', 'Outpatient'),
396+ ('inpatient', 'Inpatient'),
397+ ], string='Type'),
398+ 'institution': fields.many2one('res.partner',
399+ string='Health Center', ),
400+ 'urgency': fields.selection([
401+ ('a', 'Normal'),
402+ ('b', 'Urgent'),
403+ ('c', 'Medical Emergency'), ],
404+ string='Urgency Level'),
405+ 'speciality': fields.many2one('oemedical.specialty',
406+ string='Specialty', ),
407+ }
408+
409+ _defaults = {
410+ 'name': lambda obj, cr, uid, context:
411+ obj.pool.get('ir.sequence').get(cr, uid, 'oemedical.appointment'),
412+ }
413+
414+def test_method(self, cr, uid, ids, context=None):
415+ '''Something in doc
416+
417+ :param context['mail']: 'new' to send a new mail or 'reply'
418+ :type context['mail']: str
419+
420+ If this values are Ok.
421+
422+ .. note::
423+ You must be careful with XX YY
424+
425+ .. code-block:: python
426+
427+ obj = self.pool.get('your.object')
428+ somethingelse
429+
430+ :returns: list -- list with ids of elements
431+ '''
432+ return True
433+
434+def search(self, cr, uid, domain, context=None):
435+ '''
436+ If you overwrite and orm method is important to say why you did it
437+ because for the rest of community will be easier understand and create test
438+ related to your change and consider in the integration with OpenERP API.
439+ :context['mail']: 'new' to send a new mail or 'reply'
440+ If some option is true
441+ :return: True or other thing
442+ '''
443+ return True
444+
445+def undocummented_test_method(self, cr, uid, ids, context=None):
446+ return False
447
448=== added directory 'web_doc_oemedical/static/src/_build'