Actions Examples
Examples of best practice created actions
Invoicing
Line Items
1. LexOffice > Create Vouchers
UI form schema:
{
"type": {
"type": "select",
"title": "Type",
"enum": [
"salesinvoice",
"salescreditnote",
"purchaseinvoice",
"purchasecreditnote",
"invoice",
"downpaymentinvoice",
"creditnote",
"orderconfirmation",
"quotation",
"deliverynote"
],
"info": "Possible values are salesinvoice (e.g. for sales orders), and salescreditnote (e.g. for refunds or returned sales orders).",
"required": true
},
"voucherNumber": {
"type": "text",
"title": "Voucher number",
"placeholder": "2345678",
"required": true
},
"voucherDate": {
"type": "date",
"placeholder": "2016-06-29T15:15:09.447+02:00",
"title": "Voucher date",
"required": true
},
"shippingDate": {
"type": "date",
"placeholder": "2016-06-29T15:15:09.447+02:00",
"title": "Shipping date",
"required": false
},
"dueDate": {
"type": "date",
"placeholder": "2016-06-29T15:15:09.447+02:00",
"info": "If not specified then the voucherDate will also be used for dueDate.",
"title": "Due date",
"required": false
},
"totalGrossAmount": {
"type": "text",
"placeholder": "119.00",
"title": "Total gross amount",
"required": true
},
"totalTaxAmount": {
"type": "text",
"placeholder": "19",
"title": "Total tax amount",
"required": true
},
"taxType": {
"type": "select",
"enum": [
"net",
"gross"
],
"default": "gross",
"allowCreate": true,
"title": "Tax type",
"required": true
},
"useCollectiveContact": {
"type": "switch",
"default": true,
"title": "Use collective contact",
"info": "Set to true if the Collective Contact (customer/vendor) within lexoffice should be used. If used, the optional contactId will be ignored.",
"required": false
},
"remark": {
"type": "text",
"title": "Subject remarks",
"placeholder": "AWS invoice",
"required": true
},
"voucherItems": {
"type": "code",
"mode": "jinja2",
"rows": "9",
"title": "Voucher items (Jinja code field)",
"placeholder": "{% for item in line_items %}\n {\n \"amount\": {{ item.amount }},\n \"taxAmount\": {{ item.taxAmount }},\n \"taxRatePercent\": {{ item.taxRatePercent }},\n \"categoryId\": \"8f8664a8-fd86-11e1-a21f-0800200c9a66\" {# this id is Warenverkäufe as per https://developers.lexoffice.io/docs/#vouchers-endpoint-list-of-categoryids #}\n }\n {% if not loop.last %},{% endif %}\n{% endfor %}",
"default": "{% for item in line_items %}\n {\n \"amount\": {{ item.amount }},\n \"taxAmount\": {{ item.taxAmount }},\n \"taxRatePercent\": {{ item.taxRatePercent }},\n \"categoryId\": \"8f8664a8-fd86-11e1-a21f-0800200c9a66\" {# this id is Warenverkäufe as per https://developers.lexoffice.io/docs/#vouchers-endpoint-list-of-categoryids #}\n }\n {% if not loop.last %},{% endif %}\n{% endfor %}",
"info": "Use this field if you want to define your line items flexibly (multiple). Here is the docs: https://developers.lexoffice.io/docs/#vouchers-endpoint-create-a-voucher",
"required": false
}
}
Request body of the action:
{
"type": "{{ type }}",
"voucherNumber": "{{ voucherNumber }}",
"voucherDate": "{{ voucherDate }}",
{% if shippingDate is defined %}
,"shippingDate": "{{ shippingDate }}"
{% endif %}
{% if dueDate is defined %}
,"dueDate": "{{ dueDate }}"
{% endif %}
"totalGrossAmount": {{ totalGrossAmount }},
"totalTaxAmount": {{ totalTaxAmount }},
"taxType": "{{ taxType }}",
"useCollectiveContact": {{ useCollectiveContact | lower }},
"remark": "{{ remark }}",
"voucherItems": [ {{ voucherItems }} ]
}
Last updated