[IMP] code comment in several modules

This commit is contained in:
clementthomas
2023-10-04 16:55:29 +02:00
parent 915e2bf583
commit e24614f571
17 changed files with 65 additions and 123 deletions

View File

@@ -4,7 +4,16 @@ from odoo import models, fields, api
class EventEvent(models.Model):
_inherit = 'event.event'
def get_events_visible_in_survey(self, product_id=False):
def get_events_visible_in_survey(self, product_id=None):
"""Search events in stage visible in survey.
Optionnaly filtered by product present in ticket.
Args:
product_id (product.product, optional): to filter only events with tickets using this product. Defaults to None.
Returns:
event.event: Events
"""
if product_id:
event_tickets = self.env['event.event.ticket'].search([('product_id','=',product_id)])
return self.env['event.event'].search([('stage_id.visible_in_survey','=',True),('event_ticket_ids','in',event_tickets.id)])