Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

REST API not possible to add invoice lines #6811

Closed
SamuelBenard opened this issue May 7, 2017 · 4 comments
Closed

REST API not possible to add invoice lines #6811

SamuelBenard opened this issue May 7, 2017 · 4 comments

Comments

@SamuelBenard
Copy link

SamuelBenard commented May 7, 2017

Bug

I can add an invoice with the REST api but can't add line to the invoice. no addline method seem to be present.

Environment

  • Version: 5.0.1
  • OS: Linux
  • Web server: Apache 2.4.18
  • PHP: 7.0.15
  • Database: mariadb 10.0.29

Expected and actual behavior

With orders, I can add lines usi the REST api. With invoices, I can't. Function postline seems to be missing in api_invoices.class.php
Also, not possible to convert an order in invoice. (or create invoice from order)

@vvnt
Copy link
Contributor

vvnt commented May 17, 2017

Yes. You need to create invoice lines as the same time as the invoice header.

Here, a working example :

invoice = {
"socid": 1,
"date": 1492380000,
"date_creation": 1494252128,
"date_validation": 1494194400,
"datem": 1494252147,
"type": "0",
"paye": "0",
"lines": [
{
"desc": "Some additional text",
"qty": "10",
"subprice": 100,
"tva_tx": "20.000",
"fk_product": "1",
"remise_percent": "0",
"date_start": 1494252128,
"date_end": 1494194400,
"info_bits": "0"
}
],
"note_private": "Private note - automatic invoice",
"statut": "1",
"mode_reglement_id": "0",
"cond_reglement_id": "2",
"user_author": "1",
"user_valid": "1"
}

@SamuelBenard
Copy link
Author

Hi tried to play a little with that. Good, seems to work. But it works only if I remove the line
"statut": "1",
and add (for each product)
"product_type" : 0

can you explain what is the "statut : 1" parameter please ?

@vvnt
Copy link
Contributor

vvnt commented May 17, 2017

Draft / Validated

@SamuelBenard
Copy link
Author

ok, so not a bug then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants