Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

2

Kanban View Readonly For Group In a Specific Kanban Stage

By
Eddy Tan
on 9/17/13, 1:02 AM 1,892 views

I'm developing a kanban View in OpenERP 7 for a restaurant module, The view is to display the food status ordered by customers. currently the stage is:

  • Waiting Queue
  • In Progress
  • Ready to be served
  • Is Served
  • Cancelled

I've created 2 groups :

  • Waiters
  • Chef

When the user's group is waiters , he/she can only modify the record if the stage is 'Ready to be Served'.
For Chef, he/she can only modify a record if the stage is 'Waiting Queue' or 'In Progress'.


How do I set a domain / Access Rights for this kind of situation ? This is my Kanban View's XML:

<record model="ir.ui.view" id="inno_master_kitchen_kanban_view">
        <field name="name">Master Kitchen</field>
        <field name="model">inno.master.kitchen</field>
        <field name="arch" type="xml">
            <kanban default_group_by="state" create="false">
                <field name="state"/>
                <field name="customer_id"/>
                <field name="product_id"/>
                <field name="product_qty"/>
                <field name="table_name"/>
                <field name="order_reference"/>
                <templates>
                    <t t-name="kanban-box">
                      <div class="kitchen_kanban oe_kanban_color_0 oe_kanban_card">
                          <div class="oe_kanban_box_header ">
                                <b><field name="table_name"/></b>
                          </div>
                          <div class="oe_kanban_content">
                              <img style="float:left;" t-att-src="kanban_image('product.product', 'image_medium', record.product_id.raw_value)" class="oe_kanban_image" />
                              <div><b><field name="order_reference"/></b></div>
                              <div><field name="product_id"/></div>
                              <div>
                                <field name="product_qty"/>
                                <field name="product_uom"/>
                              </div>
                              <img style="float:right;" t-att-src="kanban_image('res.partner', 'image_small', record.customer_id.raw_value)" width="24" height="24" t-att-title="record.customer_id.value" class="oe_kanban_avatar" />
                          </div>
                          <div class="oe_clear"></div>
                      </div>
                    </t>
                </templates>
            </kanban>
        </field>
    </record>
0

deep

--deep--
1617
| 5 4 7
Bengaluru, India
--deep--

Techno-Functional Associate with 6+ years of experience in Odoo (formerly known as OpenERP).

deep
On 9/23/16, 6:09 AM

In xml Using Group you cannot control the mode of editing/locking a field, it is used to only controlling where a particular field can be displayed or not.


However in order to achieve your requirement.

Add a boolean-functional field, [store=false], in the function based on the user's group you can evaluate and set the value.

use this boolean flag in the attrs, to set criteria for Readonly

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)

Stats

Asked: 9/17/13, 1:02 AM
Seen: 1892 times
Last updated: 9/23/16, 6:09 AM