for Products we added new relation to a custom Model ("Text-Line"). So in ech Product a user can add many single Text-Lines.
now the user should be able to "resort" the associated Text-Lines. For this reason we added a Integer Field "SortOrder" to the Model "Text-Line". In the Listview of the Textlines the User should be able to Move a Text-Line Up/Down with an arrow.
Is there any simple way in Odoo (or do you know any already existing Module/Addon) that uses such functionality to change the position/sorting of a related Module?
Define field in py file as:
_name = 'Text-Line'
_order = 'sequence'
sequence = fields.Integer(string='Sequence', default=1)
In the tree view of Text-Line in Products form: (text_line is the field defined in product form)
<field name="text_line" mode="tree,kanban"
<tree string="Text Lines" >
<field name="sequence" widget="handle"/>
i tried that and the sqeunce field was added to the model. In DB the field increments correctly.
BUT: in the treeview the widget="handle" only adds an empty row. i can not drag/drop each row. if i click on that cell it opens a popup with the data of the text-line-Model.
UPDATE: myMistake --> in edit-view it works perfect.
Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!
About This Community
|Asked: 11/3/16, 9:06 AM|
|Seen: 109 times|
|Last updated: 11/7/16, 1:28 AM|