Skip to content

[16.0][REF] shopfloor_reception: use generic "find" inside "scan_document"#1172

Open
nicolas-delbovier-acsone wants to merge 2 commits into
OCA:16.0from
acsone:16.0-ref-shopfloor_reception-scan-document-find
Open

[16.0][REF] shopfloor_reception: use generic "find" inside "scan_document"#1172
nicolas-delbovier-acsone wants to merge 2 commits into
OCA:16.0from
acsone:16.0-ref-shopfloor_reception-scan-document-find

Conversation

@nicolas-delbovier-acsone

Copy link
Copy Markdown

The scan_document processing step has been refactored to utilize the find() method from the shopfloor search action component. Previously, the logic manually iterated over the handlers and called the internal _find_record_by_type method directly, bypassing the broader search pipeline.

By shifting this responsibility to the base find method, any standardized barcode preprocessing, custom resolution logic, or GS1-128 parsing injected into the search action component is now fully honored during reception. Furthermore, this provides downstream extending modules with a unified, singular hook point to alter or enrich barcode matching behaviors globally across the app.

@OCA-git-bot

Copy link
Copy Markdown
Contributor

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

@OCA-git-bot OCA-git-bot added series:16.0 mod:shopfloor_reception Module shopfloor_reception labels Jun 2, 2026
@nicolas-delbovier-acsone

Copy link
Copy Markdown
Author

@jbaudoux

Comment thread shopfloor_reception/services/reception.py Outdated
Comment thread shopfloor_reception/services/reception.py Outdated
Comment thread shopfloor_reception/services/reception.py Outdated
@nicolas-delbovier-acsone nicolas-delbovier-acsone force-pushed the 16.0-ref-shopfloor_reception-scan-document-find branch from 542ba9c to b1ed091 Compare June 3, 2026 08:17
Comment thread shopfloor_reception/services/reception.py Outdated
Comment thread shopfloor_reception/services/reception.py Outdated

@mmequignon mmequignon left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree on the the generic find, not on current's implementation.
This needs a little rework, I believe.

"origin_move": self._scan_document__by_origin_move,
}
# only add the handler if scan_location_or_pack_first is disabled
if not self.work.menu.scan_location_or_pack_first:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand this commit, but I believe you're fixing a non-issue.
And introducing a bug, as @jbaudoux stated in a comment.
We need to keep that order as it is in order to not break current's behavior.
Having if not handler: continue in scan_document is fine to me.
Or return {key: value for key, values in handlers_by_type.items() if value} ?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed the implementation in order to keep both the filtering logic and keep the order of the elements in the dict.

Do you agree with this new implementation?

The `scan_document` processing step has been refactored to utilize the `find()` method from the shopfloor search action component.
Previously, the logic manually iterated over the handlers and called the internal `_find_record_by_type` method directly, bypassing the broader search pipeline.

By shifting this responsibility to the base `find` method, any standardized barcode preprocessing, custom resolution logic, or GS1-128 parsing injected into the search action component is now fully honored during reception.
Furthermore, this provides downstream extending modules with a unified, singular hook point to alter or enrich barcode matching behaviors globally across the app.
… + documentation

This prevents downstream logic from having to handle inactive
handlers sequentially during scan evaluation.
@nicolas-delbovier-acsone nicolas-delbovier-acsone force-pushed the 16.0-ref-shopfloor_reception-scan-document-find branch from b1ed091 to 8c56755 Compare June 3, 2026 12:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mod:shopfloor_reception Module shopfloor_reception series:16.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants