Commit Graph

207 Commits

Author SHA1 Message Date
niv-openerp dbb82b089b [fix] exception when querying a tree view for an osv which does not contain any column (common in the wizards)
lp bug: https://launchpad.net/bugs/877989 fixed

bzr revid: nicolas.vanhoren@openerp.com-20111110135106-crieyt6cnscqocs5
2011-11-10 14:51:06 +01:00
Xavier Morel e317c222a1 [IMP] alias some values in data import, for readability
bzr revid: xmo@openerp.com-20111019114618-6ih4wgfr5hu1kgiy
2011-10-19 13:46:18 +02:00
Xavier Morel b0a92831b3 [IMP] iterate over list indexes + ids via enumerate() rather than via range(len()) + __getitem__
bzr revid: xmo@openerp.com-20111019110215-9jykf1xrzavh00j2
2011-10-19 13:02:15 +02:00
Vo Minh Thu bfbfbc4ac6 [FIX] orm.copy(): corrected return value in docstring.
bzr revid: vmt@openerp.com-20111012090357-2lt8md5s37qp2vm1
2011-10-12 11:03:57 +02:00
Olivier Dony 76c702ca3c [FIX] Model.import_data docstring: cleanup + clear RST warnings for autodoc
The pipe character is taken as an inline substitution
marker, and is easy to avoid in most cases except within
literal blocks.

bzr revid: odo@openerp.com-20111011171148-rluwokcsx7i38i6e
2011-10-11 19:11:48 +02:00
Olivier Dony 4140e3546a [FIX] expression: proper handling of empty string in m2o domain criterions
Also fixed incorrect name_search() implementations in
res.partner and res.currency, and added corresponding
tests.

lp bug: https://launchpad.net/bugs/861350 fixed

bzr revid: odo@openerp.com-20111011163435-szj9vm6x9x8nryn8
2011-10-11 18:34:35 +02:00
Olivier Dony c16befa983 [IMP] orm: resolve_o2m_commands_...: simplify assert, remove context doc following guidelines
bzr revid: odo@openerp.com-20111011144146-b9rt5kc9sb5lj0dr
2011-10-11 16:41:46 +02:00
Xavier Morel 34fcc08a1f [IMP] docstring for resolve_o2m_commands_...
bzr revid: xmo@openerp.com-20111011094551-vr27on7iibdd9tv6
2011-10-11 11:45:51 +02:00
Xavier Morel 8507ceddcf [IMP] make resolve_o2m_commands_to_record_dicts's result eager as per vmt's suggestion
bzr revid: xmo@openerp.com-20111011085715-cvcficcy4di9q29i
2011-10-11 10:57:15 +02:00
Xavier Morel 2646a34cf0 [ADD] don't blow up on a singleton DELETE_ALL command (that command takes no parameters, so can have just (5,))
bzr revid: xmo@openerp.com-20111011084852-hborz317ru5pbzux
2011-10-11 10:48:52 +02:00
Xavier Morel 8734ffb6c2 [IMP] raise assertion error if an o2m command is not one of CREATE, UPDATE or LINK_TO
bzr revid: xmo@openerp.com-20111011083824-4g0ros6f3xgslkq4
2011-10-11 10:38:24 +02:00
Xavier Morel 4d0a189796 [IMP] handle case where o2m commands are pairs instead of triplets
bzr revid: xmo@openerp.com-20111011081202-y1ou74u038o2kl58
2011-10-11 10:12:02 +02:00
Xavier Morel b5ee13a845 [IMP] rename serialize_o2m_commands to resolve_o2m_commands_to_record_dicts
bzr revid: xmo@openerp.com-20111011080338-hup42vivlvk4dly0
2011-10-11 10:03:38 +02:00
Xavier Morel d5accc0fae [ADD] method to correctly serialize o2m commands into a sequence of record-dicts for e.g. onchanges
also alters res.partner.bank _default_value to use it with res.partner addresses, and adds a few tests to ensure behavior is correct

