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_last_session

Inputs Method Outputs
  • id
PosSession = self.env['pos.session']
for pos_config in self:
            session = PosSession.search_read(
                [('config_id', '=', pos_config.id), ('state', '=', 'closed')],
                ['stop_at'],
                order="stop_at desc", limit=1)
            if session:
                timezone = self.env.tz
                pos_config.last_session_closing_date = session[0]['stop_at'].astimezone(timezone).date()
            else:
                pos_config.last_session_closing_date = False

Back to entity