Commit Graph

170 Commits

Author SHA1 Message Date
Denis Ledoux 4e0530f16c [FIX]web: test testing the customer filter save was wrong, was using wrong method text() instead of val() to set the filter name
bzr revid: dle@openerp.com-20131022165318-2imkhgb6iecalbbi
2013-10-22 18:53:18 +02:00
Xavier Morel 11a0ece543 [FIX] evaluation context structures not being round-tripped through eval
JS objects are converted to py.object when passed in through the
evaluation context. py.object are not serializable by default (because
that doesn't really make sense), which breaks when the input is
intended as a dict and returned (e.g. o2m values, which are triples of
(int, int?, dict?)).

Intuitively, JS objects passed as part of the context should be mostly
JSON-ish and thus dicts, but that turns out not work work as some
addons use attribute accesses within contexts (e.g. parent.access in
account/account_invoice_view.xml)

=> Temporarily solve by converting raw js objects to an "attributed
dict" which acts as both a dict and an object and can be converted to
JSON.

Ideally, py.js should provide for a pluggable conversion, or should
use an attributed mapping internally. See issues 21 and 23.

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

bzr revid: xmo@openerp.com-20130624055929-3rtkgqrp4o87pvau
2013-06-24 07:59:29 +02:00
Olivier Dony dc24794855 [FIX] web: support integer/float fields in search view via auto-completion + tests
integer/float fields were not offering auto-completion in search views,
making them unsearchable except via advanced search.
This patch adds the missing complete() function and removes the incorrect
value_from() function that did not conform to the 7.0 search view API.
It seemed to be a leftover of the 6.1 search field implementation
of get_value(), wrongly renamed for 7.0.

Also includes corresponding tests.

bzr revid: odo@openerp.com-20130418112001-388op1t8ugr0rhfn
2013-04-18 13:20:01 +02:00
Xavier Morel a455d6c2b2 [FIX] correctly handle group_by_no_leaf when no grouping applied
If there are no grouping field specified *but* group_by_no_leaf is
specified, should call read_group with no grouping fields: will
generate a single group (which can not be opened) for all of the
model.

Necessary for analysis views since individual "records" make no sense.

bzr revid: xmo@openerp.com-20130416092344-2pqog8f7xprn6hsh
2013-04-16 11:23:44 +02:00
Olivier Dony 35d61bbd8b [FIX] web search: correct previous fix to properly handle searching for 0 on number fields
Also removed useless HTML escaping and added basic tests.

bzr revid: odo@openerp.com-20130328153502-v71q2m60wh37ganq
2013-03-28 16:35:02 +01:00
Xavier Morel 3c5d38918b [FIX] filter preceded by an invisible filter in the same group
On click on a filter in the drawer, FilterGroup would just match the
offset of the filter in the group's DOM with an index in the internal
#filters array. 

This worked until invisible fields, and then again only for filters
*preceded* by an invisible sibling in the same group: invisible
filters are not rendered in the DOM, so the indexes would get out of
sync.

Fix by using explicit indexes stored in a filter's @data-index and
using that to get the filter object/node.

An alternative fix (but hackier I think): instead of not rendering
invisible filters, render them with display: none. Remains an option
in the future if needed...

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

bzr revid: xmo@openerp.com-20130321155123-211iht7c6zme712e
2013-03-21 16:51:23 +01:00
Xavier Morel 3b2e26af18 [FIX] incorrect array joins
Array#join() is equivalent to Array.join(', '), not Array.join('') as in Python.

For some reason the tests didn't break, but...

bzr revid: xmo@openerp.com-20130321155105-dwgprqldk39r3xk2
2013-03-21 16:51:05 +01:00
Xavier Morel ac5008abc9 [FIX] pyeval: argspec of relativedelta
bzr revid: xmo@openerp.com-20130318105244-qkgvi69do0219lkk
2013-03-18 11:52:44 +01:00
Xavier Morel 1899141b38 [FIX] groupby groups fetching of their ancestor searchview
Implementation of invisibles in search view altered handling of search
inputs: their parent may not be the searchview anymore (usually is a
instance.web.search.Group). GroupbyGroup assumed parent was view and
was actually unused until
xmo@openerp.com-20130307124222-1ypzfopbktxmad4z, which exposed the
incorrect underlying assumption.

Make GroupbyGroup access its view when it wants its view, not its
parent.

bzr revid: xmo@openerp.com-20130312092824-z7sh4h3ityo4g00v
2013-03-12 10:28:24 +01:00
Xavier Morel 65e7ad2aa4 [FIX] oops, previous revision now mandates valid contexts in filter group tests
bzr revid: xmo@openerp.com-20130307141102-86tb7axyh3x4rgk9
2013-03-07 15:11:02 +01:00
Xavier Morel b921444d6f [FIX] implement forgotten @invisible handling on search view fields
bzr revid: xmo@openerp.com-20130304152047-8xaczg9qdx6ug2p1
2013-03-04 16:20:47 +01:00
Xavier Morel d46c61d784 [FIX] don't store user context properties into custom filter @context
This leads to any subsequent view overwriting the current user's lang
or timezone with the one active when the filter was created,
generating dismay and discontent (e.g. part of the user interface
switching from spanish to english or english to german, depending on
the respective settings of the current user and the filter creator —
at time of filter creation).

bzr revid: xmo@openerp.com-20130304101414-mm6ai1dkltd7ard5
2013-03-04 11:14:14 +01:00
Xavier Morel 6803c0048f [IMP] add view's context to m2o completion name_search
bzr revid: xmo@openerp.com-20130225165236-386r8438h4vz6fav
2013-02-25 17:52:36 +01:00
Xavier Morel ece114024f [ADD] @domains handling to searchview m2o field during completion
bzr revid: xmo@openerp.com-20130225164255-y3qkcjozr7rbtz1v
2013-02-25 17:42:55 +01:00
Xavier Morel 9f45e8970c [ADD] more tests for m2o default values handling
bzr revid: xmo@openerp.com-20130225152324-785ewucir0pv4rmw
2013-02-25 16:23:24 +01:00
Xavier Morel 9852c6ff1e [FIX] missing support for invisible fields and groups in new search view
lp bug: https://launchpad.net/bugs/1122183 fixed

bzr revid: xmo@openerp.com-20130214074302-rwm2hcmv9mpvp9dv
2013-02-14 08:43:02 +01:00
Xavier Morel dfb7493034 [FIX] add support for invisibility to fields (don't complete an invisible field)
bzr revid: xmo@openerp.com-20130213090108-h38emnwscgb5v1pu
2013-02-13 10:01:08 +01:00
Xavier Morel f690a9310c [IMP] prefix searchview tests for easy filtering
bzr revid: xmo@openerp.com-20130213072557-er5xl9xcj17mhuqe
2013-02-13 08:25:57 +01:00
Xavier Morel 69171aa805 [CHG] allow deselecting a custom filter by clicking on it again in the drawer
as asked in project.task:4837:

> Cannot uncheck a custom filter by clicking on it (it's possible on
> classic filters)

bzr revid: xmo@openerp.com-20130131112617-8vul65bb4lbfbfvk
2013-01-31 12:26:17 +01:00
Anand Patel (OpenERP) be9f4b43b7 [IMP] Added some test cases for the float_time
bzr revid: pan@tinyerp.com-20130123093155-v9rrnb38hxugv1bt
2013-01-23 15:01:55 +05:30
vta vta@openerp.com 56e97a98bb [FIX] Fixed issue with testing context in eval.js, due to a previous change in get_session_info (context -> user_context)
bzr revid: vta@openerp.com-20130111094314-odrm9enzrmcrtcu6
2013-01-11 10:43:14 +01:00
Raphael Collet 43ca577f99 [FIX] js tests: add an abstraction over instance to create properly an assertion function
bzr revid: rco@openerp.com-20121210154309-mubr65ildpiw2wpx
2012-12-10 16:43:09 +01:00
Raphael Collet 38994104f0 [IMP] js tests: when testing pyeval on datetimes, avoid comparison with an indepent call to new Date()
bzr revid: rco@openerp.com-20121210151828-lfzyfy75oldkjxk5
2012-12-10 16:18:28 +01:00
Fabien Meghazi bf6bdf017b [IMP] Changed tests according to new client side fields view get
bzr revid: fme@openerp.com-20121205160656-0mg1hnv35vk27adh
2012-12-05 17:06:56 +01:00
niv-openerp 053d6af231 [FIX] forgot to modify test after API change
bzr revid: nicolas.vanhoren@openerp.com-20121130140335-k1nus3oz1xw6deeu
2012-11-30 15:03:35 +01:00
niv-openerp f9b9e7c4cb [IMP] added context_today()
bzr revid: nicolas.vanhoren@openerp.com-20121129160746-c3c691zk5fxhzse0
2012-11-29 17:07:46 +01:00
niv-openerp cc6f0aa20a [FIX] potential problem with pyeval datetime/date today()/now() methods. Now only returns the same timezone than server (UTC).
bzr revid: nicolas.vanhoren@openerp.com-20121129153601-vtpnvkc0vylo9hux
2012-11-29 16:36:01 +01:00
Xavier Morel fe3d493cc8 [FIX] searches with filters using "empty" domain/context values (but not attributes)
e.g. @domain="[]" would be seen as non-empty by the search view, and
if multiple domains the search view would generate a nonliteral
``['|', '[]', '[]]`` which would just yield ``['|']`` after evaluation
and concatenation, which is an invalid domain and would blow up the
server.

Specifically filter out the values ``[]`` and ``{}`` from filters

bzr revid: xmo@openerp.com-20121129112413-yrgncnesqs093jwf
2012-11-29 12:24:13 +01:00
Xavier Morel a2b23a1ca7 [REM] merge conflict file committed
bzr revid: xmo@openerp.com-20121129112350-egvxrg8ii71wzdx6
2012-11-29 12:23:50 +01:00
Xavier Morel c7772fdd82 [FIX] server-sourced fields_get has no indirection to the model's fields
previous searchview-controller wrapper method did. Remove leftover indirection deref

bzr revid: xmo@openerp.com-20121129103841-6qcl4sctekqmrt2q
2012-11-29 11:38:41 +01:00
Xavier Morel 720f3faf93 [IMP] stop using custom /web/searchview endpoints in search view
bzr revid: xmo@openerp.com-20121126093818-omxaj3qljolgq8qj
2012-11-26 10:38:18 +01:00
Xavier Morel aab69ae7a9 [TEST] for crazy
bzr revid: xmo@openerp.com-20121126084159-lbgfa56vafg4bxc4
2012-11-26 09:41:59 +01:00
Xavier Morel 2c7f30a047 [REM] session reload dependency on db
bzr revid: xmo@openerp.com-20121123120500-k7fhwoocu0zbiali
2012-11-23 13:05:00 +01:00
Xavier Morel 6b2b2d889c [IMP] move nonliteral domains and contexts to JS test case
bzr revid: xmo@openerp.com-20121123114923-t4047w6jztria91x
2012-11-23 12:49:23 +01:00
Xavier Morel 709f2506ff [REM] server-side eval_domain_and_context
bzr revid: xmo@openerp.com-20121123113932-siz0u2vp2u7z6wk2
2012-11-23 12:39:32 +01:00
Xavier Morel 242a5da5a9 [REM] stray logging
bzr revid: xmo@openerp.com-20121123095824-xg6afc1l01t3y48y
2012-11-23 10:58:24 +01:00
Xavier Morel 328537a7ba [ADD] arithmetics between date and timedelta
bzr revid: xmo@openerp.com-20121123095206-dtvoiignb7xnzsl0
2012-11-23 10:52:06 +01:00
Xavier Morel 815b908759 [ADD] partial but sufficient (I think) implementation of datetime.timedelta
bzr revid: xmo@openerp.com-20121123075938-oazwt4bn2l639r3a
2012-11-23 08:59:38 +01:00
Xavier Morel 3909d1ff02 [ADD] a bunch of eval domain and context tests
bzr revid: xmo@openerp.com-20121122111628-4khivcp97xoy121i
2012-11-22 12:16:28 +01:00
Xavier Morel 5a9f78302f [MERGE] from trunk
when creating the instance, set instance.session.uid to 42 so the evaluator has something to chew on when it tries to create the evaluation context

bzr revid: xmo@openerp.com-20121120101733-b0ire11bbuywfi8u
2012-11-20 11:17:33 +01:00
niv-openerp 40c4ed7f54 [FIX] problem in editable list o2m when hitting the enter button rapidly
bzr revid: nicolas.vanhoren@openerp.com-20121116151248-il59eiekk758suco
2012-11-16 16:12:48 +01:00
Xavier Morel 1e2e0c5cb1 [FIX] test cases
* mock(:) callback receives a pair (args, kwargs) not raw params
* list buttons test triggers domain evaluation, which depends on form (why???)

bzr revid: xmo@openerp.com-20121116115544-cdowx66w3m8inqon
2012-11-16 12:55:44 +01:00
Xavier Morel e1e4c48c18 [REM] test runner feature which probably caused more trouble than it caught
avoid catching exception in executed callback, it just hinders debugging by generated completely bonkers traces

bzr revid: xmo@openerp.com-20121116105554-hu45anetrj1a8tl6
2012-11-16 11:55:54 +01:00
Xavier Morel 796e80ec2d [FIX] deferred.pipe -> deferred.then
bzr revid: xmo@openerp.com-20121116101417-mkcjrdtocl6w7408
2012-11-16 11:14:17 +01:00
Xavier Morel 0d85c24ae3 [MERGE] from trunk, fix/adapt some tests
bzr revid: xmo@openerp.com-20121116100840-yyr9b4oru3zdftld
2012-11-16 11:08:40 +01:00
Xavier Morel 90f1015dee [FIX] list button test: no call_button result now triggers an act_window_close
bzr revid: xmo@openerp.com-20121116094355-bsbxb0ufpjqx5j50
2012-11-16 10:43:55 +01:00
Xavier Morel a9645151b6 [IMP] setup & teardown of test runner
simplify code and make setup & teardown processes more reliable

add testing.Stack tools which stacks promise-returning functions
around the actual promise-returning function to execute (the test case
itself).

testing.Stack returns an object with 3 methods, ``push([setup][,
teardown])``, ``unshift([setup][, teardown])`` and ``execute(fn,
*args)``. ``push`` and ``unshift`` create a new stack with the
provided setup and teardown added respectively at the top and bottom
of the stack.

``execute`` will walk the stack from bottom to top executing ``setup``
handlers (and waiting on their result), if all setup handlers execute
without failure the ``fn`` callback gets executed (and waited on) then
*all* ``teardown`` handlers are executed from top to bottom:

 |  setup
 |    setup
 |      setup
 |        setup
 |          fn
 |        teardown
 |      teardown
 |    teardown
 V  teardown

If a ``setup`` handler fails (the promise is rejected), teardowns will
start executing *from the previous level* (so the ``teardown``
matching the failed ``setup`` will *not* be run), but all
``teardowns`` below that will be run regardless, even if one fails the
next one will still be executed.

The stack will either ultimately return a promise rejection using the
*first* rejection it got (a rejection may be cascading, so the
rejection of a setup may also lead to or be linked to a teardown being
rejected later), or will return the resolution from ``fn``.

If ``execute`` is passed further arguments, those arguments will in
turn be forwarded to ``fn`` as well as all ``setup`` and ``teardown``
handlers.

bzr revid: xmo@openerp.com-20121116071712-zuld957icellezum
2012-11-16 08:17:12 +01:00
Xavier Morel 22edf6193d [FIX] listview display when action button deletes the corresponding record
if a record has disappeared between activating a button and refreshing
the record, remove it from the list view

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

bzr revid: xmo@openerp.com-20121113104407-n924vinluqfdtesf
2012-11-13 11:44:07 +01:00
Xavier Morel 06bcfd27fc [FIX] editable listview @on_write handling in case of @colors
the onwrite handler created an "empty" record with no field value
whatsoever, which'd blow up in the py evaluator. As during creation
(edition of a record where all fields are empty) create a record where
all fields are set to ``false`` so rendering works correctly, and wait
for content refresh to get correct data.

Also added a test for @on_write

bzr revid: xmo@openerp.com-20121112150526-vrr66ms95qbuoped
2012-11-12 16:05:26 +01:00
Fabien Meghazi e7007332d8 [FIX] Restore tests
bzr revid: fme@openerp.com-20121107131212-dk2i6kzvkp4jwrb3
2012-11-07 14:12:12 +01:00