-
-
Notifications
You must be signed in to change notification settings - Fork 484
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
[14.0][MIG] mrp_lot_number_propagation #1382
[14.0][MIG] mrp_lot_number_propagation #1382
Conversation
Currently translated at 100.0% (22 of 22 strings) Translation: manufacture-15.0/manufacture-15.0-mrp_lot_number_propagation Translate-URL: https://translation.odoo-community.org/projects/manufacture-15-0/manufacture-15-0-mrp_lot_number_propagation/it/
When defining a single BOM for a product template having multiple product variants, we can have different components where the lot number must be propagated for different product variants. Therefore we need to allow to mark multiple BOM line with propagate_lot_number, and to avoid complicating the check function on the BOM lines, we ensure at the manufacturing order confirmation that only a single component is set to propagate its lot number.
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: manufacture-15.0/manufacture-15.0-mrp_lot_number_propagation Translate-URL: https://translation.odoo-community.org/projects/manufacture-15-0/manufacture-15-0-mrp_lot_number_propagation/
Currently translated at 100.0% (23 of 23 strings) Translation: manufacture-15.0/manufacture-15.0-mrp_lot_number_propagation Translate-URL: https://translation.odoo-community.org/projects/manufacture-15-0/manufacture-15-0-mrp_lot_number_propagation/it/
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: manufacture-15.0/manufacture-15.0-mrp_lot_number_propagation Translate-URL: https://translation.odoo-community.org/projects/manufacture-15-0/manufacture-15-0-mrp_lot_number_propagation/
Currently translated at 100.0% (24 of 24 strings) Translation: manufacture-15.0/manufacture-15.0-mrp_lot_number_propagation Translate-URL: https://translation.odoo-community.org/projects/manufacture-15-0/manufacture-15-0-mrp_lot_number_propagation/it/
Currently translated at 100.0% (24 of 24 strings) Translation: manufacture-15.0/manufacture-15.0-mrp_lot_number_propagation Translate-URL: https://translation.odoo-community.org/projects/manufacture-15-0/manufacture-15-0-mrp_lot_number_propagation/it/
Currently translated at 100.0% (24 of 24 strings) Translation: manufacture-15.0/manufacture-15.0-mrp_lot_number_propagation Translate-URL: https://translation.odoo-community.org/projects/manufacture-15-0/manufacture-15-0-mrp_lot_number_propagation/es/
Currently translated at 100.0% (24 of 24 strings) Translation: manufacture-15.0/manufacture-15.0-mrp_lot_number_propagation Translate-URL: https://translation.odoo-community.org/projects/manufacture-15-0/manufacture-15-0-mrp_lot_number_propagation/it/
Currently translated at 100.0% (24 of 24 strings) Translation: manufacture-15.0/manufacture-15.0-mrp_lot_number_propagation Translate-URL: https://translation.odoo-community.org/projects/manufacture-15-0/manufacture-15-0-mrp_lot_number_propagation/it/
22fcef6
to
6631534
Compare
if ( | ||
line.product_id.tracking == "serial" | ||
and tools.float_compare( | ||
line.product_qty, 1, precision_rounding=line.product_uom_id.rounding |
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.
I have an error here when testing on runboat:
Odoo Server Error
Traceback (most recent call last):
File "/opt/odoo/odoo/addons/base/models/ir_http.py", line 237, in _dispatch
result = request.dispatch()
File "/opt/odoo/odoo/http.py", line 696, in dispatch
result = self._call_function(**self.params)
File "/opt/odoo/odoo/http.py", line 370, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/opt/odoo/odoo/service/model.py", line 94, in wrapper
return f(dbname, *args, **kwargs)
File "/opt/odoo/odoo/http.py", line 358, in checked_call
result = self.endpoint(*a, **kw)
File "/opt/odoo/odoo/http.py", line 919, in __call__
return self.method(*args, **kw)
File "/opt/odoo/odoo/http.py", line 544, in response_wrap
response = f(*args, **kw)
File "/opt/odoo/addons/web/controllers/main.py", line 1370, in call_kw
return self._call_kw(model, method, args, kwargs)
File "/opt/odoo/addons/web/controllers/main.py", line 1362, in _call_kw
return call_kw(request.env[model], method, args, kwargs)
File "/opt/odoo/odoo/api.py", line 406, in call_kw
result = _call_kw_multi(method, model, args, kwargs)
File "/opt/odoo/odoo/api.py", line 391, in _call_kw_multi
result = method(recs, *args, **kwargs)
File "/opt/odoo/odoo/models.py", line 6266, in onchange
snapshot0 = Snapshot(record, nametree, fetch=(not first_call))
File "/opt/odoo/odoo/models.py", line 6110, in __init__
self.fetch(name)
File "/opt/odoo/odoo/models.py", line 6120, in fetch
self[name] = record[name]
File "/opt/odoo/odoo/models.py", line 5727, in __getitem__
return self._fields[key].__get__(self, self.env.registry[self._name])
File "/opt/odoo/odoo/fields.py", line 1043, in __get__
self.compute_value(recs)
File "/opt/odoo/odoo/fields.py", line 1199, in compute_value
records._compute_field_value(self)
File "/opt/odoo/odoo/models.py", line 4089, in _compute_field_value
odoo.fields.determine(field.compute, self)
File "/opt/odoo/odoo/fields.py", line 83, in determine
return needle(*args)
File "/mnt/data/odoo-addons-dir/mrp_lot_number_propagation/models/mrp_bom_line.py", line 25, in _compute_display_propagate_lot_number
line.bom_id.display_lot_number_propagation
File "/opt/odoo/odoo/fields.py", line 1043, in __get__
self.compute_value(recs)
File "/opt/odoo/odoo/fields.py", line 1199, in compute_value
records._compute_field_value(self)
File "/opt/odoo/addons/mail/models/mail_thread.py", line 410, in _compute_field_value
return super()._compute_field_value(field)
File "/opt/odoo/odoo/models.py", line 4089, in _compute_field_value
odoo.fields.determine(field.compute, self)
File "/opt/odoo/odoo/fields.py", line 83, in determine
return needle(*args)
File "/mnt/data/odoo-addons-dir/mrp_lot_number_propagation/models/mrp_bom.py", line 51, in _compute_display_lot_number_propagation
and bom._has_tracked_product_to_propagate()
File "/mnt/data/odoo-addons-dir/mrp_lot_number_propagation/models/mrp_bom.py", line 63, in _has_tracked_product_to_propagate
and tools.float_compare(
File "/opt/odoo/odoo/tools/float_utils.py", line 155, in float_compare
rounding_factor = _float_check_precision(precision_digits=precision_digits,
File "/opt/odoo/odoo/tools/float_utils.py", line 29, in _float_check_precision
assert precision_rounding is None or precision_rounding > 0,\
Exception
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/opt/odoo/odoo/http.py", line 652, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/opt/odoo/odoo/http.py", line 317, in _handle_exception
raise exception.with_traceback(None) from new_cause
AssertionError: precision_rounding must be positive, got 0.0
The rounding is set on the UOM, the UOM is set on the product, but it seems not to be set on the BOM line before the computation.
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.
I tested on the customer instance without error when opening the PR.
I am not sure how to reproduce this one, but I just pushed a fixup that could fix the problem.
If the error is still present it would be good if we can test together.
Thanks for the review.
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.
As discussed, this was a bug in mrp_bom_attribute_match
as default value must be set by the onchange before the user selects the product.
This will be fixed by #1390 so you can keep the code as it was.
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.
Looks good, one question though
@@ -152,6 +152,13 @@ def write(self, vals): | |||
) | |||
return super().write(vals) | |||
|
|||
def action_generate_serial(self): |
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.
Why is this override needed? I don't see much difference with 15.0 where this function is not overridden, could it be a bug in 15.0?
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.
It kind of made sense at the time of porting, but you may be right that this is not needed.
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.
I did and squashed the commits
8cc9bf4
to
f9ac866
Compare
/ocabot merge nobump |
What a great day to merge this nice PR. Let's do it! |
Congratulations, your PR was merged at ddb4e88. Thanks a lot for contributing to OCA. ❤️ |
Backport from 15.0