For example:
the officer can only drag from
Draft > Confirmed
and the manager can drag from
Confirmed > Approved or Rejected
If they are not permitted to for the stages they can't drag any data from one stage to another.
Is there a way for this?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
For example:
the officer can only drag from
Draft > Confirmed
and the manager can drag from
Confirmed > Approved or Rejected
If they are not permitted to for the stages they can't drag any data from one stage to another.
Is there a way for this?
Hi,
To Restrict drag and drop in the kanban view in Odoo10, 11 and 12, you can use this free module from the store: https://apps.odoo.com/apps/modules/11.0/kanban_draggable/
To disable drag drop record between columns add:
disable_drag_drop_record="true" into the <kanban> tag.
To disable drag drop and sorting records add :
disable_sort_record="true" into the <kanban> tag.
To disable sorting columns add :
disable_sort_column="true" into the <kanban> tag.
Example:
<kanban disable_sort_column='true' disable_sort_record='true' disable_drag_drop_record='true'>
...
...
</kanban>
From odoo13, we have an option by default to do this. Set records_draggable to False.
``records_draggable``
whether it should be possible to drag records when kanban is grouped. Default: true.
See the Video Explaining the same: How to Disable Drag and Drop in Odoo Kanban View
Thanks
Hello! Here is an example for the case your stage field is a Selection with this values [('draft','Draft'), ('confirm','Confirmed'), ('approved','Approved'),('rejected','Rejected')]:
@api.multi
def write(self, values):
if 'state' in values:previous_state = self.state new_state = values.get('state')return super(YOUR CLASS, self).write(values)
if (new_state in ['approved','rejected']) and (not self.env.user.has_group('your_module.your_group_xml_id')):
raise ValidationError(_("Only Managers can perform that move !"))
#elif some other_conditions:
#some other logics
It's also possible with Automated Actions, as explained here (this is a more complex example with validation, but it could be simplified):
This example has a “Financial Viability” check and a “Legal Approval” check that are mandatory before the Lead / Opportunity can be moved to one of the later stages.
Start by creating an Automated Action:
Python Code
# Require Financial Viability
if record.stage_id.name in ['Qualified', 'Proposition', 'Won'] and not record.x_studio_financial_viability:
raise Warning('Please check Financial Viability for this Opportunity!')
# Require Legal Approval
if record.stage_id.name in ['Proposition', 'Won'] and not record.x_studio_legal_approval:
raise Warning('Please check Legal Approval for this Opportunity!')
Note that the syntax is slightly different in Odoo 14
raise UserError('Please check Legal Approval for this Opportunity!')
Set the “Financial Viability” as checked, and stage can be changed:
Validation is done when the stage is changed in the Kanban view (as above).
It’s also done in the Form View:
The check will be done everywhere and cannot be overridden.
Hi,
You can check that in the write function of the model. and raise an error.
for eg:
@api.multi |
Thank you.
can you give me an example of condition to put. I don't know how to start. thank you in advance
check this module : https://www.odoo.com/apps/modules/10.0/crm_drag_back_permission/
What about:
<field name="stage" attrs="{'readonly': [('group_ids','in',[g.id for g in user.groups_id])]}"/>
you can stop that by modifying the attribute of stage_id for example
<field name="stage_id" position="attributes">
<attribute name="readonly">True</attribute>
</field>