如何在odoo中将鼠标悬停在产品图片上?

时间:2020-05-15 04:45:36

标签: python xml odoo

我想按模块更改悬停时(鼠标悬停时)的产品图片。我有包含图像的gifpath字段。如何将一些事件listiner添加到xml或python中?确实不希望使用javascript,因为很难将其与数据库图像同步。

templates.xml

<odoo>

    <data>
    <record id="product_product_inherit" model="ir.ui.view">
                <field name="name">product.template.inherit</field>
        <field name="model">product.template</field>
        <field name="inherit_id" ref="product.product_template_only_form_view"/>
        <field name="arch" type="xml">
            <field name="default_code" position="after">
                <field name="gifpath" widget="image"/>
            </field>
        </field>
              </record>

       <template id="website_sales_inh" name="webiste_sales_inherit" inherit_id="website_sale.products_item">

          <xpath expr="//span[@class='d-flex h-100 justify-content-center align-items-center']" position="replace">

              <span t-field="product.image_1920"
                        t-options="{'widget': 'image', 'preview_image': 'gifpath'}"
                        class="d-flex h-100 justify-content-center align-items-center"/>
          </xpath>

       </template>

    </data>

</odoo>

models.py

# -*- coding: utf-8 -*-

from odoo import models, fields, api


class imgtogif_r(models.Model):
    _inherit = ['product.template']
    gifpath = fields.Binary('gifpath')

0 个答案:

没有答案
相关问题