Skip to content
Snippets Groups Projects
Commit 834b38a8 authored by amoyaux's avatar amoyaux
Browse files

[FIX] stock : traceback pivot view for stock moves

Use case when it can happens (non deterministic):
- Enable product variant
- Have different stock moves with the product variant
- Click on the stock moves in the section reports
- Switch to pivot view
-> Traceback : can't find path of null

This happens in the js in the function find_path_in_tree,
this function try to find path for children object. There is
a condition root.children[i].path[l] === path[l] (2 strings
comparaison).

With product variant this condition can be overpass when it should
have been triggered. The product path string is represented as follow
[Ref]Name(variants) -> Sometime the variants in the string do not have
the same order and thus the condition is never true and the function
return null instead of the correct root.

This commit corrects the name_get function for product product
in order to always return the variants in the same order.
parent 07c563e0
No related branches found
No related tags found
No related merge requests found
......@@ -76,7 +76,7 @@ class ProductAttributevalue(models.Model):
@api.multi
def _variant_name(self, variable_attributes):
return ", ".join([v.name for v in self if v.attribute_id in variable_attributes])
return ", ".join([v.name for v in self.sorted(key=lambda r: r.name) if v.attribute_id in variable_attributes])
class ProductAttributePrice(models.Model):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment