-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[MIG] Migration from 9.0 to 10.0 web_access_rule_buttons #628
Conversation
It would be interesting to rename to singular as stated in the OCA guidelines. |
@pedrobaeza Not sure in this case, as it does not refer to a data model but to the standard edit/create/delete buttons in the interface. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's Ok; but there is a variable unused.
var core = require("web.core"); | ||
|
||
var FormView = require("web.FormView"); | ||
var ListView = require("web.ListView"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line could be removed
var ListView = require("web.ListView"); | ||
FormView.include({ | ||
|
||
load_record() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry friend, we can't allow this syntax until it is supported by PhantomJS, or all JS tests would potentially break. You have to use the old, ugly and safe load_record: function () {...
syntax.
load_record() { | ||
var self = this; | ||
return this._super.apply(this, arguments).then(function() { | ||
self.show_hide_buttons() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feels better IMHO to proxy the function like this._super.apply(this, arguments).then($.proxy(this.show_hide_buttons, this))
show_hide_buttons() { | ||
var self = this; | ||
this.dataset.call("check_access_rule_all", [ [ this.datarecord.id ], [ "write" ] ]).then(function(accesses) { | ||
console.log(accesses) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMHO this deserves a console.debug
instead. Please add semicolon.
if (this.$buttons) { | ||
var button = this.$buttons.find(".o_form_button_edit"); | ||
if (button) { | ||
button.prop("disabled", !access); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
4 spaces, no tabs.
@yajo Changes implemented |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change Ok.
Funtional Ok.
I would like to have this renamed to singular, but too late... Maybe on v10? |
Ouch, I see that this is v10. Uf, too bad. Can you maybe make a PR renaming it? |
* [MIG] Migration from 9.0 to 10.0 * Refactoring javascript code
* [MIG] Migration from 9.0 to 10.0 * Refactoring javascript code
* [MIG] Migration from 9.0 to 10.0 * Refactoring javascript code
No description provided.