-
-
Notifications
You must be signed in to change notification settings - Fork 305
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
Add a button to generate the ir.values for a model #90
Conversation
On the "ZPL II Lables" form, there are buttons added "Add in the 'More' menu" and "Remove from the 'More' menu". This way a user can easily set a print function for his label.
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.
Thanks !
Don't worry about the diff being badly displayed by Github, we all know how to use git for that :)
I tested on runbot, it works, but the menu's name is always "Print Label", without the label name, which seems weird with several labels on the same model: we may want to add a menu item for each label, instead of duplicated items.
I think the best is to duplicate the action instead of simply linking it (and delete it when removing the menu item).This way, you can customize the new action's name (to include the label's name in the displayed menu item) and context (to select this label by default).
Also, a small unit test would be nice.
label.menu_ir_values_id.sudo().unlink() | ||
except Exception: | ||
raise exceptions.UserError( | ||
_('Deletion of the action record failed.') |
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.
Could you add the name of the label when it fails ?
It will help in case we try to remove the menu from several labels at once.
""" Remove the contextual actions created for this label. """ | ||
self.check_access_rights('write', raise_exception=True) | ||
for label in self: | ||
if label.menu_ir_values_id: |
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 merge the for
and if
statements using:
for label in self.filtered('menu_ir_values_id'):
Hello @sylvain-garancher, As i did it now, there is an inconsistency indeed. I propose these modifications:
That would fix my use case to be more consistent. What do you think ? |
This is also an option. I proposed to add label-specific action, you propose to add a label-generic action. |
There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days. |
On the "ZPL II Labels" form, there are buttons added "Add in the 'More' menu" and
"Remove from the 'More' menu".
This way a user can easily set a print function for his label.
To add the buttons, i had to add a tag on the form, indenting all form contents, hence the strange diff you see here on github.