Skip to Content
Menú
This question has been flagged
2 Respostes
431 Vistes

<kanban default_group_by="stage_id" class="o_kanban_small_column o_opportunity_kanban" on_create="quick_create" quick_create_view="crm.quick_create_opportunity_form" archivable="false" sample="1">
                    <field name="stage_id" options="{&quot;group_by_tooltip&quot;: {&quot;requirements&quot;: &quot;Description&quot;}}"/>
                    <field name="probability"/>
                    <field name="color"/>
                    <field name="priority"/>
                    <field name="expected_revenue"/>
                    <field name="kanban_state"/>
                    <field name="activity_date_deadline"/>
                    <field name="user_email"/>
                    <field name="user_id"/>
                    <field name="partner_id"/>
                    <field name="activity_summary"/>
                    <field name="active"/>
                    <field name="company_currency"/>
                    <field name="activity_state"/>
                    <field name="activity_ids"/>
                    <progressbar field="activity_state" colors="{&quot;planned&quot;: &quot;success&quot;, &quot;today&quot;: &quot;warning&quot;, &quot;overdue&quot;: &quot;danger&quot;}" sum_field="expected_revenue" help="This bar allows to filter the opportunities based on scheduled activities."/>
                    <templates>
                        <t t-name="kanban-box">
                            <t t-set="lost_ribbon" t-value="!record.active.raw_value and record.probability and record.probability.raw_value == 0"/>
                            <div t-attf-class="#{!selection_mode ? kanban_color(record.color.raw_value) : ''} #{lost_ribbon ? 'oe_kanban_card_ribbon' : ''} oe_kanban_global_click oe_kanban_card d-flex flex-column">
                                <div class="ribbon ribbon-top-right" attrs="{'invisible': ['|', ('probability', '&gt;', 0), ('active', '=', True)]}">
                                    <span class="bg-danger">Lost</span>
                                </div>

                                <div class="o_dropdown_kanban dropdown">
                                    <a class="dropdown-toggle o-no-caret btn" role="button" data-toggle="dropdown" data-display="static" href="#" aria-label="Dropdown menu" title="Dropdown menu">
                                        <span class="fa fa-ellipsis-v"/>
                                    </a>
                                    <div class="dropdown-menu" role="menu">
                                        <t t-if="widget.editable"><a role="menuitem" type="edit" class="dropdown-item">Edit</a></t>
                                        <t t-if="widget.deletable"><a role="menuitem" type="delete" class="dropdown-item">Delete</a></t>
                                        <ul class="oe_kanban_colorpicker" data-field="color"/>
                                    </div>
                                </div>
                                <div class="oe_kanban_content flex-grow-1">
                                    <div class="o_kanban_record_title oe_kanban_details">
                                        <strong><field name="name"/></strong>
                                    </div>
                                    <div class="o_kanban_record_subtitle">
                                        <t t-if="record.expected_revenue.raw_value">
                                            <field name="expected_revenue" widget="monetary" options="{'currency_field': 'company_currency'}"/>
                                            <span t-if="record.recurring_revenue and record.recurring_revenue.raw_value"> + </span>
                                        </t>
                                        <t t-if="record.recurring_revenue and record.recurring_revenue.raw_value">
                                            <field name="recurring_revenue" widget="monetary" options="{'currency_field': 'company_currency'}"/>
                                            <field name="recurring_plan"/>
                                        </t>
                                    </div>
                                    <div>
                                        <span class="o_text_overflow" t-if="record.partner_id.value" t-esc="record.partner_id.value"/>
                                    </div>
                                    <div>
                                        <field name="tag_ids" widget="many2many_tags" options="{'color_field': 'color'}"/>
                                    </div>
                                </div>
                                <div class="oe_kanban_footer">
                                    <div class="o_kanban_record_bottom">
                                        <div class="oe_kanban_bottom_left">
                                            <field name="priority" widget="priority" groups="base.group_user"/>
                                            <field name="activity_ids" widget="kanban_activity"/>
                                        </div>
                                        <div class="oe_kanban_bottom_right">
                                            <field name="user_id" widget="many2one_avatar_user"/>
                                        </div>
                                    </div>
                                </div>
                                <div class="oe_clear"/>
                            </div>
                        </t>
                    </templates>
                </kanban>
           

above is the original code on CRM kanban, I want each column to be immovable. I have tried with 'records_draggable="false"' but it doesn't work. The Odoo I am using is Odoo 15. Are there any other alternatives that can help?


Avatar
Descartar
Best Answer

Hi,


Please add records_draggable="0" into the kanban tag of kanban view to disable drag and drop the records.


Try with the following

<kanban default_group_by="stage_id" class="o_kanban_small_column o_opportunity_kanban" on_create="quick_create" quick_create_view="crm.quick_create_opportunity_form" archivable="false" sample="1" records_draggable="0">


Reference:


https://www.odoo.com/sl_SI/forum/pomoc-1/disable-drag-and-drop-in-kanban-view-in-odoo-15-212231


https://www.odoo.com/sl_SI/forum/pomoc-1/how-to-restrict-dragging-of-kanban-stages-127256#:~:text=To%20disable%20drag%20drop%20and,into%20the%20tag


Hope it helps

Avatar
Descartar
Best Answer
Hi Aprilia,

Try making the stage_id field readonly.

<xpath expr="//kanban/field[@name='stage_id']" position="attributes">
<attribute name="readonly">True</attribute>
</xpath>

Hope this helps.
Avatar
Descartar
Related Posts Respostes Vistes Activitat
1
de jul. 19
4089
1
de jul. 24
2107
1
d’abr. 20
4446
1
de des. 24
1409
5
de jul. 24
14751