{
  "name": "Signed work report → invoice",
  "description": "Hours and materials from the work report, invoiced and sent to the customer.",
  "tags": [
    "Operations"
  ],
  "pieces": [
    "@flooows/component-attendo",
    "@flooows/component-odoo",
    "@flooows/component-gmail"
  ],
  "template": {
    "displayName": "Signed work report → invoice",
    "trigger": {
      "name": "trigger",
      "type": "PIECE_TRIGGER",
      "valid": false,
      "displayName": "Work report signed by the customer in attendo",
      "settings": {
        "pieceName": "@flooows/component-attendo",
        "pieceVersion": "~1.0.0",
        "pieceType": "OFFICIAL",
        "packageType": "REGISTRY",
        "triggerName": "work_report_signed",
        "input": {},
        "inputUiInfo": {},
        "propertySettings": {}
      },
      "nextAction": {
        "name": "step_1",
        "type": "PIECE",
        "valid": false,
        "skip": false,
        "displayName": "Create the invoice with hours and materials",
        "settings": {
          "pieceName": "@flooows/component-odoo",
          "pieceVersion": "~0.3.4",
          "pieceType": "OFFICIAL",
          "packageType": "REGISTRY",
          "actionName": "create_record",
          "input": {
            "model": "account.move",
            "fields": {
              "move_type": "out_invoice",
              "partner_id": "{{trigger.customer.odoo_id}}",
              "ref": "{{trigger.number}}"
            }
          },
          "inputUiInfo": {},
          "propertySettings": {},
          "errorHandlingOptions": {
            "retryOnFailure": {
              "value": true
            },
            "continueOnFailure": {
              "value": false
            }
          }
        },
        "nextAction": {
          "name": "step_2",
          "type": "PIECE",
          "valid": false,
          "skip": false,
          "displayName": "Send the invoice and report to the customer",
          "settings": {
            "pieceName": "@flooows/component-gmail",
            "pieceVersion": "~0.18.6",
            "pieceType": "OFFICIAL",
            "packageType": "REGISTRY",
            "actionName": "send_email",
            "input": {
              "receiver": [
                "{{trigger.customer.email}}"
              ],
              "subject": "Factura del parte {{trigger.number}}",
              "body_type": "plain_text",
              "body": "Adjuntamos la factura y el parte firmado. ¡Gracias!"
            },
            "inputUiInfo": {},
            "propertySettings": {},
            "errorHandlingOptions": {
              "retryOnFailure": {
                "value": true
              },
              "continueOnFailure": {
                "value": false
              }
            }
          }
        }
      }
    },
    "valid": false,
    "schemaVersion": "1"
  },
  "blogUrl": "https://flooows.com/en/templates/signed-work-report-to-invoice",
  "metadata": {
    "publisher": "flooows",
    "lang": "en",
    "setupMinutes": 10,
    "creditsPerRun": 1
  }
}