-
-
Notifications
You must be signed in to change notification settings - Fork 390
[18.0][IMP] add advisory lock by batch for generation #1075
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
Open
wouitmil
wants to merge
71
commits into
OCA:18.0
Choose a base branch
from
camptocamp:18-add-advisory-lock-by-batch-for-generation
base: 18.0
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
[18.0][IMP] add advisory lock by batch for generation #1075
wouitmil
wants to merge
71
commits into
OCA:18.0
from
camptocamp:18-add-advisory-lock-by-batch-for-generation
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- change name to batch to match with change of `picking_dispatch` name to `stock_batch_picking` - mode description in README.rst - move files in models and views directories - change headers to small license header - use api 8.0 - fix and improve tests
the field has been renamed in the base module
Probably due to usage of multiple environment and cache. datas can't be read from shipping.label but it can be read from ir.attachment
When there is more than 1 pack in a picking, 2 or more thread worker might be in concurrence on the same picking, which makes one of the transaction fails, resulting in the abort of the whole label generation. The solution implemented is to change the way of passing the tasks to the thread workers. Instead of passing a label at a time, we pass a group of label. A group of label actually contains all the labels to generate for one picking.
Co-Authored-By: Alexandre Fayolle <[email protected]>
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: delivery-carrier-14.0/delivery-carrier-14.0-delivery_carrier_label_batch Translate-URL: https://translation.odoo-community.org/projects/delivery-carrier-14-0/delivery-carrier-14-0-delivery_carrier_label_batch/
Currently translated at 2.8% (1 of 35 strings) Translation: delivery-carrier-14.0/delivery-carrier-14.0-delivery_carrier_label_batch Translate-URL: https://translation.odoo-community.org/projects/delivery-carrier-14-0/delivery-carrier-14-0-delivery_carrier_label_batch/es/
Currently translated at 100.0% (35 of 35 strings) Translation: delivery-carrier-14.0/delivery-carrier-14.0-delivery_carrier_label_batch Translate-URL: https://translation.odoo-community.org/projects/delivery-carrier-14-0/delivery-carrier-14-0-delivery_carrier_label_batch/es/
…er_code`
This line has been added by OCA@3b0232d but it looks like the field carrier_code has never been added to the model (or at least it has never been merged in the OCA repo?), thus we get following error when updating the ``carrier_id``:
```
[...]
File "/odoo/src/addons/web/models/models.py", line 1005, in onchange
record._apply_onchange_methods(field_name, result)
File "/odoo/src/odoo/models.py", line 7364, in _apply_onchange_methods
res = method(self)
^^^^^^^^^^^^
File "/odoo/external-src/delivery-carrier/delivery_carrier_label_batch/models/stock_batch_picking.py", line 61, in onchange_carrier_id
self.carrier_code = self.carrier_id.code
^^^^^^^^^^^^^^^^^
AttributeError: 'stock.picking.batch' object has no attribute 'carrier_code'
The above server error caused the following client error:
RPC_ERROR: Odoo Server Error
RPC_ERROR
at makeErrorFromResponse (http://localhost:8069/web/assets/e5ed061/web.assets_web.min.js:3144:163)
at XMLHttpRequest.<anonymous> (http://localhost:8069/web/assets/e5ed061/web.assets_web.min.js:3149:13)
```
… by ``UserError.args[0]`` In the label generation, when getting an error, we were using its ``name``, however, this is deprecated since a while and as been removed in odoo/odoo@d200dcf. We should use ``args[0]`` instead.
… return ``stock.move.line`` records instead of an Iterator All calls to this method expect ``stock.move.line`` records.
Regenerating the carrier labels would crash with a Concurent Update error. We use a new cursor for tracking reference purge and avoid concurrent update when the labels regeneration also updates that field in a separate cursor afterwards: this ensures that the purge is committed before the transactions created by the threads also update and commit their own changes.
Don't spawn more threads than needed: if there are fewer groups to process than the configured max number of threads, only start the specified number of threads.
b703e81 to
6c99e2f
Compare
…visory-lock-by-batch-for-generation
cyrilmanuel
approved these changes
Nov 13, 2025
cyrilmanuel
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not an expert but LGTM
leemannd
reviewed
Nov 17, 2025
91cd4dd to
b090c8f
Compare
1b271d3 to
12863df
Compare
12863df to
2caf2dd
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In order to avoid impatient user to click multiple time to generate new labels for the same batch, I added an advisory lock