You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
989 B

5 years ago
  1. odoo.define('galicea_toolset.client_actions', function(require) {
  2. var Widget = require('web.Widget');
  3. var core = require('web.core');
  4. var common = require('web.form_common');
  5. var ActionManager = require('web.ActionManager');
  6. var OpenEditDialogAction = Widget.extend({
  7. init: function(parent, context) {
  8. this._super.apply(this, arguments);
  9. this.context = context;
  10. if (parent instanceof ActionManager) {
  11. this.am = parent;
  12. }
  13. },
  14. start: function () {
  15. var params = this.context.params;
  16. var popup = new common.FormViewDialog(self, {
  17. title: params.title,
  18. res_model: params.res_model,
  19. res_id: params.res_id,
  20. }).open();
  21. popup.on('closed', this, function() {
  22. this.am && this.am.history_back();
  23. });
  24. },
  25. });
  26. core.action_registry.add(
  27. 'galicea_toolset.open_edit_dialog',
  28. OpenEditDialogAction
  29. );
  30. return {
  31. open_edit_dialog_action: OpenEditDialogAction,
  32. };
  33. });