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

Notes have disappeared from Sales|Purchase Order API listing, but not individual page #8672

Open
2 of 6 tasks
miggland opened this issue Dec 16, 2024 · 0 comments
Open
2 of 6 tasks
Labels
bug Identifies a bug which needs to be addressed question This is a question triage:not-checked Item was not checked by the core team

Comments

@miggland
Copy link
Contributor

Please verify that this bug has NOT been raised before.

  • I checked and didn't find a similar issue

Describe the bug*

I have not been using InvenTree too much the last few months, but now one of my scripts interacting with the API has failed with a new error, which has not present last time I ran it. Unfortunately, I can't determine on which last version I last ran the script successfully.

Steps to Reproduce

The error appears when using the demo also. Using the python API wrapper:
(I added the note to the SalesOrder with pk=11 in the demo server).

>>> so = SalesOrder(api, pk=11)
>>> so.notes
'This order has notes'
>>> so.reference
'SO0025'
>>> so_alt = SalesOrder.list(api, reference=so.reference)[0]
>>> so_alt.reference
'SO0025'
>>> so_alt.notes
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/martin/repos/inventree-forks/inventree-python/inventree/base.py", line 353, in __getattr__
    return super().__getattribute__(name)
AttributeError: 'SalesOrder' object has no attribute 'notes'

With PurchaseOrder, the same thing happens:

>>> po = PurchaseOrder(api, pk=12)
>>> po.notes
"Don't forget to send them an invoice!\n\n### Important Order Information:\n\n`This supplier does not accept money as payment - only barter in kind. Last time we placed an order, we paid with seventeen ducklings. The supplier has indicated that they still are in possession of a suffient quantity of ducklings. A new type of payment must be determined.`"
>>> po.reference
'PO0012'
>>> po_alt = PurchaseOrder.list(api, reference=po.reference)[0]
>>> po_alt.notes
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/martin/repos/inventree-forks/inventree-python/inventree/base.py", line 353, in __getattr__
    return super().__getattribute__(name)
AttributeError: 'PurchaseOrder' object has no attribute 'notes'

As you see:

  1. The note is available when getting a SalesOrder or PurchaseOrder by pk.
  2. The note is not available when getting a SalesOrder or PurchaseOrder through the list() method.

Getting directly from the API at https://demo.inventree.org/api/order/so/:

[
  ...
  {
    "pk": 11,
    "creation_date": "2024-11-08",
    "target_date": "2025-02-20",
    "description": "Another order for widgets",
    "line_items": 2,
    "completed_lines": 0,
    "link": "",
    "project_code": 5,
    "project_code_label": "PRO-ZEN",
    "project_code_detail": {
      "pk": 5,
      "code": "PRO-ZEN",
      "description": "Project Zenith",
      "responsible": null,
      "responsible_detail": null
    },
    "reference": "SO0025",
    "responsible": null,
    "responsible_detail": null,
    "contact": null,
    "contact_detail": null,
    "address": null,
    "address_detail": null,
    "status": 15,
    "status_text": "In Progress",
    "status_custom_key": 15,
    "barcode_hash": "",
    "overdue": false,
    "customer": 34,
    "customer_reference": "CE-1234-XYZ",
    "shipment_date": null,
    "total_price": "739.800000",
    "order_currency": "CNY",
    "shipments_count": 2,
    "completed_shipments_count": 0
  },
...
]

Getting from https://demo.inventree.org/api/order/so/11/:

{
  "pk": 11,
  "creation_date": "2024-11-08",
  "target_date": "2025-02-20",
  "description": "Another order for widgets",
  "line_items": 2,
  "completed_lines": 0,
  "link": "",
  "project_code": 5,
  "project_code_label": "PRO-ZEN",
  "project_code_detail": {
    "pk": 5,
    "code": "PRO-ZEN",
    "description": "Project Zenith",
    "responsible": null,
    "responsible_detail": null
  },
  "reference": "SO0025",
  "responsible": null,
  "responsible_detail": null,
  "contact": null,
  "contact_detail": null,
  "address": null,
  "address_detail": null,
  "status": 15,
  "status_text": "In Progress",
  "status_custom_key": 15,
  "notes": "This order has notes",
  "barcode_hash": "",
  "overdue": false,
  "customer": 34,
  "customer_reference": "CE-1234-XYZ",
  "shipment_date": null,
  "total_price": "739.800000",
  "order_currency": "CNY",
  "shipments_count": 2,
  "completed_shipments_count": 0
}

A diff:

$ diff so_fromlist.txt so_frompk.txt 
27a28
> "notes": "This order has notes",

For PurchaseOrder, same story.

Expected behaviour

The information should be the same, regardless of method used.

Deployment Method

  • Docker
  • Package
  • Bare metal
  • Other - added info in Steps to Reproduce

Version Information

Demo server,

Version Information:

InvenTree-Version: 0.17.0 dev
Django Version: 4.2.17
Commit Hash: 88ab593
Commit Date: 16-12-2024

Database: postgresql
Debug-Mode: False
Deployed using Docker: True
Platform: Linux-5.15.0-100-generic-x86_64-with
Installer: DOC

Active plugins: False

Please verify if you can reproduce this bug on the demo site.

  • I can reproduce this bug on the demo site.

Relevant log output

@miggland miggland added bug Identifies a bug which needs to be addressed question This is a question triage:not-checked Item was not checked by the core team labels Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Identifies a bug which needs to be addressed question This is a question triage:not-checked Item was not checked by the core team
Projects
None yet
Development

No branches or pull requests

1 participant