Post by Terence »

In that case I would do it like this, forget about silenceInitialCommit. That will not work.

1) Just add an onLoad listener on the project and send all sequenceNumbers to a controller handler and save it. Like:

export default class Project extends ProjectModel {

construct(...args) {
    super.construct(...args);
    this.projectIds = window.o_gantt.projectID === 0 ? [] : [window.o_gantt.projectID];
    this.loadProjectsOnly = false;

    this.on('load', () => {
        const data = [];
        this.taskStore.forEach(task => {
            data.push({ id: task.id, sequenceNumber: task.sequenceNumber });
        });
        
        this.jsonRpc('your_sequence_number_handler', data).then(() => {
            //
        });
    })
}


jsonRpc(url, data) {

  

2) Make a new routing in the controller to handle the saving of your sequence numbers.

Like:

@http.route('/bryntum_gantt/your_sequence_number_handler', type='json', auth='user', cors="*")
    def your_sequence_number_handler(self, data=None, **kw):
        data_json = loads(data)
        
...

I assume you know how to implement this handler yourself, because that is out of the scope of our support. Like adding a new field to the Odoo Task model and save those values in the database etcetera. Most of that is also explained above.

Hope this will help you out.


Post Reply