如何在另一页(商店)上显示产品类别的名称[odoo 10]

时间:2019-03-20 06:05:43

标签: python odoo-10

Result show image, name and link category product in different page (shop) [1]我试图在另一个商店页面(odoo 10)上显示产品类别的名称,我试图创建一个.py文件:

Website Class (models.Model):
    _inherit = "product.public.category"
    category = fields.Char (string = 'Category', compute = 'get_category')
    # product_categ_id = fields.Many2one (related = 'product_id.product_tmpl_id.categ_id', string = 'Product Category')
    
    @ api.multi
    def get_category (self):
    ???
    return false

我应该在编码中添加些什么以便能够显示商店页面中显示的名称,图像和链接类别?除此之外,如何在文件中显示。 xml ??

? xml version = "1.0" encoding = "utf-8"?>

<odoo>
    <template id = "data_slider_demo" name = "Data Slider Demo" page = "True">
        <t t-call = "website.layout">
            <div id = "wrap" class = "oe_structure oe_empty">
                <div class = "container">
                    <div class = "row">
                        <div class = "oe_structure">
                            <section class = "oe_snippet_body o_data_slider mb32 container text-center"
                                     t-att-data-options = '& apos; {
                                                            "data_model": "res.partner",
                                                            "data_image_field": "image_medium",
                                                            "data_name_field": "name",
                                                            "data_uri_field": "website_url",
                                                         } & apos; '
                                     >
                                <div class = "container">
                                    <div class = "row">
                                        <div class = "oe_structure" />
                                    </ div>
                                </ div>
                            </ section>
                        </ div>
                    </ div>
                </ div>
            </ div>
        </ t>
    </ template>

0 个答案:

没有答案