openerp-dev-web team mailing list archive
-
openerp-dev-web team
-
Mailing list archive
-
Message #06717
Re: [Merge] lp:~openerp-dev/openobject-server/6.0-bug-747746-xrg into lp:openobject-server/6.0
On Thursday 12 May 2011, you wrote:
> The code might prove useful in multiple places. Before merging and using
> it, we would need to make sure this is what we want. A few things to think
> about:
>
> - is there anything already doing something similar, either in python or as
> concrete syntax (to not reinvent the wheel)?
The only concrete function is in PHP. For python, there is a wrapper that
calls the PHP strtotime(), but I imagine that's not what we would ever use.
> - is it possible to directly write something like this in yaml
> date: today + 2 days
> or does it need a new !bang syntax or use of !python?
It is not possible, since the values of fields are passed as "scalar
expressions", which means the string is pushed as-is to the var. Thus, it is
cleaner and safer to use an explicit operator. I thought "!date" and
"!datetime" are easy to guess/use.
> - have a solid semantic regarding date/datetime conversions
> - things like
> in 2 days, 2 days ago, monday in 1 month, next monday,...
> ?
I have a stash for this enhancement. However, while trying to implement that,
I discovered that the English text (like ones you propose) is ambiguous in
several cases. I wanted a little more time + discussion with community, to
standardize that.
I'd be happy to show you these half-implemented extensions and have your
opinion on the ambiguity.
>Anyway, this is not much important. This is mostly a end-user experience
thing..
In some cases, it makes our life much easier. We have had a lot of yaml test
either failing or doing wrong computations because of hard-coded (or poor
relative) dates/times. Apart from that, if we could agree[1] on an
implementation (wrt. syntax of the expressions), we could extend their usage
in other fields. For example, we could allow them to appear in xml files, in
formulae (imagine the production scheduler to be able to be set "now +3days at
14:00") etc.
[1] I never claim this code is perfect, feel free to propose a better
solution.
--
https://code.launchpad.net/~openerp-dev/openobject-server/6.0-bug-747746-xrg/+merge/56001
Your team OpenERP R&D Team is subscribed to branch lp:~openerp-dev/openobject-server/6.0-bug-747746-xrg.
References