question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Bug: quantity unit stock has no values to choose

See original GitHub issue

The iOS Grocy app managed to create products with no default purchase unit. This renders a given product unchangeable, as only the purchase unit Dropdown has any values to choose. Since both are mandatory fields, the product can’t be updated/fixed.

I was able to populate the Dropdown by creating a dummy conversation. The save was allowed but after a refresh, the issue reappeared. The PUT request is logged with status code 400. PHP error log is quiet, even though if set the level to debug for php-fpm.

since I don’t know how the app managed to create it in the first place, I can’t fully reproduce either.

this is one of the affected products retrieved via the API

{
  "product": {
    "id": "112",
    "name": "Speisezwiebeln",
    "description": "",
    "product_group_id": "-1",
    "active": "1",
    "location_id": "3",
    "shopping_location_id": "1",
    "qu_id_purchase": "-1",
    "qu_id_stock": "-1",
    "qu_factor_purchase_to_stock": "1.0",
    "min_stock_amount": "0",
    "default_best_before_days": "180",
    "default_best_before_days_after_open": "0",
    "default_best_before_days_after_freezing": "0",
    "default_best_before_days_after_thawing": "0",
    "picture_file_name": "",
    "enable_tare_weight_handling": "0",
    "tare_weight": "0.0",
    "not_check_stock_fulfillment_for_recipes": "0",
    "parent_product_id": null,
    "calories": "0",
    "cumulate_min_stock_amount_of_sub_products": "0",
    "due_type": "2",
    "quick_consume_amount": "1.0",
    "hide_on_stock_overview": "0",
    "default_stock_label_type": "0",
    "should_not_be_frozen": "0",
    "row_created_timestamp": "2022-12-12T16:54:15.533Z",
    "treat_opened_as_out_of_stock": "0",
    "no_own_stock": "0",
    "default_consume_location_id": "",
    "move_on_open": "0"
  },
  "product_barcodes": [
    {
      "id": "135",
      "product_id": "112",
      "barcode": "4000874739200",
      "qu_id": "-1",
      "amount": null,
      "shopping_location_id": null,
      "last_price": null,
      "row_created_timestamp": "2022-12-12T16:54:15.750Z",
      "note": null
    }
  ],
  "last_purchased": "2022-12-12",
  "last_used": null,
  "stock_amount": "1",
  "stock_value": "1.99",
  "stock_amount_opened": "0",
  "stock_amount_aggregated": "1.0",
  "stock_amount_opened_aggregated": "0",
  "default_quantity_unit_purchase": null,
  "quantity_unit_stock": null,
  "last_price": "1.99",
  "avg_price": "1.99",
  "oldest_price": "1.99",
  "current_price": "1.99",
  "last_shopping_location_id": null,
  "default_shopping_location_id": "1",
  "next_due_date": "2023-06-10",
  "location": {
    "id": "3",
    "name": "Keller",
    "description": "",
    "row_created_timestamp": "2022-12-01 20:45:29",
    "is_freezer": "0"
  },
  "average_shelf_life_days": 180,
  "spoil_rate_percent": 0,
  "is_aggregated_amount": "0",
  "has_childs": false,
  "default_consume_location": null
}

Issue Analytics

  • State:closed
  • Created 9 months ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
berrndcommented, Dec 12, 2022

A product always needs to have a Default quantity unit purchase, so creating one (however) without one or maybe delete the selected unit afterwards leads to bullshit without real surprise.

grocy is generally based around GIGO, so not a “bug”.

0reactions
bitte-ein-bitcommented, Dec 13, 2022

thanks. that worked to get the mess cleaned up

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error when trying to add a Quantity Unit (QU) conversion
With no conversions present when I enter 1 box to the inventory it tells me that it equals 0.1 pieces.
Read more >
ERROR-Quantity in stock keeping unit is zero when ...
The system cannot post the document. The system has converted the quantity entered in the unit of entry into the quantity in the...
Read more >
Bug #779145 “[stock] store price_unit for all stock moves, and ...
In OpenERP 6.0 stock.move has a price_unit field for storing the unit cost price of the products, but this field only has a...
Read more >
Tracking and adjusting inventory - Shopify Help Center
If a product's inventory quantity is tracked using inventory apps, then its quantities will be allocated only to that app location. You can...
Read more >
Use single and multiple units of measure for items - QuickBooks
The unit of measure (U/M) allows you to show quantities, prices, rates, and costs for an item. There are two ways to assign...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found