odoo14、15里tree上加button【系统原生功能】
odoo14、15里面tree视图已经添加了跟form一样的header标签,后面列表写button可以由此处扩展
系统案例:注意:按钮要选择数据后才出现
代码如下:
<tree string="Manufacturing Orders" js_class="lazy_column_list" default_order="priority desc, date_planned_start desc" multi_edit="1" sample="1" decoration-info="state == 'draft'"> <header> <button name="button_plan" type="object" string="Plan"/> <button name="do_unreserve" type="object" string="Unreserve"/> </header> <field name="priority" optional="show" widget="priority" nolabel="1"/> <field name="message_needaction" invisible="1"/> <field name="name" decoration-bf="1"/> <field name="date_planned_start" readonly="1" optional="show" widget="remaining_days"/> <field name="date_deadline" widget="remaining_days" attrs="{'invisible': [('state', 'in', ['done', 'cancel'])]}" optional="hide"/> <field name="product_id" readonly="1" optional="show"/> <field name="lot_producing_id" optional="hide"/> <field name="bom_id" readonly="1" optional="hide"/> <field name="activity_ids" string="Next Activity" widget="list_activity" optional="show" nolabel="1"/> <field name="origin" optional="show"/> <field name="user_id" optional="hide" widget="many2one_avatar_user"/> <field name="components_availability_state" invisible="1" options="{"lazy": true}"/> <field name="components_availability" options="{"lazy": true}" attrs="{'invisible': [('state', 'not in', ['confirmed', 'progress'])]}" optional="show" decoration-success="reservation_state == 'assigned' or components_availability_state == 'available'" decoration-warning="reservation_state != 'assigned' and components_availability_state in ('expected', 'available')" decoration-danger="reservation_state != 'assigned' and components_availability_state == 'late'"/> <field name="reservation_state" optional="hide" decoration-danger="reservation_state == 'confirmed'" decoration-success="reservation_state == 'assigned'"/> <field name="product_qty" sum="Total Qty" string="Quantity" readonly="1" optional="show"/> <field name="product_uom_id" string="UoM" options="{'no_open':True,'no_create':True}" groups="uom.group_uom" optional="show"/> <field name="production_duration_expected" attrs="{'invisible': [('production_duration_expected', '=', 0)]}" groups="mrp.group_mrp_routings" widget="float_time" sum="Total expected duration" optional="show"/> <field name="production_real_duration" attrs="{'invisible': [('production_real_duration', '=', 0)]}" groups="mrp.group_mrp_routings" widget="float_time" sum="Total real duration" optional="show"/> <field name="company_id" readonly="1" groups="base.group_multi_company" optional="show"/> <field name="state" decoration-success="state in ('done', 'to_close')" decoration-warning="state == 'progress'" decoration-info="state in ('confirmed', 'draft')" optional="show" widget="badge"/> <field name="activity_exception_decoration" widget="activity_exception"/> <field name="delay_alert_date" invisible="1"/> <field nolabel="1" name="json_popover" widget="stock_rescheduling_popover" attrs="{'invisible': [('json_popover', '=', False)]}"/> </tree>
心有猛虎,细嗅蔷薇
标签:
odoo开发
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· 记一次.NET内存居高不下排查解决与启示
2021-03-04 python开发包之pyecharts