diff --git a/pkg/invoices.go b/pkg/invoices.go index e73f962..9850776 100644 --- a/pkg/invoices.go +++ b/pkg/invoices.go @@ -427,9 +427,9 @@ func (form *invoiceForm) Update() { func (form *invoiceForm) AddProducts(ctx context.Context, conn *Conn, productsId []string) { index := len(form.Products) + taxOptions := mustGetTaxOptions(ctx, conn, form.company) rows := conn.MustQuery(ctx, "select product_id, name, description, to_price(price, decimal_digits), 1 as quantity, 0 as discount, array_remove(array_agg(tax_id), null) from product join company using (company_id) join currency using (currency_code) left join product_tax using (product_id) where product_id = any ($1) group by product_id, name, description, price, decimal_digits", productsId) defer rows.Close() - taxOptions := mustGetTaxOptions(ctx, conn, form.company) for rows.Next() { product := newInvoiceProductForm(index, form.company, form.locale, taxOptions) if err := rows.Scan(product.ProductId, product.Name, product.Description, product.Price, product.Quantity, product.Discount, product.Tax); err != nil {