|
@ -36,13 +36,23 @@ class WebsiteProductFeatured(models.Model): |
|
|
_inherit = ['website.published.mixin', 'mail.thread'] |
|
|
_inherit = ['website.published.mixin', 'mail.thread'] |
|
|
_description = 'Basic model for featured products records' |
|
|
_description = 'Basic model for featured products records' |
|
|
|
|
|
|
|
|
|
|
|
def _default_featured_list(self): |
|
|
|
|
|
featured_products = [] |
|
|
|
|
|
products = self.env['product.template'].search([], limit=8) |
|
|
|
|
|
|
|
|
|
|
|
for product in products: |
|
|
|
|
|
featured_products.append((0, 0, { |
|
|
|
|
|
'product': product.id, |
|
|
|
|
|
'featured_rel': self.id |
|
|
|
|
|
})) |
|
|
|
|
|
return featured_products |
|
|
|
|
|
|
|
|
name = fields.Char(string="Name") |
|
|
name = fields.Char(string="Name") |
|
|
website_published = fields.Boolean(string='Available on the Website', |
|
|
website_published = fields.Boolean(string='Available on the Website', |
|
|
copy=False, default=False) |
|
|
copy=False, default=False) |
|
|
featured_list = fields.One2many("product.featured.relation", "featured_rel", |
|
|
featured_list = fields.One2many("product.featured.relation", "featured_rel", |
|
|
string="Featured List") |
|
|
string="Featured List", |
|
|
|
|
|
default=_default_featured_list) |
|
|
user_id = fields.Many2one('res.users', string="Person Responsible", |
|
|
user_id = fields.Many2one('res.users', string="Person Responsible", |
|
|
track_visibility='onchange', |
|
|
track_visibility='onchange', |
|
|
default=lambda self: self.env.uid) |
|
|
default=lambda self: self.env.uid) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|