bzr revid: xmo@openerp.com-20111010135157-dafgcwwcni5gkeom
2011-10-10 15:51:57 +02:00
Olivier Dony d86c283434 [FIX] orm.browse_record: avoid printing unrelated traceback upon KeyError
bzr revid: odo@openerp.com-20111007144944-j4obwcbvx9awkj30
2011-10-07 16:49:44 +02:00
Xavier Morel 65456808bc [ADD] wrapper to the modifiers setup process to simplify its call by third parties
bzr revid: xmo@openerp.com-20111006142727-spfj8foiln6m2jb9
2011-10-06 16:27:27 +02:00
Vo Minh Thu 9990d8126e [IMP] orm: added small comment.
bzr revid: vmt@openerp.com-20111006114444-4llzirnl4tg4p5qy
2011-10-06 13:44:44 +02:00
Vo Minh Thu 4dc26443d1 [MERGE] orm: cleand get_pg_type(). Changes as written in the merge prop.:
* Extracted creation of VARCHAR pg_type into a separate function, make missing 
  size (or size 0) create an unlimited VARCHAR field (effectively limited by
  postgres to 1GB data)
* Extracted fields to pg_types mapping outside of get_pg_type
* Made fields.function recursively forward to get_pg_type (via a type overload) 
  instead of reimplementing half get_pg_type in itself
* Simplified some get_pg_type cases

Note: if this is merged, it might be nice to convert fields.selection to use an 
API similar to fields.function: default to VARCHAR storage, if there's a type
attribute override use that type. Currently, fields.selection is handled the
following way:

* If the selection is a list and the type of the first half of the first item 
  is an integer, use type int4
* If the field has a __size=-1__ attribute, use type int4
* Else use type varchar (with size specified on the field, if any)

One change from previous version is that if type of the first half of the first 
item of the selection was str or unicode, it tried to find the longest string
and used that as the field's size. This meant silent loss of data if new,
longer items were added to the selection without recreating the whole db (or at
least manually altering the relevant fields). It also used the field's size or
*16* as a minimum default, for some reason, and if there was no size specified
on the selection (or size=0) it just hardcoded the size to 16.

bzr revid: vmt@openerp.com-20111006081336-uka6srvdmvs0s4lm
2011-10-06 10:13:36 +02:00
Xavier Morel 5eeeb67e6d [IMP] raise error when iterating over browse_record
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
2011-10-05 13:24:44 +02:00
Vo Minh Thu cab4e9c4a5 [FIX] orm: allow negative varchar size (meaning no limit) as used in some addons.
bzr revid: vmt@openerp.com-20111005101401-7jweikyl9ztibe4q
2011-10-05 12:14:01 +02:00
Olivier Dony d13fb7fe7e [MERGE] various bugfixes/improvements (coming from EDI development)
- _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
2011-10-05 12:09:54 +02:00
Vo Minh Thu 6067cd3609 [MERGE] merged trunk.
bzr revid: vmt@openerp.com-20111005080049-mv0ml30tti01cvba
2011-10-05 10:00:49 +02:00
Olivier Dony 982b2a0894 [FIX] orm: typo in computation of Model._original_module
bzr revid: odo@openerp.com-20111004225439-xnb77gtbl77onysm
2011-10-05 00:54:39 +02:00
Olivier Dony bfdbbb51cb [FIX] orm.export_data: 'module' column is required when creating external IDs
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
2011-10-04 22:51:40 +02:00
Olivier Dony edf68f510c [REM] orm: annoying INFO log lines
bzr revid: odo@openerp.com-20111004204800-f4470vy0ou3ugxnm
2011-10-04 22:48:00 +02:00
Olivier Dony 51b1201daa [IMP] orm: remember Model._original_module when constructing inheritance
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
2011-10-04 22:47:05 +02:00
Vo Minh Thu 68a0858c9c [FIX] orm: a typo made all models treated as if they were transient in check_access_rule().
bzr revid: vmt@openerp.com-20111004143335-7etc6y2kje1y20ef
2011-10-04 16:33:35 +02:00
Vo Minh Thu 8dc80c7c7c [MERGE] orm: use directly lxml.etree to generate default views.
bzr revid: vmt@openerp.com-20111004092828-79hhaiwgw4dltimd
2011-10-04 11:28:28 +02:00
Vo Minh Thu 9e082fad89 [MERGE] merged trunk.
bzr revid: vmt@openerp.com-20111003145135-5ysm8hpp83wey437
2011-10-03 16:51:35 +02:00
Vo Minh Thu 7b90c7e5de [MERGE] merged trunk.
bzr revid: vmt@openerp.com-20111003144503-lx28ennrz0mt590g
2011-10-03 16:45:03 +02:00
Olivier Dony 288e8ebcfc [IMP] browse_record._table -> browse_record._model
bzr revid: odo@openerp.com-20111003144049-d6o4igae8mslns5x
2011-10-03 16:40:49 +02:00
Olivier Dony 0489f83a44 [IMP] orm: rename/cleanup: get_xml_id* -> get_external_id*
bzr revid: odo@openerp.com-20110930222355-jtuo4z9dz995emxk
2011-10-01 00:23:55 +02:00
Olivier Dony babb7aa0ec [FIX] fields: m2m SQL names may be dynamic now, care for it in field_to_dict()
Also cleaned up field_to_dict signature and callers to
honor conventions.

