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

Bug : Subtotal lines are not kept when creating deposit invoice from an order #379

Open
thomas-Ngr opened this issue Dec 4, 2023 · 1 comment

Comments

@thomas-Ngr
Copy link
Contributor

When creating a deposit invoice and chosing 'all lines identical', the computation of subtotals is lost.

This is the original order:

image

Then we create a deposit invoice with all lines identical (here rate is 30%) :
image

This is the resulting invoice : subtotal lines are lost
image

This is due to problems in quantities : quantities of subtotal lines are set to 30% of the original quantity (here 0.3 and 29.7 instead of 1 and 99). These are the lines for the faulty invoice:

MariaDB [dolitest]> select rowid, fk_facture, fk_parent_line, product_type, price, qty, subprice, info_bits, special_code, label FROM llx_facturedet WHERE fk_facture = 19782; 
+-------+------------+----------------+--------------+-------+------+-------------+-----------+--------------+------------+
| rowid | fk_facture | fk_parent_line | product_type | price | qty  | subprice    | info_bits | special_code | label      |
+-------+------------+----------------+--------------+-------+------+-------------+-----------+--------------+------------+
| 36082 |      19782 |           NULL |            9 |  NULL |  0.3 |  0.00000000 |         0 |       104777 | TITRE      |
| 36083 |      19782 |           NULL |            0 |  NULL |  0.3 | 42.00000000 |         0 |            0 | NULL       |
| 36084 |      19782 |           NULL |            9 |  NULL | 29.7 |  0.00000000 |         0 |       104777 | Sous-total |
+-------+------------+----------------+--------------+-------+------+-------------+-----------+--------------+------------+

When correcting the quantities and setting to (1; 99) instead of (0,3 ; 29,7), the lines of the invoice are correct.

Suggested fix:

On trigger INVOICE_CREATE

IF

  • invoice is a deposit
  • AND origin and origin_id are set and are an order
  • AND we use original lines with a rate

THEN

  • set quantities of all lines where product_type = 9 to original quantities
@atm-florianm
Copy link
Contributor

Thank you for reporting this bug thoroughly. I have opened an internal ticket to address the issue.

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