Skip to Content
Menu
This question has been flagged
1 Reply
3307 Views

Hi! 

I'm working with a kanban view that I configured from develope mode. I'm managing tickets with default stages in the kanban view. I have a sequence field (TICK-01, TICK-02, etc..), and the problem is when I drag and drop a card from one stage to another it changes the sequence field.

assuming that I have two tickets like this:



When I drag and drop TICK-07 to Assigned, the column orders the cards and changes the sequence field value.



this is the kanban view code that I created: 


 

How can this actually happen?

Thanks in advance!!

Avatar
Discard
Author Best Answer

Hi everyone, I found the solution. I navegated to this path: 

"/usr/lib/python3/dist-packages/odoo/addons/web/static/src/js/views/kanban" wich contains the javascripts files:

the sortable function is located in "kanban_column.js" file that calls another function located in  "kanban_controller.js" file (_resequenceRecords)

The function _resequenceRecords calls a method named "resequence"

This method is in this path: /usr/lib/python3/dist-packages/odoo/addons/web/controllers in the "main.py" python file.

def resequence(self, model, ids, field='sequence', offset=0):

        m = request.env[model]

        if not m.fields_get([field]):

            return False

        for i, record in enumerate(m.browse(ids)):

            record.write({field: i + offset})

        return True

So, I modified this method and my sequence field didn't ever change again.

Hope this helps someone one day!

Avatar
Discard