Dolibarr icon

Dolibarr

Interact with Dolibarr API

Contracts → Create Line

AI-generated

Overview

This node operation creates a new line item within a specified contract in Dolibarr. It is useful for adding detailed entries such as products or services to an existing contract, including pricing, tax, quantity, discounts, and scheduling information. For example, a user can add a service line with a description, unit price, tax rate, and planned start and end dates to a contract for billing or tracking purposes.

Use Case Examples

  1. Adding a product line to a contract with a specified quantity and unit price.
  2. Creating a service line with a discount and planned start/end dates in a contract.

Properties

Name Meaning
Contract ID The unique identifier of the contract to which the line will be added. This is required and used in the API endpoint URL.
Description A textual description of the line item being added to the contract. This is required and sent in the request body as 'desc'.
Product or Service ID The identifier of the product or service associated with this line item, sent in the request body as 'fk_product'.
Sales Tax (%) The sales tax percentage applied to this line item, sent in the request body as 'tva_tx'.
Tax Indicates whether the price is tax excluded (HT) or tax included (TTC), sent as 'price_base_type' in the request body.
Unit Price The unit price of the line item. Depending on the tax type, it is used to calculate either 'subprice' (HT) or 'subprice_excl_tax' (TTC) in the request body.
Quantity The quantity of the product or service for this line item, sent as 'qty' in the request body.
Discount (%) A discount percentage applied to the line item, sent as 'remise_percent' in the request body. Note that it does not affect the unit price.
Planned Start Date The planned start date for the line item, sent as 'date_start' in the request body.
Planned End Date The planned end date for the line item, sent as 'date_end' in the request body.
Extra Fields Additional custom attributes for the line item, sent dynamically in the request body under 'array_options'.
Fields Other contract fields that can be assigned, sent in the request body.

Output

JSON

  • id - The unique identifier of the newly created contract line.
  • desc - The description of the contract line.
  • fk_product - The product or service ID associated with the line.
  • tva_tx - The sales tax percentage applied.
  • price_base_type - Indicates if the price is tax excluded (HT) or included (TTC).
  • subprice - The unit price excluding tax (calculated if tax type is HT).
  • subprice_excl_tax - The unit price including tax (used if tax type is TTC).
  • qty - The quantity of the product or service.
  • remise_percent - The discount percentage applied.
  • date_start - The planned start date of the line item.
  • date_end - The planned end date of the line item.
  • array_options - Additional custom attributes sent as extra fields.

Dependencies

  • Dolibarr API with an API key credential

Troubleshooting

  • Ensure the Contract ID is valid and exists in Dolibarr to avoid 404 errors.
  • Verify that required fields like Description and Quantity are provided to prevent validation errors.
  • Check that numeric fields such as Sales Tax, Discount, and Quantity are within allowed ranges.
  • If using extra fields, confirm that the field names match those configured in Dolibarr to avoid request errors.
  • Timeout or SSL issues can be addressed by adjusting the request options such as timeout duration or allowing unauthorized certificates.

Links

Discussion