lp bug: https://launchpad.net/bugs/863019 fixed

bzr revid: odo@openerp.com-20110930112348-4c8undh1d6h1y3ps
2011-09-30 13:23:48 +02:00
Xavier Morel 3cee85eaba [FIX] typo syntax error
bzr revid: xmo@openerp.com-20110929132822-3qbbl1qttnvfhl40
2011-09-29 15:28:22 +02:00
Xavier Morel 0618731f6b [MERGE] trunk
bzr revid: xmo@openerp.com-20110929132454-oweaht1oel4st1m8
2011-09-29 15:24:54 +02:00
Xavier Morel 22b1bb8abb [FIX] do not remove 'multi=True' actions in fields_view_get for tree view
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
2011-09-29 15:07:01 +02:00
Vo Minh Thu 27f9a9676f [FIX] exceptions: except_osv in already a synonym for o.e.Warning, except_orm should not be qualified.
bzr revid: vmt@openerp.com-20110929073124-kxwwatr8l697ng8r
2011-09-29 09:31:24 +02:00
Vo Minh Thu ebd8ca5df5 [IMP] orm: expose ir.model.access check shortcuts.
bzr revid: vmt@openerp.com-20110928130107-5y5di6nx0al3q8mh
2011-09-28 15:01:07 +02:00
Olivier Dony 762637518b [MERGE] osv_memory removed, merged into database-backed Model/TransientModel
bzr revid: odo@openerp.com-20110927213712-9aa0x0aqoh13f6ga
2011-09-27 23:37:12 +02:00
Olivier Dony 209390d627 [MERGE] sync with latest trunk
bzr revid: odo@openerp.com-20110927165133-uwl7px6bxl6eu7us
2011-09-27 18:51:33 +02:00
Fabien Pinckaers ae0649df5f merge
bzr revid: fp@tinyerp.com-20110927140526-ld9eost69hspy69i
2011-09-27 16:05:26 +02:00
Fabien Pinckaers c3afdca2ab [IMP] generate XML id when exporting an ID that does not exists
bzr revid: fp@tinyerp.com-20110927140450-2b78h9dsb1fh7t11
2011-09-27 16:04:50 +02:00
Naresh (OpenERP) 7101204a22 [FIX/IMP]:stored function override were not removed
lp bug: https://launchpad.net/bugs/789576 fixed

bzr revid: nch@tinyerp.com-20110927105821-3rmydltdyv4gv830
2011-09-27 16:28:21 +05:30
Olivier Dony ad4a216e7d [IMP] fields.m2m: support implicit generation of m2m SQL names
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
2011-09-26 19:14:51 +02:00
Olivier Dony f81fe2dc6e [IMP] orm: enforce proper m2o ondelete rules between TransientModels and Models
bzr revid: odo@openerp.com-20110926111226-fu834vqwm4gbxk8l
2011-09-26 13:12:26 +02:00
Olivier Dony 6462c85f6c [IMP] start unifying the SUPERUSER_ID constant
bzr revid: odo@openerp.com-20110926090156-2smbh0ypzitauhmt
2011-09-26 11:01:56 +02:00
Xavier Morel 0de487e029 [IMP] doc for import_data
bzr revid: xmo@openerp.com-20110926075115-bsdyjzk5nhp0cbnh
2011-09-26 09:51:15 +02:00
Olivier Dony 1bf74fa77e [MERGE] no-op merge of trunk, discarding osv-memory fix, obsolete already
bzr revid: odo@openerp.com-20110924022846-p08bawfxh5lym37u
bzr revid: odo@openerp.com-20110924025346-1khpike23e2honll
2011-09-24 04:53:46 +02:00
Olivier Dony dfccbaf28b [FIX] orm,expression: special-case previous commit for osv_memory
This will soon be obsolete and deleted, as soon
as osv_memory will be removed and merged inside
normal osv.

bzr revid: odo@openerp.com-20110924024928-awgncvhcyfkmnak5
2011-09-24 04:49:28 +02:00
Olivier Dony 67dcd97ea6 [FIX] orm,expression: sanity checks for domain terms, cleanup, tests
bzr revid: odo@openerp.com-20110924020303-2amkx95ij1yp8ofk
2011-09-24 04:03:03 +02:00