[FIX] JS tutorial
This commit is contained in:
parent
393331f948
commit
9cd2693286
|
@ -42,15 +42,15 @@ instance.web.form.FieldManagerMixin = {
|
|||
Gives new values for the fields contained in the view. The new values could not be setted
|
||||
right after the call to this method. Setting new values can trigger on_changes.
|
||||
|
||||
@param (dict) values A dictonnary with key = field name and value = new value.
|
||||
@return (Deferred) Is resolved after all the values are setted.
|
||||
@param {Object} values A dictonary with key = field name and value = new value.
|
||||
@return {$.Deferred} Is resolved after all the values are setted.
|
||||
*/
|
||||
set_values: function(values) {},
|
||||
/**
|
||||
Computes an OpenERP domain.
|
||||
|
||||
@param (list) expression An OpenERP domain.
|
||||
@return (boolean) The computed value of the domain.
|
||||
@param {Array} expression An OpenERP domain.
|
||||
@return {boolean} The computed value of the domain.
|
||||
*/
|
||||
compute_domain: function(expression) {},
|
||||
/**
|
||||
|
@ -58,7 +58,7 @@ instance.web.form.FieldManagerMixin = {
|
|||
the field are only supposed to use this context to evualuate their own, they should not
|
||||
extend it.
|
||||
|
||||
@return (CompoundContext) An OpenERP context.
|
||||
@return {CompoundContext} An OpenERP context.
|
||||
*/
|
||||
build_eval_context: function() {},
|
||||
};
|
||||
|
|
|
@ -1548,15 +1548,7 @@ instance.web.View = instance.web.Widget.extend({
|
|||
do_switch_view: function() {
|
||||
this.trigger.apply(this, ['switch_mode'].concat(_.toArray(arguments)));
|
||||
},
|
||||
/**
|
||||
* Cancels the switch to the current view, switches to the previous one
|
||||
*
|
||||
* @param {Object} [options]
|
||||
* @param {Boolean} [options.created=false] resource was created
|
||||
* @param {String} [options.default=null] view to switch to if no previous view
|
||||
*/
|
||||
|
||||
do_search: function(view) {
|
||||
do_search: function(domain, context, group_by) {
|
||||
},
|
||||
on_sidebar_export: function() {
|
||||
new instance.web.DataExport(this, this.dataset).open();
|
||||
|
|
|
@ -20,4 +20,17 @@
|
|||
evaluated, other content is interpreted as literal strings and
|
||||
displayed as-is
|
||||
|
||||
GIS
|
||||
Geographic Information System
|
||||
any computer system or subsystem to capture, store, manipulate,
|
||||
analyze, manage or present spatial and geographical data.
|
||||
|
||||
minified
|
||||
minification
|
||||
process of removing extraneous/non-necessary sections of files
|
||||
(comments, whitespace) and possibly recompiling them using equivalent
|
||||
but shorter structures (`ternary operator`_ instead of ``if/else``) in
|
||||
order to reduce network traffic
|
||||
|
||||
.. _jinja variables: http://jinja.pocoo.org/docs/dev/templates/#variables
|
||||
.. _ternary operator: http://en.wikipedia.org/wiki/%3F:
|
||||
|
|
2180
doc/howtos/web.rst
2180
doc/howtos/web.rst
File diff suppressed because it is too large
Load Diff
Binary file not shown.
After Width: | Height: | Size: 8.6 KiB |
Binary file not shown.
After Width: | Height: | Size: 7.8 KiB |
|
@ -0,0 +1,24 @@
|
|||
:orphan:
|
||||
|
||||
.. _reference/actions:
|
||||
|
||||
=======
|
||||
Actions
|
||||
=======
|
||||
|
||||
.. todo:: fill in documentation, add to TOC
|
||||
|
||||
Actions define the behavior of the system in response to user actions: login,
|
||||
action button, selection of an invoice, ...
|
||||
|
||||
Window Actions
|
||||
==============
|
||||
|
||||
URL Actions
|
||||
===========
|
||||
|
||||
Server Actions
|
||||
==============
|
||||
|
||||
Report Actions
|
||||
==============
|
|
@ -350,6 +350,39 @@ it::
|
|||
will unbind all DOM events, remove the widget's content from the DOM and
|
||||
destroy all widget data.
|
||||
|
||||
Development Guidelines
|
||||
----------------------
|
||||
|
||||
* Identifiers (``id`` attribute) should be avoided. In generic applications
|
||||
and modules, ``id`` limits the re-usability of components and tends to make
|
||||
code more brittle. Most of the time, they can be replaced with nothing,
|
||||
classes or keeping a reference to a DOM node or jQuery element.
|
||||
|
||||
If an ``id`` is absolutely necessary (because a third-party library requires
|
||||
one), the id should be partially generated using ``_.uniqueId()`` e.g.::
|
||||
|
||||
this.id = _.uniqueId('my-widget-')
|
||||
* Avoid predictable/common CSS class names. Class names such as "content" or
|
||||
"navigation" might match the desired meaning/semantics, but it is likely an
|
||||
other developer will have the same need, creating a naming conflict and
|
||||
unintended behavior. Generic class names should be prefixed with e.g. the
|
||||
name of the component they belong to (creating "informal" namespaces, much
|
||||
as in C or Objective-C).
|
||||
* Global selectors should be avoided. Because a component may be used several
|
||||
times in a single page (an example in Odoo is dashboards), queries should be
|
||||
restricted to a given component's scope. Unfiltered selections such as
|
||||
``$(selector)`` or ``document.querySelectorAll(selector)`` will generally
|
||||
lead to unintended or incorrect behavior. Odoo Web's
|
||||
:class:`~openerp.web.Widget` has an attribute providing its DOM root
|
||||
(:attr:`~openerp.web.Widget.$el`), and a shortcut to select nodes directly
|
||||
(:func:`~openerp.web.Widget.$`).
|
||||
* More generally, never assume your components own or controls anything beyond
|
||||
its own personal :attr:`~openerp.web.Widget.$el`
|
||||
* html templating/rendering should use QWeb unless absolutely trivial.
|
||||
* All interactive components (components displaying information to the screen
|
||||
or intercepting DOM events) must inherit from :class:`~openerp.web.Widget`
|
||||
and correctly implement and use its API and life cycle.
|
||||
|
||||
.. _.appendTo():
|
||||
http://api.jquery.com/appendTo/
|
||||
|
||||
|
|
|
@ -827,9 +827,9 @@ class Model(object):
|
|||
or self.session.uid != request.uid:
|
||||
raise Exception("Trying to use Model with badly configured database or user.")
|
||||
|
||||
mod = request.registry.get(self.model)
|
||||
if method.startswith('_'):
|
||||
raise Exception("Access denied")
|
||||
mod = request.registry[self.model]
|
||||
meth = getattr(mod, method)
|
||||
cr = request.cr
|
||||
result = meth(cr, request.uid, *args, **kw)
|
||||
|
|
Loading…
Reference in New Issue