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.

52 lines
2.1 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. @api.multi
  27. def _compute_group_pos_negative_qty(self):
  28. print self.env.ref('pos_access_right.group_pos_negative_qty')
  29. for config in self:
  30. self.group_pos_negative_qty = \
  31. self.env.ref('pos_access_right.group_pos_negative_qty')
  32. @api.multi
  33. def _compute_group_pos_discount(self):
  34. print self.env.ref('pos_access_right.group_pos_discount')
  35. for config in self:
  36. self.group_pos_discount = \
  37. self.env.ref('pos_access_right.group_pos_discount')
  38. @api.multi
  39. def _compute_group_pos_change_unit_price(self):
  40. print self.env.ref('pos_access_right.group_pos_change_unit_price')
  41. for config in self:
  42. self.group_pos_change_unit_price = \
  43. self.env.ref('pos_access_right.group_pos_change_unit_price')