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.

49 lines
1.3 KiB

  1. /**
  2. Copyright (C) 2015 - Today: GRAP (http://www.grap.coop)
  3. @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
  4. License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
  5. **/
  6. odoo.define('pos_place.widgets', function (require) {
  7. "use strict";
  8. var PosBaseWidget = require('point_of_sale.BaseWidget');
  9. var core = require('web.core');
  10. var _t = core._t;
  11. var PlaceNameWidget = PosBaseWidget.extend({
  12. template: 'PlaceNameWidget',
  13. renderElement: function () {
  14. var self = this;
  15. this._super();
  16. this.$el.click(function () {
  17. self.click_place();
  18. });
  19. },
  20. click_place: function () {
  21. var self = this;
  22. this.gui.select_place({}).then(function (place) {
  23. self.pos.set_place(place);
  24. self.renderElement();
  25. });
  26. },
  27. is_visible: function () {
  28. return this.pos.user.groups_id.indexOf(
  29. this.pos.config.group_pos_place_user_id[0]) !== -1;
  30. },
  31. get_name: function () {
  32. var place = this.pos.get_place();
  33. if (place) {
  34. return place.code;
  35. }
  36. return _t("Place");
  37. },
  38. });
  39. return {
  40. PlaceNameWidget: PlaceNameWidget,
  41. };
  42. });