Odoo Mindscape. Understand Odoo faster. Explore modules, fields, dependencies and version differences in one place instead of digging through the source code.

Module: Point of Sale

Entity: pos.config

Compute Method: _compute_current_session

Inputs Method Outputs
"""If there is an open session, store it to current_session_id / current_session_State.
        """
self.session_ids.fetch(["state"])
for pos_config in self:
            opened_sessions = pos_config.session_ids.filtered(lambda s: s.state != 'closed')
            session = pos_config.session_ids.filtered(lambda s: s.state != 'closed')
            # sessions ordered by id desc
            pos_config.has_active_session = bool(opened_sessions.filtered(lambda s: s.state != 'opening_control')) or False
            pos_config.current_session_id = (session and session[0].id) or False
            pos_config.current_session_state = (session and session[0].state) or False

Back to entity