model.py 973 B

12345678910111213141516171819202122232425262728293031323334
  1. # -*- coding: utf-8 -*-
  2. # Part of Odoo. See LICENSE file for full copyright and licensing details.
  3. from odoo import api, fields, models
  4. class TestModel(models.Model):
  5. """ Add website option in server actions. """
  6. _name = 'test.model'
  7. _inherit = [
  8. 'website.seo.metadata',
  9. 'website.published.mixin',
  10. 'website.searchable.mixin',
  11. ]
  12. _description = 'Website Model Test'
  13. name = fields.Char(required=1)
  14. @api.model
  15. def _search_get_detail(self, website, order, options):
  16. return {
  17. 'model': 'test.model',
  18. 'base_domain': [],
  19. 'search_fields': ['name'],
  20. 'fetch_fields': ['name'],
  21. 'mapping': {
  22. 'name': {'name': 'name', 'type': 'text', 'match': True},
  23. 'website_url': {'name': 'name', 'type': 'text', 'truncate': False},
  24. },
  25. 'icon': 'fa-check-square-o',
  26. 'order': 'name asc, id desc',
  27. }