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.

35 lines
1.2 KiB

  1. odoo.define('web.DuplicateVisibility',function (require) {
  2. "use strict";
  3. var core = require('web.core');
  4. var Sidebar = require('web.Sidebar');
  5. var FormView = require('web.FormView');
  6. var _t = core._t;
  7. var DuplicateVisibility = FormView.include({
  8. /**
  9. * Instantiate and render the sidebar if a sidebar is requested
  10. * Sets this.sidebar
  11. * @param {jQuery} [$node] a jQuery node where the sidebar should be inserted
  12. * $node may be undefined, in which case the FormView inserts the sidebar in a
  13. * div of its template
  14. **/
  15. render_sidebar: function($node) {
  16. var res = this._super.apply(this, arguments);
  17. if (this.sidebar) {
  18. if(!this.is_action_enabled('duplicate') &&
  19. this.sidebar.items.hasOwnProperty('other')){
  20. this.sidebar.items.other = this.sidebar.items.other.filter(
  21. function(item){
  22. return item.label !== _t("Duplicate");
  23. }
  24. );
  25. this.sidebar.redraw();
  26. }
  27. }
  28. return res;
  29. },
  30. });
  31. });