summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/pyeval.js
AgeCommit message (Collapse)Author
2015-03-18[REF] web: add module system to the web clientGéry Debongnie
This commit introduces a new module system for the javascript code. Instead of using global (namespaced) variables everywhere (like openerp.web.whatever, ...), each file declare one (or more) module with its dependencies. Each module will be loaded after its dependencies, and will be given a reference to the return values. This change is a massive departure from the way the client worked previously. It will sadly break some/most history, but I am sure that the future git ecosystem will allow you to easily browse the history past this revision (one can dream). This commit feature: * main namespace is now odoo instead of openerp * a way to define modules and dependencies (inspired by requirejs) * many files have been splitted in simpler subfiles * basic support for debugging in odoo.__DEBUG__ * no global variable (i.e. nothing in window.openerp) * many bug fixes, many new bugs Future vision: this modularization should simplify future code development, simplify debugging and will allow a serious testing effort
2015-03-03[IMP] py.js relativedeltaXavier Morel
Rewrite relativedelta.__add__ based on dateutil 2.4.0 * completely remove any hint of supporting time deltas (could be implemented in the future, but not currently asked for and lots of code to implement) * implement weekday support (ordinal only) * probably better leapyear support * remove relativedelta.__sub__ (only works between relativedeltas) * add relativedelta.__neg__ fixes #5089
2015-01-19[IMP] pyeval: implement weekday functionGéry Debongnie
courtesy of mva. This adds the weekday function to date objects in pyeval. This will be useful for adding better filters (such as this week) in the searchview.
2014-12-02[ADD] pyeval: date.replace methodMario Arias Badila
Needed to create filters like "previous month" It was just defined for "datetime", but is also needed for "date" closes #2915
2014-09-15[FIX] web: fixes issues with custom filters and search viewGéry Debongnie
The problem was that when the user manipulates the graph view (in pivot table mode), the graph view resetted the group by facet in the search view. It was not a problem unless a custom filter with a groupby was already there, in which case, the group bys were duplicated. The search view is now smarter, it only resets the additional groupbys (and col_groupbys). Also, to prevent usability problems, the graph view disable the '+/-' groupbys added by a custom filters. Note that this fix is only temporary: a revamp of custom filters, facets, search view is coming in the next months. (at least, that's the idea). Right now, too much 'search logic' is in the graph view. Another note: this fix is somewhat fragile: it makes some assumptions about the search query (mainly that the custom filter is the first facet, also, that no other filters add groupbys/col_groupbys)
2014-01-28[MERGE] [ADD] ways to correctly handle local datetimes in e.g. domainsMartin Trigaux
* Alter datetime.now(), generate a local datetime (add utcnow() which generates a UTC datetime) * Implement datetime.replace() to manipulate local datetimes * Implement date.today(), generates a local date * Implement datetime.toJSON(), returns a javascript Date (assumes datetime attributes are local) * Add conversion hook in JSON and JSONP handlers, automatically converts a Date object to a UTC datetime formatted according to server formats Should allow the generation of correctly working (from the end-user's POV) [Today] filters, amongst other things. Eg: a local expression in a domain for 'Today 00:00:00' would now be expressed as 'datetime.datetime.now().replace(hour=0, minute=0, second=0)' (no .strftime) and will be converted to UTC when sent to the server bzr revid: mat@openerp.com-20140128133706-4yp610pp5w06tcia
2014-01-22[ADD] ways to correctly handle local datetimes in e.g. domainsXavier Morel
* change datetime.now() to generate user-local naive datetimes * add datetime.utcnow() behaving as the old now() * add date.today() generating a user-local date (for the current day) * add datetime.replace() to replace any specific attribute of the datetime object (except tzinfo, for now) * datetime.toJSON() now returns the equivalent javascript Date object (warning: uses the datetime attributes directly, since datetimes are naive if they were created with utcnow() the Date result is going to be complete nonsense). With the previous commit datetime.now() generates a user-local now() which is converted to the correct UTC datetime when sent to the server. This means it becomes possible to generate datetime bounds for the user's local today with either datetime.datetime.now().replace(hour=0, minute=0, second=0) or datetime.datetime.combine( datetime.date.today(), datetime.time()) and once send over JSON-RPC the server will get the local datetime in UTC to the server's format. nb: user-local means "in the timezone of the user's browser" in this context. bzr revid: xmo@openerp.com-20140122151911-akn1nr6e739eg92s
2013-11-13[FIX] fixes a problem in pyeval catching all exceptions silentlyGery Debongnie
bzr revid: ged@openerp.com-20131113102204-m0gox7odwgkmon4o
2013-08-06[IMP] Removed old JavaScript module loading system in the 'web' addons. ↵niv-openerp
Still has some retro-compatibility for other addons. bzr revid: nicolas.vanhoren@openerp.com-20130806125022-bzjbtn0nqk40ak4g
2013-07-25Added semicolonsniv-openerp
bzr revid: nicolas.vanhoren@openerp.com-20130725103301-65nld10p1if7k0zt
2013-07-25Added Gruntfile with jshint and corrected most js errorsniv-openerp
bzr revid: nicolas.vanhoren@openerp.com-20130725100749-0i82gf3k3nvt4r44
2013-07-02[FIX] pyeval: be more fault tolerant to avoid wrap null valuesMartin Trigaux
bzr revid: mat@openerp.com-20130702141600-4s7oan9yidjrlmcc
2013-06-24[FIX] evaluation context structures not being round-tripped through evalXavier Morel
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-03-19[FIX] small problem with m2o, does not uses context when opening them in ↵niv-openerp
read-only mode bzr revid: nicolas.vanhoren@openerp.com-20130319102719-0gdwvmix4d3x8th5
2013-03-18[FIX] pyeval: argspec of relativedeltaXavier Morel
bzr revid: xmo@openerp.com-20130318105244-qkgvi69do0219lkk
2013-01-28[FIX] Inject user context in all domain and context evaluationXavier Morel
Custom keys from user context may be used in action contexts (not just e.g. searchview filters). For instance, have a custom key context_salesteam (in the user model) and an action defining some search default as a function of the salesteam. In that case, the action's context evaluation (view.js:~275) will blow up. Ensure that does not happen. Note: eval_contexts already injects user_context in the reduction of contexts to evaluate. It should be possible to alter the reduction function to avoid having to inject instance.session.user_context through pyeval.context(), maybe by _.extend-ing ``result_context`` into ``evaluation_context`` at the *top* of the reduction function rather than at its bottom? bzr revid: xmo@openerp.com-20130128130640-ksyvxvx6rlc4820n
2012-11-30[FIX] styllistic fixesXavier Morel
bzr revid: xmo@openerp.com-20121130103638-8r77jpmb3hhmo8dt
2012-11-30[IMP] removed date.today() in pyevalniv-openerp
bzr revid: nicolas.vanhoren@openerp.com-20121130095228-mffq2407lq7tf8jj
2012-11-29[IMP] added context_today()niv-openerp
bzr revid: nicolas.vanhoren@openerp.com-20121129160746-c3c691zk5fxhzse0
2012-11-29[FIX] potential problem with pyeval datetime/date today()/now() methods. Now ↵niv-openerp
only returns the same timezone than server (UTC). bzr revid: nicolas.vanhoren@openerp.com-20121129153601-vtpnvkc0vylo9hux
2012-11-28[FIX] use py.js 0.7 APIXavier Morel
bzr revid: xmo@openerp.com-20121128110542-nplg9o3e5jpxmqic
2012-11-26[IMP] allow eval'ing a single context or domainXavier Morel
bzr revid: xmo@openerp.com-20121126084229-wgpjszmquhibbrpf
2012-11-23[IMP] move nonliteral domains and contexts to JS test caseXavier Morel
bzr revid: xmo@openerp.com-20121123114923-t4047w6jztria91x
2012-11-23[REM] server-side eval_domain_and_contextXavier Morel
bzr revid: xmo@openerp.com-20121123113932-siz0u2vp2u7z6wk2
2012-11-23[IMP] deferred init styleXavier Morel
bzr revid: xmo@openerp.com-20121123101822-inox7gkxvd0gtqbp
2012-11-23[ADD] todo notesXavier Morel
bzr revid: xmo@openerp.com-20121123101658-xoynynruwnuzyrv3
2012-11-23[REM] stray loggingXavier Morel
bzr revid: xmo@openerp.com-20121123095824-xg6afc1l01t3y48y
2012-11-23[ADD] arithmetics between date and timedeltaXavier Morel
bzr revid: xmo@openerp.com-20121123095206-dtvoiignb7xnzsl0
2012-11-23[ADD] partial but sufficient (I think) implementation of datetime.timedeltaXavier Morel
bzr revid: xmo@openerp.com-20121123075938-oazwt4bn2l639r3a
2012-11-22[FIX] put evaluation context in evaluation contextXavier Morel
so you can access the context while you're accessing the context bzr revid: xmo@openerp.com-20121122124130-t8j6sggtnl4f0b8r
2012-10-11[IMP] shortcut call to eval_domain_and_context to be evaluated on the JS ↵Xavier Morel
side, also add some offline-evaluation of contexts and domains in rpc call methods bzr revid: xmo@openerp.com-20121011100532-5ihje0maslp37zpf
2012-10-11[FIX] after discussions with odo, date/datetime/time for locally-evaluated ↵Xavier Morel
contexts and domains should be local, not UTC bzr revid: xmo@openerp.com-20121011075759-qfwkfws5tu9yidab
2012-10-10[FIX] add 'context' free variable in evaluation contexts for domains and ↵Xavier Morel
contexts bzr revid: xmo@openerp.com-20121010145945-16shdry3udum0mn1
2012-10-08[REM] timedelta, because painXavier Morel
bzr revid: xmo@openerp.com-20121008125523-ed1g42vjxbcfo62r
2012-10-08[FIX] update py.js to 0.6, port existin classes to it, attempt to implement ↵Xavier Morel
timedelta bzr revid: xmo@openerp.com-20121008120619-lhmexjnujjrigjn9
2012-10-05[ADD] groupby eval testsXavier Morel
bzr revid: xmo@openerp.com-20121005142808-yx6o8nfnn0o4ms56
2012-10-05[FIX] evaluator: connection -> sessionXavier Morel
bzr revid: xmo@openerp.com-20121005131205-ffk746ac5xrua62j
2012-08-06[IMP] move eval functions for domains, groupbys and contexts outside of ↵Xavier Morel
corelib, as well as the standard evaluation context building (and related objects) bzr revid: xmo@openerp.com-20120806094627-8c9lwtfkbfws2bmj