models.py 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. # -*- coding: utf-8 -*-
  2. from openerp import models, fields, api
  3. class PosSession(models.Model):
  4. _inherit = 'pos.session'
  5. @api.model
  6. def getPosSession(self,domain):
  7. PosSession = self.env['pos.session'].search(domain)
  8. values = []
  9. for session in PosSession:
  10. values.append({
  11. 'id': session.id,
  12. 'name': session.name,
  13. 'user_id':[
  14. session.user_id.id,
  15. session.user_id.name,
  16. ],
  17. 'config_id':[
  18. session.config_id.id,
  19. session.config_id.name,
  20. ],
  21. 'start_at': session.start_at,
  22. 'stop_at': session.stop_at,
  23. 'state': session.state,
  24. })
  25. return values
  26. class PosConfig(models.Model):
  27. _inherit = 'pos.config'
  28. @api.model
  29. def getPosConfig(self,domain):
  30. PosConfig = self.env['pos.config'].search(domain)
  31. values = []
  32. for config in PosConfig:
  33. values.append({
  34. 'id': config.id,
  35. 'name': config.name,
  36. 'journal_id':[
  37. config.journal_id.id,
  38. config.journal_id.name,
  39. ],
  40. })
  41. return values
  42. class PosCategory(models.Model):
  43. _inherit = 'pos.category'
  44. @api.model
  45. def getPosCategory(self,domain):
  46. PorCategory = self.env['pos.category'].search(domain)
  47. values = []
  48. for category in PorCategory:
  49. values.append({
  50. 'id': category.id,
  51. 'complete_name': category.complete_name,
  52. })
  53. return values