Skip to Content
Odoo Menu
  • Sign in
  • Try it free
  • Apps
    Finance
    • Accounting
    • Invoicing
    • Expenses
    • Spreadsheet (BI)
    • Documents
    • Sign
    Sales
    • CRM
    • Sales
    • POS Shop
    • POS Restaurant
    • Subscriptions
    • Rental
    Websites
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Supply Chain
    • Inventory
    • Manufacturing
    • PLM
    • Purchase
    • Maintenance
    • Quality
    Human Resources
    • Employees
    • Recruitment
    • Time Off
    • Appraisals
    • Referrals
    • Fleet
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Events
    • Marketing Automation
    • Surveys
    Services
    • Project
    • Timesheets
    • Field Service
    • Helpdesk
    • Planning
    • Appointments
    Productivity
    • Discuss
    • Approvals
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industries
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Beverage Distributor
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architecture Firm
    • Construction
    • Estate Management
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Manufacturing
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Community
    Learn
    • Tutorials
    • Documentation
    • Certifications
    • Training
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Download
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Events
    • Translations
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
    • Meet an advisor
    • Implementation Services
    • Customer References
    • Support
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Get a demo
  • Pricing
  • Help

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Accounting
  • Inventory
  • PoS
  • Project
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
Help

How to restrict dragging of kanban stages?

Subscribe

Get notified when there's activity on this post

This question has been flagged
stageskanbankanban_state
7 Replies
29284 Views
Avatar
Deborah Joy Adeva

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?

3
Avatar
Discard
Avatar
Niyas Raphy (Walnut Software Solutions)
Best Answer

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

3
Avatar
Discard
Avatar
Bréndou Serge Eric
Best Answer

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')
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
return super(YOUR CLASS, self).write(values)
for stages of type Many2one, you would need to use the ids for comparison. eg:
current_stage = self.stage_id
new_stage_id = values.get('stage_id')
if new_stage_id == self.env.ref('your_module.xml_id_of_your_stage').id:
     raise UserError(_('Message here'))

1
Avatar
Discard
Avatar
Chris TRINGHAM
Best Answer

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!')

Odoo 14

Note that the syntax is slightly different in Odoo 14

raise UserError('Please check Legal Approval for this Opportunity!')

Results

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. 

1
Avatar
Discard
Avatar
Avinash Nk
Best Answer

Hi,

You can check that in the write function of the model. and raise an error.

for eg:

@api.multi
def write(self, values):
if (YOUR CONDITION):
            raise ValidationError(_("You can't perform that move !"))
return super(YOUR CLASS, self).write(values)

Thank you.

0
Avatar
Discard
Deborah Joy Adeva
Author

can you give me an example of condition to put. I don't know how to start. thank you in advance

Niyas Raphy (Walnut Software Solutions)

check this module : https://www.odoo.com/apps/modules/10.0/crm_drag_back_permission/

Avatar
Pedro Vagner
Best Answer

What about:

<field name="stage" attrs="{'readonly': [('group_ids','in',[g.id for g in user.groups_id])]}"/> 
0
Avatar
Discard
Avatar
Rachid
Best Answer

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>
0
Avatar
Discard
Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Sign up
Related Posts Replies Views Activity
How to give user permission in kanban stages
stages kanban kanban_state
Avatar
Avatar
1
Dec 17
6589
How to give a group of users access to create and edit kanban stages in odoo?
stages kanban
Avatar
Avatar
2
Jul 24
2547
Move through the stages of kanban
stages kanban
Avatar
Avatar
1
Jan 24
2512
Conditionally hide kanban stage based on view
kanban kanban_state
Avatar
Avatar
3
Apr 20
7280
Limit kanban box Solved
kanban limit kanban_state
Avatar
Avatar
Avatar
2
Sep 25
612
Community
  • Tutorials
  • Documentation
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Translations
Services
  • Odoo.sh Hosting
  • Support
  • Upgrade
  • Custom Developments
  • Education
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Brand Assets
  • Contact us
  • Jobs
  • Events
  • Podcast
  • Blog
  • Customers
  • Legal • Privacy
  • Security
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now