-
-
Notifications
You must be signed in to change notification settings - Fork 529
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
[13.0][ADD] mass action #97
Conversation
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.
surely innovative!
Thanks @JayVora-SerpentCS for your review ! Note : Travis / runbot are red only because #94 is not merged. |
self.ensure_one() | ||
mass_action = self._get_mass_operation() | ||
localdict = {'self': items} | ||
safe_eval(mass_action.python_code, localdict, mode="exec", nocopy=True) |
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 started writing here to ask to do the same as server actions, but then I ask myself: Why isn't this module a frontend for creating server actions, possibly with their own type?
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 @hbrunn. Thanks for your review !
About ir.actions.server
that does the same thing as my module, the honest answer is : I just discovered servers actions I didn't know. ;-) So, I took a time to discover this "not so new model" ... and :
- Finally, the improvment this module makes is adding features present in the module
mass_operation_abstract
:
-> possibility to add domain, to avoid to execute server actions on non desired object. (for exemple, if the state is not valid) and warn the user.
-> possibility to add a group, so the menu will not be displayed for user that has not the right to do the action, simplifying UI.
Why isn't this module a frontend for creating server actions ?
Do you mean,
-> keep this module,
-> add a ir_actions_server_id on the model mass_action
-> so reuse all the safe eval algorithm, & co, and remove the safe_eval part in mass_action module ?
possibly with their own type
Not sure to understand that point. I guess, add a selection value on usage
field, named ('mass_operation', 'Mass Opération) ?
Thanks.
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.
Yes, keeping the module but using server actions internally, that's what I propose.
And the own type, what I meant was adding to the state selection, but that's nonsense I guess. We can just use normal server actions, just like cron does nowadays too: https://github.com/OCA/OCB/blob/13.0/odoo/addons/base/models/ir_cron.py#L52
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 @hbrunn. I tried to integrated an ir.actions.server
but I failed. I'm not really mastering delegate=True
and it generates errors (field name
required) and not very proud of the final design !
If I check the interest of this module :
-> possibility to add domain, to avoid to execute server actions on non desired object. (for exemple, if the state is not valid) and warn the user.
It is very easy to add it on an ir.actions.server with a filtered
command.
-> possibility to add a group, so the menu will not be displayed for user that has not the right to do the action, simplifying UI.
It seems that a group is also implemented on the ir.actions.server
.
so the only improvment I see is that the UI for mass.action
is a little better and simple that for ir.actions.server
but it doesn't deserve a new module.
What do you think ?
propose to close.
kind regards.
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.
maybe better, sorry about your work then.
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 problem. That's also why I share GRAP work to OCA : To hear people saying me "Hey guy ! You reinvented the wheel !"
thanks for your review.
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.
Hey guy ! Thanks anyways ! ;-)
ce7bcee
to
b80b15d
Compare
I propose a new module
mass_action
. It allows you to have a new button to execute python code on any items of any model.It can be useful in many cases, when the users has to make a recurring non covered operations. (confirm and deliver and invoice many quotations, ...)
It works similarly as the module
mass_editing
(same repository) and depends on the new modulemass_operation_abstract
.CC : @quentinDupont, @JayVora-SerpentCS
note : requires #94 to work.