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

Module: VCP Management

Entity: res.partner

Compute Method: _compute_image_1920

Inputs Method Outputs
for record in self:
            sync_user = record.vcp_user_ids.filtered("sync_image_to_partner")
            if len(sync_user) > 1:
                raise UserError(
                    self.env._(
                        "Only one Vcp User can be use for synchronising the main image"
                    )
                )
            elif sync_user.avatar_url:
                try:
                    response = requests.get(sync_user.avatar_url, timeout=10)
                    response.raise_for_status()
                except Exception as e:
                    raise UserError(
                        self.env._("Fail to download avatar, %s.please retry".format())
                    ) from e
                record.image_1920 = base64.b64encode(response.content).decode("utf-8")

Back to entity