I'm trying to apply default_order to a tree view for multiple fields.
Or
rather, I'm looking to (1) make lines drag & droppable while also
(2) sort them by date_planned_start. But if they're sorted by (2), they
aren't (1), and if they're (1), they aren't (2).
Description:
More
specifically, I'm trying to make the lines in mrp.production drag &
droppable via a "sequence" field, but at the same time order the lines
by date_planned_start.
Going by the documentation, this shouldn't be
an issue (as both Odoo 8.0 and 13.0 Doc example show
default_order="sequence, name desc", more or less exactly what I'm
trying to accomplish.)
But adding:
_order = 'sequence, date_planned_start'
to the model does nothing.
Adding an xpath to the tree attribute using:
<attribute name="default_order">sequence, date_planned_start</attribute>
does
order the view, but only according to the first field supplied, i.e. by
sequence but not date_planned_start. If I reverse the order to
..>date_planned_start, sequence</.., it orders by date, but not by
sequence, and as result the lines are no longer drag & droppable.
As
mentioned, I've referenced the official documentation, and by the looks
of it, this should be quite possible, as it's almost the exact example
given. But for some reason, it doesn't work.
Issue:
Only the first field given in the default_order attribute is sorted. The other isn't.
(Relevant) Code:
View:
<record id="inherited_mrp_production_tree_view" model="ir.ui.view">
Model:
Ah, and don't pay any mind to the two fields given in the view code (date_planned_start, date_start_wo), just me playing around trying to get it to work, but forgot to update the code for the example.