[7.0] [add] fields validator - #84
Conversation
|
Hi, @eLBati, thanks for the module. I think a better name for it is base_field_validator Entering in the functionality, I feel that this kind of things must be done client-side (in JS widgets), not server-side. In this direction, there is this PR OCA/web#34 and collides in functionality with this one. We should decide in which direction go. |
|
Hi @pedrobaeza thanks for pointing it out (I don't follow https://github.com/OCA/web enough 😔) |
|
Not sure if |
|
Just to notify that this needs review (can't edit labels) |
|
Don't you think it's better to add (or check) regex support on the other PR. This is to follow with my thought about having this kind of checks client-side. |
|
@pedrobaeza IMO, the client side would stay without business logic... (and field validation is part of the business logic). If I understand well the PR OCA/web#34, the validation doesn't prevent to save the value. In this PR, the validation is enforced even on the server side. I've the feeling that this PR covers another UC. What do you think? |
|
I think this is not business logic, but basic validations. Check for example HTML forms: this kind of validations (mandatory fields, numeric values, etc) are made always client side. |
|
I think exactly as @lmignon It is a good feature, if you go throught a customized clients over web-servides the OCA/web#34 will be jumped. +1 to have it in both sides (we need both). Client side: To avoid the POST that consume time and make a uncommit of the changes. Server side: To be consistent thoruhgt web-services. On my side a total +1 "Conceptually Speaking" to this PR. |
|
For sure the validation on the client will leverage the User experience and avoid unnecessary calls to the server. But it's the responsibility of the server to enforce the data consistency whatever they are modified (by a request from the browser or from web-services or even internal calls). Conceptually the concept of validator sounds good. One step further would be to leverage the fields_view_get from BaseModel to add the validator definition in the field description send to the JS client and implement the validation also on the client side.... (I've a dream...) |
|
Yeah, we'll have to put it as wishlist. @eLBati, please consider following remarks then and I'll approve it:
|
68461c9 to
eac591c
Compare
|
Thanks for the reviews |
|
👍 Thanks |
|
commits from hurrinico are not well defined, it is certainly missing email in author Can you amend them? |
b82707e to
5af4e1a
Compare
|
On 2 June 2015 at 17:33, Yannick Vaucher notifications@github.com wrote:
|
5af4e1a to
a609400
Compare
|
👍 |
|
I think this can be merged |
There was a problem hiding this comment.
I think you should return whatever old_write returns
93e8736 to
fa3f23b
Compare
|
@hbrunn thanks, I made the proposed changes. |
fa3f23b to
68d6179
Compare
|
Ok, my bad. Now travis is green 💚 |
|
@OCA/tools-maintainers please set this 'needs review' |
|
As on the 8.0 PR, better not to change the signature of _register_hook |
|
Can we merge this PR? |
|
👍 |
[ADD] company_country: module to install country from .travis.yml
* FIX format parameter To be able to print files in raw format it's needed to set this parameter. Previous code was not able to print raw files, but it didn't get error because 'format' used on line 107 is assumed as a format funtion, because format parameter was not on this scope. * FIX pep8
Syncing from upstream OCA/server-tools (10.0)
This module allows to set a regular expresion as field validator.
When the regular expresion is set, write and create operations on the involved
field are blocked, if the regular expression is not satisfied.
See demo and test data for an example with partner email.