Debian Codegraph @

addons/website_sale_loyalty/models/loyalty_program.py

raw symbols SCIP
1 # Part of Odoo. See LICENSE file for full copyright and licensing details.
2
3 from odoo import api, fields, models
4
5
6 class LoyaltyProgram(models.Model):
7 _name = 'loyalty.program'
8 _inherit = ['loyalty.program', 'website.multi.mixin']
9
10 ecommerce_ok = fields.Boolean("Available on Website", default=True)
11 show_non_published_product_warning = fields.Boolean(compute='_compute_show_non_published_product_warning')
12
13 @api.depends('program_type', 'trigger_product_ids.website_published')
14 def _compute_show_non_published_product_warning(self):
15 for program in self:
16 program.show_non_published_product_warning = (
17 program.program_type == 'ewallet'
18 and any(not product.website_published for product in program.trigger_product_ids)
19 )
20
21 def action_program_share(self):
22 self.ensure_one()
23 return self.env['coupon.share'].create_share_action(program=self)