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

Module: Spreadsheet

Entity: spreadsheet.mixin

Compute Method: _compute_spreadsheet_data

View 18.0 View 20.0
Inputs Method Outputs
  • id
  • spreadsheet_binary_data
- attachments = self.env['ir.attachment'].with_context(bin_size=False).search([
-             ('res_model', '=', self._name),
-             ('res_field', '=', 'spreadsheet_binary_data'),
-             ('res_id', 'in', self.ids),
-         ])
- data = {
-             attachment.res_id: attachment.raw
-             for attachment in attachments
-         }
for spreadsheet in self:
-             spreadsheet.spreadsheet_data = data.get(spreadsheet.id, False)
+             spreadsheet.spreadsheet_data = spreadsheet.spreadsheet_binary_data.decode()
  • spreadsheet_data

Back to entity