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.

88 lines
3.4 KiB

  1. # -*- coding: utf-8 -*-
  2. # Copyright (C) 2016-Today: La Louve (<http://www.lalouve.net/>)
  3. # @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
  4. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
  5. from openerp import fields, models, api
  6. class PosConfig(models.Model):
  7. _inherit = 'pos.config'
  8. group_pos_negative_qty = fields.Many2one(
  9. comodel_name='res.groups',
  10. compute='_compute_group_pos_negative_qty',
  11. string='Point of Sale - Allow Negative Quantity',
  12. help="This field is there to pass the id of the 'PoS - Allow Negative"
  13. " Quantity' Group to the Point of Sale Frontend.")
  14. group_pos_discount = fields.Many2one(
  15. comodel_name='res.groups',
  16. compute='_compute_group_pos_discount',
  17. string='Point of Sale - Allow Discount',
  18. help="This field is there to pass the id of the 'PoS - Allow Discount'"
  19. " Group to the Point of Sale Frontend.")
  20. group_pos_change_unit_price = fields.Many2one(
  21. comodel_name='res.groups',
  22. compute='_compute_group_pos_change_unit_price',
  23. string='Point of Sale - Allow Unit Price Change',
  24. help="This field is there to pass the id of the 'PoS - Allow Unit"
  25. " Price Change' Group to the Point of Sale Frontend.")
  26. group_pos_multi_order = fields.Many2one(
  27. comodel_name='res.groups',
  28. compute='_compute_group_pos_multi_order',
  29. string='Point of Sale - Many Orders',
  30. help="This field is there to pass the id of the 'PoS - Many Orders"
  31. " Group to the Point of Sale Frontend.")
  32. group_pos_delete_order = fields.Many2one(
  33. comodel_name='res.groups',
  34. compute='_compute_group_pos_delete_order',
  35. string='Point of Sale - Delete Order',
  36. help="This field is there to pass the id of the 'PoS - Delete Order'"
  37. " Group to the Point of Sale Frontend.")
  38. group_pos_delete_order_line = fields.Many2one(
  39. comodel_name='res.groups',
  40. compute='_compute_group_pos_delete_order_line',
  41. string='Point of Sale - Delete Order Line',
  42. help="This field is there to pass the id of the 'PoS - Delete Order"
  43. " Line' Group to the Point of Sale Frontend.")
  44. @api.multi
  45. def _compute_group_pos_negative_qty(self):
  46. for config in self:
  47. self.group_pos_negative_qty = \
  48. self.env.ref('pos_access_right.group_pos_negative_qty')
  49. @api.multi
  50. def _compute_group_pos_discount(self):
  51. for config in self:
  52. self.group_pos_discount = \
  53. self.env.ref('pos_access_right.group_pos_discount')
  54. @api.multi
  55. def _compute_group_pos_change_unit_price(self):
  56. for config in self:
  57. self.group_pos_change_unit_price = \
  58. self.env.ref('pos_access_right.group_pos_change_unit_price')
  59. @api.multi
  60. def _compute_group_pos_multi_order(self):
  61. for config in self:
  62. self.group_pos_discount = \
  63. self.env.ref('pos_access_right.group_pos_multi_order')
  64. @api.multi
  65. def _compute_group_pos_delete_order(self):
  66. for config in self:
  67. self.group_pos_discount = \
  68. self.env.ref('pos_access_right.group_pos_delete_order')
  69. @api.multi
  70. def _compute_group_pos_delete_order_line(self):
  71. for config in self:
  72. self.group_pos_discount = \
  73. self.env.ref('pos_access_right.group_pos_delete_order_line')