簡體   English   中英

如何在表單視圖中顯示看板樣式磁貼?

[英]How to display kanban style tile in form view?

我有一個 one2many 圖像字段,當前以表格樣式顯示圖像。 我想做的是像看板卡一樣以卡片的形式展現出來。

這就是我目前的看法: 目前來看 這就是我想要的觀點: 目前來看 這是我當前的代碼:

    class VariantsLines(models.Model):
    _inherit = 'product.variants.lines'

    product_image_360_ids = fields.One2many('product.image.360', 'product_tmpl_id', string='Images')
    display_360_image = fields.Boolean(string='Display 360 Image')


class ProductImage360(models.Model):
    _name = 'product.image.360'
    _order = 'sequence'

    name = fields.Char(string='Name', readonly=False)
    image = fields.Binary(string='Image', attachment=True, readonly=False)
    product_tmpl_id = fields.Many2one('product.template', string='Related Product', copy=True)
    sequence = fields.Integer(string="Sequence", readonly=False)

view.xml

    <field name="inherit_id" ref="jewellery.view_product_variants_lines_form"/>
            <field name="arch" type="xml">
                <xpath expr="//form" position="inside">
                    <div>
                        <group>
                            <field name="display_360_image"/>
                        </group>

                        <group string="Images for 360 view" attrs="{'invisible': [('display_360_image', '=', False)]}">
                            <field name="product_image_360_ids" nolabel="1"
                                   context="{'default_product_tmpl_id': active_id}">
                                <tree create="true" editable="bottom">
                                    <field name="sequence" widget="handle" readonly="0"/>
                                    <field name="name" readonly="0"/>
                                    <field name="image" widget="image" class="oe_left oe_avatar" readonly="0"/>
                                </tree>
                            </field>
                        </group>
                    </div>
                </xpath>
            </field>

馬蘇德阿茲哈

在此字段product_image_360_ids上使用kanban視圖而不是tree視圖,並根據您的設計格式化看板視圖,它將為您工作。

<field name="product_image_360_ids" nolabel="1" context="{'default_product_tmpl_id': active_id}">
    <kanban class="o_kanban_mobile">
        <!-- Design your customise template here -->
    </kanban>
</field>

謝謝

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM