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.

87 lines
3.3 KiB

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