Ir al contenido
Menú
Se marcó esta pregunta
12 Respuestas
13574 Vistas

Hi ,

Is it possible to block drag event in kanban view. In opportunity i've defined stages and i want the user to only view the opportunities by its stages in kanban view and not to change the stages. i've already made the opportunity statusbar readonly. Kindly clarify me on this.

Avatar
Descartar

I would also like to know how to do this.

Mejor respuesta

"Edit KanbanView" (if the link does not appear, click on the Kanban icon)

Set <kanban edit="false" quick_create="false"

edit="false" disable drag&drop

quick_create="false" disable the + icons

Avatar
Descartar
Mejor respuesta

I managed to do this with a constraint in the code. We haven't found any other way to do this yet.

The constraint basically checks if the user is in an allowed group to do the change that the drag and drop makes to the record.

Avatar
Descartar

Please, can you give me an example how can I block it by constratints? For example for project.task

Autor

Thanks for your reply Carlos. Could you tell me how you've specified the constraint and where? Again Thanks for your time.

carlos, can you explain me how you restricted via the constraints?? i need that

@Carlos: I have the same requirements. Can you please help me to achieve it.

Mejor respuesta


File:  /web_kanban/static/src/js/kanban_view.js

Search the following content

var record_options = _.extend(this.record_options, {
     draggable: draggable,
 });

 Then add following code above that.

var models = ['project.task', 'project.project']; // add more models to be disabled
if(models.includes(this.dataset.model)){
     draggable = false
}
This is working in odoo 10th version.
Avatar
Descartar

Hi Shameem, how do you disable drag and drop for a certain group?

Mejor respuesta

To Disable Drag and Drop of Kanban View  records we need to modify at web_kanban module.

Path : web_kanban/static/src/js

File : kanban_view.js

Modification : Search for the below code

var record_options = _.extend(this.record_options, {
            draggable: draggable,

        });

Then add draggable = false above given block of code like,

draggable = false   [Note : This is the newly added line]
var record_options = _.extend(this.record_options, {
            draggable: draggable,
        });
Avatar
Descartar
Mejor respuesta

Did anyone find a solution for only allowing users in an allowed group to do the change that the drag and drop makes to the record. We would like to put restrictions on users shifting tasks into the task stage "done". Only certain users should be allowed to do that.

Avatar
Descartar
Mejor respuesta

For disable drag&drop on entire kanban use:

<kanban edit="false"  ...


For enable drag&drop on specific card use:

<t t-name="kanban-box"> 
    <t t-if="record.state.raw_value=='draft'">
        <t t-set="dragdrop" t-value="'oe_kanban_draghandle'"/>
    </t>
    <t t-if="record.state.raw_value!='draft'">
        <t t-set="dragdrop" t-value="''"/>
    </t>
    <div t-attf-class="oe_kanban_card oe_kanban_global_click #{dragdrop}">

...


Avatar
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
1
ene 25
1691
1
oct 24
1578
0
ago 22
2564
0
mar 22
2545
9
jul 21
62802