Skip to content
Snippets Groups Projects

Introduces sorting capabilities within the Redner substitution

Merged oury.balde requested to merge topic/16.0/MO16-00807 into branch/16.0
5 files
+ 223
2
Compare changes
  • Side-by-side
  • Inline
Files
5
@@ -24,6 +24,7 @@ from odoo.exceptions import ValidationError
from odoo.addons import converter
from ..converter import ImageDataURL, ImageFile
from ..utils.sorting import find_field_with_sort_order, sortkey
class Substitution(models.Model):
@@ -99,9 +100,13 @@ class Substitution(models.Model):
elif sub.converter == "image-data-url":
conv = ImageDataURL(sub.value)
elif sub.converter == "relation-to-many":
# Unpack the result of finding a field with its sort order into
# variable names.
value, sorted = find_field_with_sort_order(sub.value)
conv = converter.RelationToMany(
sub.value,
value,
None,
sortkey=sortkey(sorted) if sorted else None,
converter=sub.get_children().build_converter(),
)
elif sub.converter == "relation-path":
Loading