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

Module: Mail Whatsapp Gateway

Entity: mail.whatsapp.template.button

Compute Method: _compute_variable_ids

View 18.0
Inputs Method Outputs
  • variable_ids
  • website_url
  • name
  • id
  • template_id
  • template_id.id
- dynamic_urls = self.filtered(
-             lambda button: button.button_type == "url" and button.url_type == "dynamic"
-         )
- to_clear = self - dynamic_urls
- for button in dynamic_urls:
-             if button.variable_ids:
-                 button.variable_ids = [
-                     Command.update(
-                         button.variable_ids[0].id,
-                         {
-                             "sample_value": button.website_url,
-                             "line_type": "button",
-                             "name": button.name,
-                             "button_id": button.id,
-                             "template_id": button.template_id.id,
-                         },
-                     ),
-                 ]
-             else:
-                 button.variable_ids = [
-                     Command.create(
-                         {
-                             "sample_value": button.website_url,
-                             "line_type": "button",
-                             "name": button.name,
-                             "button_id": button.id,
-                             "template_id": button.template_id.id,
-                         },
-                     ),
-                 ]
- if to_clear:
-             to_clear.variable_ids = [Command.clear()]
  • variable_ids

Back to entity