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.

53 lines
2.3 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_negative_qty_id = fields.Many2one(
  9. comodel_name='res.groups',
  10. compute='_compute_group',
  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_discount_id = fields.Many2one(
  15. comodel_name='res.groups',
  16. compute='_compute_group',
  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_change_unit_price_id = fields.Many2one(
  21. comodel_name='res.groups',
  22. compute='_compute_group',
  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_multi_order_id = fields.Many2one(
  27. comodel_name='res.groups',
  28. compute='_compute_group',
  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_delete_order_id = fields.Many2one(
  33. comodel_name='res.groups',
  34. compute='_compute_group',
  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. @api.multi
  39. def _compute_group(self):
  40. for config in self:
  41. config.group_negative_qty_id = self.env.ref('pos_access_right.group_negative_qty')
  42. config.group_discount_id = self.env.ref('pos_access_right.group_discount')
  43. config.group_change_unit_price_id = self.env.ref('pos_access_right.group_change_unit_price')
  44. config.group_multi_order_id = self.env.ref('pos_access_right.group_multi_order')
  45. config.group_delete_order_id = self.env.ref('pos_access_right.group_delete_order')