slider.py 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. # -*- coding: utf-8 -*-
  2. # Part of AppJetty. See LICENSE file for full copyright and licensing details.
  3. from odoo import api, fields, models
  4. class ProductCategorySlider(models.Model):
  5. _name = 'product.category.slider.config'
  6. _description = "Configration of product category slider"
  7. name = fields.Char(string="Slider name", default='Trending', required=True, translate=True,
  8. help="Slider title to be displayed on website like Best products, Latest and etc...")
  9. active = fields.Boolean(string="Active", default=True)
  10. no_of_counts = fields.Selection([('3', '3'), ('4', '4'), ('5', '5'), ('6', '6')], string="Counts",
  11. default='4', required=True,
  12. help="No of products to be displayed in slider.")
  13. prod_cat_type = fields.Selection([('product', 'Product'), ('category', 'Category')],
  14. string="Type of slider", default='product', required=True,
  15. help="Select product or category for whom you want to show a slider.")
  16. auto_rotate = fields.Boolean(string='Auto Rotate Slider', default=True)
  17. sliding_speed = fields.Integer(string="Slider sliding speed", default='5000',
  18. help='Sliding speed of a slider can be set from here and it will be in milliseconds.')
  19. collections_product = fields.Many2many('product.template', 'king_pro_product_slider_rel', 'slider_id',
  20. 'prod_id', string="Collections of product")
  21. collections_category = fields.Many2many('product.public.category', 'king_pro_category_slider_rel',
  22. 'slider_id', 'cat_id', string="Collections of category")
  23. class BlogSlider(models.Model):
  24. _name = 'blog.slider.config'
  25. _description = "Configration of Blogs slider"
  26. name = fields.Char(string="Slider name", default='Blogs', translate=True,
  27. help="Slider title to be displayed on website like Our Blogs, Latest Blog Post and etc...",
  28. required=True)
  29. active = fields.Boolean(string="Active", default=True)
  30. no_of_counts = fields.Selection([('1', '1'), ('2', '2'), ('3', '3')], string="Counts",
  31. default='3', help="No of blogs to be displayed in slider.", required=True)
  32. auto_rotate = fields.Boolean(string='Auto Rotate Slider', default=True)
  33. sliding_speed = fields.Integer(string="Slider sliding speed", default='5000',
  34. help='Sliding speed of a slider can be set from here and it will be in milliseconds.')
  35. collections_blog_post = fields.Many2many('blog.post', 'blogpost_slider_rel', 'slider_id',
  36. 'post_id', string="Collections of blog posts", required=True)
  37. class MultiSlider(models.Model):
  38. _name = 'multi.slider.config'
  39. _description = "Configration of Multi slider"
  40. name = fields.Char(string="Slider name", default='Trending',
  41. required=True, translate=True,
  42. help="Slider title to be displayed on website like Best products, Latest and etc...")
  43. active = fields.Boolean(string="Active", default=True)
  44. auto_rotate = fields.Boolean(string='Auto Rotate Slider', default=True)
  45. sliding_speed = fields.Integer(string="Slider sliding speed", default='5000',
  46. help='Sliding speed of a slider can be set from here and it will be in milliseconds.')
  47. no_of_collection = fields.Selection([('2', '2'), ('3', '3'), ('4', '4'), ('5', '5')],
  48. string="No. of collections to show", default='2',
  49. required=True,
  50. help="No of collections to be displayed on slider.")
  51. label_collection_1 = fields.Char(string="1st collection name", default='First collection',
  52. required=True, translate=True,
  53. help="Collection label to be displayed in website like Men, Women, Kids, etc...")
  54. collection_1_ids = fields.Many2many('product.template', 'product_slider_collection_1_rel', 'slider_id',
  55. 'prod_id',
  56. required=True,
  57. string="1st product collection")
  58. label_collection_2 = fields.Char(string="2nd collection name", default='Second collection',
  59. required=True, translate=True,
  60. help="Collection label to be displayed in website like Men, Women, Kids, etc...")
  61. collection_2_ids = fields.Many2many('product.template', 'product_slider_collection_2_rel', 'slider_id',
  62. 'prod_id',
  63. required=True,
  64. string="2nd product collection")
  65. label_collection_3 = fields.Char(string="3rd collection name", default='Third collection', translate=True,
  66. # required=True,
  67. help="Collection label to be displayed in website like Men, Women, Kids, etc...")
  68. collection_3_ids = fields.Many2many('product.template', 'product_slider_collection_3_rel', 'slider_id',
  69. 'prod_id',
  70. # required=True,
  71. string="3rd product collection")
  72. label_collection_4 = fields.Char(string="4th collection name", default='Fourth collection', translate=True,
  73. # required=True,
  74. help="Collection label to be displayed in website like Men, Women, Kids, etc...")
  75. collection_4_ids = fields.Many2many('product.template', 'product_slider_collection_4_rel', 'slider_id',
  76. 'prod_id',
  77. # required=True,
  78. string="4th product collection")
  79. label_collection_5 = fields.Char(string="5th collection name", default='Fifth collection', translate=True,
  80. # required=True,
  81. help="Collection label to be displayed in website like Men, Women, Kids, etc...")
  82. collection_5_ids = fields.Many2many('product.template', 'product_slider_collection_5_rel', 'slider_id',
  83. 'prod_id',
  84. # required=True,
  85. string="5th product collection")