Skip to content

Wrong item purchase price when using Enter #7600

Closed

Description

@dieselburner

Please verify that this bug has NOT been raised before.

  • I checked and didn't find a similar issue

Describe the bug*

When entering purchase order item I use tab and enter keys, and as a result I believe the Auto Pricing is not automatically unchecked when I hit enter after updating item price. As a result, added item loses manually entered price and shows calculated pricing as per supplier price breaks.

Add item:

Screenshot from 2024-07-09 12-23-43

Result:

Screenshot from 2024-07-09 12-19-17

Steps to Reproduce

  1. Create purchase order
  2. Hit Add Line Item
  3. Select Part
  4. Use Tab key to navigate to Puchase Price
  5. Enter required price
  6. Hit Enter key

Expected behaviour

Manually entered purchase price is shown in entered item.

Deployment Method

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

Version Information

Version Information:

InvenTree-Version: 0.15.4
Django Version: 4.2.12
Commit Hash: fa1a9da
Commit Date: 2024-06-16

Database: sqlite3
Debug-Mode: False
Deployed using Docker: True
Platform: Linux-3.10.108-x86_64-with
Installer: DOC

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

  • I can reproduce this bug on the demo site.

Relevant log output

No response

Activity

  1. added
    bug
    question
    triage:not-checked
    on Jul 9, 2024
  2. added
    pricing
    User Interface
    and removed
    triage:not-checked
    on Jul 10, 2024
  3. added this to the 0.16.0 milestone on Jul 10, 2024
  4. SchrodingersGat commented on Jul 10, 2024

    @SchrodingersGat
    Member

    @dieselburner thanks for reporting.

  5. rocheparadox commented on Jul 14, 2024

    @rocheparadox
    Contributor

    @SchrodingersGat , I will try to fix this.

  6. SchrodingersGat commented on Jul 14, 2024

    @SchrodingersGat
    Member
  7. rocheparadox commented on Jul 14, 2024

    @rocheparadox
    Contributor

    This issue arises due to the underlying model of the events of forms as defined in forms.js

    The jquery documentation for the change event goes as follows

    For select boxes, checkboxes, and radio buttons, the event is fired immediately when the user makes a selection with the mouse, but for the other element types the event is deferred until the element loses focus.

    Hence, the purchase price is not updated until it loses the focus (using mouse or tab key). Now, changing the
    el.change(function(){}) to el.on('input', function(){})
    will fix this issue but I am a bit skeptical about it since this will affect all the other elements throughout the codebase. I can add a new trigger call onInput like the onEdit is defined in forms.js

    * - onEdit: callback or array of callbacks which get fired when field is edited

    Since this is more of a design decision, I would like to get your opinion, @SchrodingersGat and @matmair . Thanks.

  8. SchrodingersGat commented on Jul 15, 2024

    @SchrodingersGat
    Member

    @rocheparadox I think your second simpler approach would be best. However please note that we are in the middle of a huge refactor of the front-end interface (moving to react).

    So, new features for the legacy UI will not be given priority. If you can provide a low-risk bug fix for this, I'm happy to review and merge that. However if you can also check functionality on the new interface that would be appreciated !

  9. rocheparadox commented on Jul 15, 2024

    @rocheparadox
    Contributor

    @SchrodingersGat, Sure. I will stick with the second option then. I am not a frontend developer and have little to no experience with react. Since, I am familiar with js, I thought I would fix it. I am looking forward to contribute more in python.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

User Interfacebugpricingquestion

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions