Thanks to visit codestin.com
Credit goes to Github.com

Skip to content

[16.0][REF] shopfloor_reception/mobile: buffer lot inputs in UI#1128

Open
nicolas-delbovier-acsone wants to merge 28 commits intoOCA:16.0from
acsone:16.0-ref-shopfloor_reception-set_lot
Open

[16.0][REF] shopfloor_reception/mobile: buffer lot inputs in UI#1128
nicolas-delbovier-acsone wants to merge 28 commits intoOCA:16.0from
acsone:16.0-ref-shopfloor_reception-set_lot

Conversation

@nicolas-delbovier-acsone
Copy link

@nicolas-delbovier-acsone nicolas-delbovier-acsone commented Feb 3, 2026

Previously, the set_lot function/endpoint previously carried too many responsibilities and could be called in different contexts (only a name, only a date, both). Moreover, the "set_lot" state in the shopfloor "reception" scenario called this backend endpoint immediately upon scanning a lot name or picking a date. This "eager" synchronization often resulted in:

  • Partial Data: The backend receiving a lot name without an expiry date (or vice versa), which bypassed or complicated validation logic.
  • Ghost Records: Useless stock.lot records were created in the database even if the user realized they scanned the wrong barcode or made a typo before finishing the step.

Main Changes

This PR refactors the synchronization logic between the VueJS frontend and the Odoo backend to move from an incremental update pattern to an atomic confirmation pattern. The main changes includes:

  • Local Buffering: User inputs (Lot Name and Expiry Date) are now stored locally in the component state before being sent to the backend on button click.
  • Atomic Call: The backend function responsible for creating the lot is now triggered only once when the user clicks the "Continue" button.
  • Real-time UI: The item-detail-card is updated reactively to reflect the buffered values, providing immediate visual feedback without touching the database.

Also includes

  • Use ISO format for communicating lot expiration date
  • Prevent user from changing an existing expiration date on an existing lot
  • Prevent user from creating a lot if the picking type does not allow it
  • Skip set_lot screen if lot info has been found from parsing barcode
  • Fix button cancel not doing anything in "set_quantity"

This PR is a rework of: #1072

…er readibility

Reorganized the template structure to ensure the date-picker is positioned adjacent to its related components inside the "set_lot" template.
- Merge `set_lot_confirm_action` and `set_lot` endpoints so as to call only one endpoint
- Ensures lot is not created in DB until proven valid
- Add expired expiration date check
@OCA-git-bot
Copy link
Contributor

Hi @JuMiSanAr, @mmequignon,
some modules you are maintaining are being modified, check this out!

@nicolas-delbovier-acsone
Copy link
Author

@jbaudoux

@nicolas-delbovier-acsone
Copy link
Author

nicolas-delbovier-acsone commented Feb 3, 2026

This PR is a rework of: #1072

Update the 'set_lot' state logic to store user input locally on the
active move line before calling the backend.

Crucially, this ensures the 'set_lot' function is now called with both
'expiration_date' and 'lot_name' at the same time upon confirmation.
This prevents premature backend calls with partial data and allows
for better validation of the lot on the server.
Updated unit tests to be resistant to changes in product data serialization.
Previously, tests used a hard-coded dict, which caused failures when
other modules modified the product's serialized fields.
Add an endpoint to call on lot name scan. This enables to detect already existing lots.
This endpoint could also be used to add logic to extract extra infos from barcode such as expiration date.
When a user provides a lot name but forgets the expiration date, the `lot_name` was previously lost
in the response.

This change ensures that `lot_name` is included in the returned
data, allowing the UI to retain the value and
preventing the user from having to re-type it.
The frontend was sending expiration dates in the user's local timezone. Because Odoo expects datetime values in UTC, this caused "hour shifts" that could move the expiration date to the previous day in the database.

This fix ensures that the selected date is treated as local midnight and converted to the corresponding UTC timestamp before being sent to the server.
…display

Updated the lot expiration display to show only the date component. Since the selection widget is restricted to dates, displaying the time was redundant.
…trings

- Rename internal methods to follow standard naming conventions, ensuring compatibility for downstream modules inheriting from this component.
- Updated docstrings to accurately reflect method behavior.
@nicolas-delbovier-acsone nicolas-delbovier-acsone force-pushed the 16.0-ref-shopfloor_reception-set_lot branch 2 times, most recently from 940bf2f to 464dc81 Compare February 24, 2026 09:51
The 'UTC=timezone.utc' alias was introduced in Python 3.11.
To maintain support for environments running Python 3.10,  the alias is added manually at the beginning of the file
Enforce the 'use_create_lots' setting from the picking type during the
reception process.
… screen

The logic for the cancel action was defined, but the event listener
was missing from the button template.
When a lot name is present on the move line, the system now attempts to find a matching existing
lot record. If found, the lot metadata is sent to the frontend to
pre-fill the screen, preventing redundant data entry.
Update '_response_for_set_lot' to check if lot information was already
resolved during parsing. If the parsed data is complete, the system now
bypasses the 'set_lot' entry screen and processes the confirmation
automatically.
@nicolas-delbovier-acsone nicolas-delbovier-acsone force-pushed the 16.0-ref-shopfloor_reception-set_lot branch from 464dc81 to 3ad00c8 Compare February 24, 2026 13:44
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

Successfully merging this pull request may close these issues.

2 participants