宜兴通达竭诚为您服务。

通达科技 - 宜兴电脑维护及IT服务外包服务商

Manage kanban stages
  • 上传者: Administrator
  • 上传时间:2025年05月03日 06时32分30秒
摘要:
* Manage kanban stages ** *** The kanban view in Odoo provides the simple and easiest way to use the workflows. It's a kind of view that organizes th ......
正文 相关文章 请喝咖啡

    Manage kanban stages

    The kanban view in Odoo provides the simple and easiest way to use the workflows. It's a kind of view that organizes the records in columns with each stage. Under each stage, the records will be listed; thus, it’s possible to handle the record between these stages quickly.

    Let us see how these stages and the kanban view are created;

    Similar to the definition of form view and tree view, we have to mention the view type of kanban view in action. This can be added as follows;

    <record id="action_mobile_service" model="ir.actions.act_window">

        <field name="name">Mobile Service</field>

        <field name="res_model">mobile.service</field>

        <field name="view_mode">tree,kanban,form</field>

        <field name="help" type="html">

            <p class="o_view_nocontent_smiling_face">

                Add a new analytic account

            </p>

        </field>

     </record>

    Here the view_mode includes the tree, form and kanban views. Now the view definition will be like this;

    <record id="service_request_view_kanban" model="ir.ui.view">

        <field name="name">mobile.service.kanban</field>

        <field name="model">mobile.service</field>

        <field name="arch" type="xml">

            <kanban default_group_by="service_state">

                <field name="service_state"/>

                <templates>

                    <t t-name="kanban-box">

                        <div class="oe_kanban_global_click">

                            <div class="oe_kanban_content">

                                <div class="oe_kanban_card">

                                    <div>

                                        <b>

                                            <field name="name"/>

                                        </b>

                                    </div>

                                    <div class="text-muted">

                                        <field name="partner_id" widget="res_partner_many2one"/>

                                    </div>

                                </div>

                            </div>

                        </div>

                    </t>

                </templates>

            </kanban>

        </field>

     </record>

    This is a basic kanban view definition. Apart from this, more classes and attributes are available to enhance it.

    As mentioned above, the kanban view contains records in a card along with their states. Kanban states are really useful, and the records of each state will be draggable. For showing the states in the kanban view, we have to use the attribute ‘group_expand.’ By using this attribute on the field declaration, the kanban view will display the states even though no records are available on the state. So let’s set how it’s defined;

    service_state = fields.Selection([('draft', 'Draft'), ('assigned', 'Assigned'),

                                     ('completed', 'Completed'), ('returned', 'Returned'),

                                     ('not_solved', 'Not solved')],

                                    string='Service Status', group_expand='_group_expand_states',

                                    default='draft', track_visibility='always')

    As you can see, the attribute group_expand contains a function named ‘_group_expand_states.’ It’s defined as follows;

    def _group_expand_states(self, states, domain, order):

       return [key for key, val in type(self).service_state.selection]

    This function returns a list of states; thus, here, the function tries to pass all the selection fields in the list form to the method ‘group_expand.’ In the XML, the state field is defined as a normal field definition; here, we have defined it in the above example.

    After following these things, the kanban view and its states will be as given below.

     

    Progress bar in kanban view

    Progress bar is another feature of the kanban view. Sometimes it is difficult to understand the states if the records are huge in number. Here the progress bar will help show each state's status on top of it. Let’s check how it’s defined; Here, as an example, the progress bar is based on the field priority;

    priority = fields.Selection([('0', 'Normal'),('1', 'Low'),('2', 'High'),('3', 'Very High')], string="Priority")

    Three attributes are there used in the progress bar they are field, colors and sum_field

    Field: The progress bar is shown based on the value of this field.

    Colors: Mainly, there are four colors to assign to the values of the field. They are a success, warning, danger, and info.

    Sum_field: This is an optional field for displaying the sum of any field in the record.

    The progress bar is defined in the XML using the tag <progressbar>.

     <progressbar field="priority" colors='{"3": "success", "2": "warning", "1": "danger", "0": "info"}'/>

    Once the module is upgraded after adding the progress bar the kanban view will look like this;

     

    While placing the mouse over the progress bar you can see the records belong to this field and the total number of the records will be displayed right to the column. This is by default, and if you want to show the sum of a particular field in a record, then it can be achieved by the attribute ‘sum_field’, but this is optional.

    本文章从网上收集,如有侵权请联系tderp@tderp.com删除
  • 微信扫一扫,一分也是爱:
  • 微信

服务原则及地区范围

宜兴通达网络科技有限公司,地处中国宜兴环科园内,是一家高新技术企业。公司在企业网络维护和企业信息化建设与咨询方面,有10多年经验。

我公司愿与客户一道,力求彻底解决客户问题!
我们不是在给企业提供“头痛医头、脚痛医脚”的暂时解决方案,而是在部署根本性安全与稳定服务!!
我们愿携手客户,建立企业IT规划;杜绝随意安装系统、软件等操作;力求共同维护有序、安全、稳定的网络办公环境!!!
IT服务,服务是根本,客户是上帝;我们提供快速响应、快速上门、快速排查,提供优质高效的服务!!!!

通达科技提供全国范围内的服务,服务形式包括远程协助、电话咨询、电子邮件咨询、传真咨询、问答平台的问题解决等。

宜兴地区提供上门服务:

  • 市区服务:宜城街道、城北街道(屺亭街道)、新街街道、新庄街道、环科园、渚桥开发区
  • 市郊服务:张渚镇、西渚镇、太华镇、徐舍镇、官林镇、杨巷镇、新建镇、和桥镇、高塍镇、万石镇、周铁镇、芳桥镇、丁蜀镇、湖父镇。
  • 联系电话:189-21-343434
  • 在线沟通: