Python has an iteration fallback protocol: when iterating over an
object which does not define __iter__, if the object defines
__getitem__ it considers that it's a list, and invokes __getitem__
from index `0`.
This can be a problem in openerp in methods which expect an list of
ids but are only given a single id (not a singleton list), in that
case self.browse() will return a single browse_record (instea of a
list) and the method tries to iterate over it by calling
browse_record.__getitem__.
Problem is that browse_record.__getitem__ is pretty deep and does
little validation, so the error appears 3 frames below where the
actual issue is with a completely cryptic message of "KeyError: 0",
which makes the actual harder to track.
By raising an error immediately in browse_record.__iter__, this kind
of issues is much easier to handle, the stack points precisely to the
frame in error with a clearer message.
bzr revid: xmo@openerp.com-20111005112444-jcp9fw6pa36ahpsd
- _original_module is now available on model/browse_records
- context usage in res.partner.*
- proper name_search() + default values for res.currency
- active_model in wkf exec context
- safe_eval allows try/except/finally
- yaml_import: !ref {id: xml_id} works
- ir_mail_server: support for alternative body/subtype
- default value for web.base.url config parameter
- consistency rename: Model.*get_xml_id* -> *get_external_id*
bzr revid: odo@openerp.com-20111005100954-c8mbd4kz6kkqaj84
The 'module' field of ir.model.data is required, so we
we need to set it when auto-generating ir.mode.data
entries. This acts as the namespace of the record.
Because we don't want exported records to look like they
belong to an existing module (and risk being garbage
collected at the next module update), we put these
auto-generated names in a reserved '__export__' module
namespace.
bzr revid: odo@openerp.com-20111004205140-duaww77ng4qmktj2
ORM Models already have a _module attribute that contains the
name of the module that declared this class, however
sometimes we also need the name of the module that
declared this model the first time.
This will be stored in _original_module and is the
name of the module to which the first parent with
the same _name belongs to.
bzr revid: odo@openerp.com-20111004204705-8z9o70n1ynpvng3i
fields_view_get removed multi=True actions from the result of
ir_values.get_actions('client_action_multi', ...), so that multi
actions would not be displayed in the form view's sidebar in the GTK
client.
The web client has a sidebar in both cases, the GTK client just
ignores 'toolbar' key if not in tree view, so don't remove 'multi'
actions in tree view toolbar, to avoid having to perform one more RPC
call (explicit ir_values.get) in web client.
lp bug: https://launchpad.net/bugs/856378 fixed
bzr revid: xmo@openerp.com-20110929130701-65ubx1o0swk889nl
This allows for transparent inheritance of m2m columns via _inherit,
as long as the m2m relationship table is not explicitly named in
the declaration.
bzr revid: odo@openerp.com-20110926171451-n2jg8pbl5mq715vk
We'll now have a BaseModel with 3 subclasses, AbstractModel,
TransientModel and Model. Model is for regular models,
TransientModel for automatically-vacuumed models, and
AbstractModel for common superclasses meant to be
inherited by other models only, and not directly used.
bzr revid: odo@openerp.com-20110923124525-jfzk55dk3ban2ps2