-
-
Notifications
You must be signed in to change notification settings - Fork 587
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
[10.0][MIG] migrate module mail_forward #256
Conversation
562f9a9
to
4de116d
Compare
mail_forward/README.rst
Outdated
------------ | ||
|
||
* Emanuel Cino <ecino@compassion.ch> | ||
* Jairo Llopis <j.llopis@grupoesoc.es> |
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.
Please change the author to the new company: jairo.llopis@tecnativa.com
mail_forward/__manifest__.py
Outdated
"version": "10.0.1.0.0", | ||
"category": "Social Network", | ||
"website": "https://grupoesoc.es", | ||
"author": "Grupo ESOC Ingeniería de Servicios, " |
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 also the company to the new one: Tecnativa
903f39e
to
d6f188a
Compare
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.
Hi @ecino , thank!
I've tested and it work fine just one thing you should fix. After fordward the message, the chatter is not refreshed and user have to press F5... I think chatter should be refreshed in the same way that sending a new message happends
Let me know please
Thanks
@rafaelbn I added the functionnality in cac0a83. |
cac0a83
to
0818e3f
Compare
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.
Tested in runbot functionally 👍
mail_forward/__manifest__.py
Outdated
"summary": "Add option to forward messages", | ||
"version": "10.0.1.0.0", | ||
"category": "Social Network", | ||
"website": "https://grupoesoc.es", |
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.
@ecino please change this for the rightone as described in https://github.com/OCA/maintainer-tools/blob/master/template/module/__openerp__.py#L9
mail_forward/__manifest__.py
Outdated
"version": "10.0.1.0.0", | ||
"category": "Social Network", | ||
"website": "https://grupoesoc.es", | ||
"author": "Odoo Community Association (OCA)" |
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.
Don't change order please https://github.com/OCA/maintainer-tools/blob/master/template/module/__openerp__.py#L10
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.
Please @yajo as original author review this migration. Thanks!
mail_forward/README.rst
Outdated
Contributors | ||
------------ | ||
|
||
* Emanuel Cino <ecino@compassion.ch> |
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.
@ecino you should add you name after older contributors and not before
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.
Please @ecino check my comments. Thank you!
cf6ae00
to
4ff4dc1
Compare
@rafaelbn Thanks for reviewing it. Corrections are done. |
@api.one | ||
@api.multi | ||
def send_mail_action(self): | ||
return self.send_mail() |
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.
Remove this method.
} else if (subject.length < 2) { | ||
subject.push(_t("(No subject)")); | ||
} | ||
MessageModel.call('read', [message_id, read_fields], {context: session.user_context}).then(function (result) { |
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.
Please put this into a separate, proxied, class-level method.
Just for inheritance/maintainability. 😉
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.
Not sure what you mean by proxied method. I'm no javascript expert, I just ported the module to v10.
this.trigger("message_forward", message_id); | ||
}; | ||
}, | ||
thread_reload: function(){ |
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.
I'm not sure I like this new feature.
I did a test from the Odoo inbox forwarding to a different object... If you are forwarding to a different object, why to reload? It should never get displayed...
It moves me above in the message list if I was browsing somewhere below, and clears the messages. Well... it's a confusing behavior.
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.
@rafaelbn originally requested this feature. As I said, I'm no javascript expert so maybe I did not implement it the best way. Anyway I would need help to improve javascript.
I tested on runbot. I go to events, and try to forward one message to another event. Events model don't appear in the dropdown list. Is this intentional? |
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.
Tested on runbot and worked fine. Installed Sales and can forwarded messages between different SO successfully. However I don't see Even't models. Maybe it's been filtered somewhere. Can you check?
Hi @aheficent, sorry for the delay of my answer. You should add the Event model in the referenceable models (see the README of the module). You find the menu in Admin Settings -> Technical -> Database Structure -> Referenceable Models |
4ff4dc1
to
98c3539
Compare
Yikes! that was in the README! Bad me for not reading myself 😆 OK, then all you need to do is fix that ❌ in Travis. The JS improvements are needed, yes, but that can be done later. Thanks! |
Thank you for your reply @ecino I'm getting an error when forwarding messages between events. The trace:
|
Oops, that was after I removed the method as suggested by @yajo. It looks like the method is needed, so I will add it again. I will tell you when it's done. |
98c3539
to
f663bf2
Compare
The pull request is ready to go. Travis errors should be fixed with #288 |
Then please rebase to get those changes; right now bots are ❌ |
f663bf2
to
77e71a7
Compare
@yajo , successfully rebased, everything looks good. ✔️ |
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.
I tested on runbot:
-
In messages view, clicking on the ⭐ or ✔️ icons, has no effect
-
When forwarding message to a partner, an error appears:
Odoo Server Error Traceback (most recent call last): File "/.repo_requirements/odoo/odoo/http.py", line 642, in _handle_exception return super(JsonRequest, self)._handle_exception(exception) File "/.repo_requirements/odoo/odoo/http.py", line 684, in dispatch result = self._call_function(**self.params) File "/.repo_requirements/odoo/odoo/http.py", line 334, in _call_function return checked_call(self.db, *args, **kwargs) File "/.repo_requirements/odoo/odoo/service/model.py", line 101, in wrapper return f(dbname, *args, **kwargs) File "/.repo_requirements/odoo/odoo/http.py", line 327, in checked_call result = self.endpoint(*a, **kw) File "/.repo_requirements/odoo/odoo/http.py", line 942, in __call__ return self.method(*args, **kw) File "/.repo_requirements/odoo/odoo/http.py", line 507, in response_wrap response = f(*args, **kw) File "/home/odoo/odoo-10.0/addons/web/controllers/main.py", line 896, in call_button action = self._call_kw(model, method, args, {}) File "/home/odoo/odoo-10.0/addons/web/controllers/main.py", line 884, in _call_kw return call_kw(request.env[model], method, args, kwargs) File "/.repo_requirements/odoo/odoo/api.py", line 685, in call_kw method = getattr(type(model), name) AttributeError: type object 'mail_forward.compose_message' has no attribute 'send_mail_action'
Maybe I dropped something during the rebase, sorry about that. I'll check it and let you know when it's fixed. Thanks for double checking it. |
@yajo How do you access the runbot? I cannot find how to launch it, I just see the build logs. |
77e71a7
to
e584401
Compare
@yajo I fixed the forward bug (method send_action was not to be removed). However your other issues with the star and check icons seem not related with this module. I checked on the current runbot of the branch 10.0 and the same issue happens. |
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.
Tested again functionally 👍
Tested functionality |
@yajo please update your review |
|
||
@api.multi | ||
def send_mail_action(self): | ||
return self.send_mail() |
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.
Why to declare 2 methods to do the same? Am I missing something? 🤔 Otherwise, remove one of them please. 😉
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.
The way odoo mail_compose_message is done works the same, if we don't declare them it will fail. I tried to remove this one but then it fails.
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.
OK, I see now. However, you are repeating here the same code as upstream, so it still makes no sense that it fails... (You should only override a method if anything changes)
Besides, it breaks inheritance too. In case this were needed, it should be:
return super(MailComposeMessage, self).send_mail()
Could you double-check this please?
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.
I know it's weird but when I removed that send_mail_action
method, Travis was failing so I don't know why but this method is needed. If I do as you suggest, we will bypass our send_mail
method which is not good. The other solution I can do is to call super of send_mail_action
. I know the code seems weird to only call super method but if you want me I can remove it again and you will see by yourself that tests are failing without it.
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.
Oh snap, excuse me! It was right as it was. I didn't realize this was a _inherits
model, not an _inherit
one.
This kind of inheritance inherits fields, but not methods. Possibly calling super()
will not work, and the correct code is the one you had indeed.
Just please add a comment similar to upstream's, so reviewers can understand the reasoning behind that code.
Thanks, and sorry!
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.
No worries, I didn't know as well that _inherits
don't inherit the methods. Now it's clear why it's needed. I added the comment and restore the previous version. Thanks for your review.
2a8533e
to
cd66216
Compare
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.
Awesome, thanks!
cd66216
to
092a691
Compare
This takes the module mail_forward that was available in version 8.0 and updates it in order to work on version 10.0