product_category.py 567 B

1234567891011121314151617181920212223
  1. # -*- coding: utf-8 -*-
  2. from openerp.http import request as r
  3. _MODEL = 'product.category'
  4. def get_categories():
  5. domain = [
  6. ('type', '!=', 'view'),
  7. ('child_id', '=', False)
  8. ]
  9. return [
  10. {
  11. 'id': c.id,
  12. 'name': c.display_name,
  13. 'completeName': c.complete_name,
  14. 'parent': {
  15. 'id': c.parent_id.id,
  16. 'name': c.parent_id.display_name,
  17. 'completeName': c.parent_id.complete_name
  18. }
  19. } for c in r.env[_MODEL].search(domain)
  20. ]