【问题标题】:How can i show my articles of database in website module?如何在网站模块中显示我的数据库文章?
【发布时间】:2017-04-12 08:54:03
【问题描述】:

我正在使用 Odoo 10,我有很多按类别分类的文章,并且我已经安装了网站模块,现在我想在我网站的一个页面中显示我的文章和类别

【问题讨论】:

  • 您好,欢迎来到 StackOverflow!请考虑使用the tour 来改善您的问题 - 从而提高获得答案的可能性!

标签: python web openerp erp odoo-10


【解决方案1】:

要构建网站页面,您可以在此处阅读文档 [https://www.odoo.com/documentation/10.0/howtos/website.html][1]

继续你必须做的事情。

第一步是创建与控制器的链接。像这样

from odoo import http

class Product(http.Controller):
    @http.route('/products/', auth='public')
    def index(self, **kw):
        product_ids = self.env['product.product'].search([])
        return http.request.render('academy.index', {
            'products': product_ids,
        })

第二步是创建模板视图。像这样

<template id="index">
    <title>Products</title>
    <t t-foreach="products" t-as="product">
      <p><t t-esc="product.name"/></p>
    </t>
</template>

这是一个简单的例子。如果您想了解更多信息,可以阅读文档并查看 odoo 代码中的示例。

【讨论】:

  • 那么,图文模式就没有办法建站了吗?
  • 抱歉,我个人从未使用过odoo的电子商务构建器。但我找到了一个小视频来帮助你。 youtube.com/watch?v=ewiPcd0gJmg
  • 对,我还没有安装电子商务模块,现在它的工作,谢谢你这么笨
  • 不客气。我认为结束这个问题很重要^^。
  • 我该怎么做??
猜你喜欢
  • 1970-01-01
  • 2021-12-28
  • 2018-12-02
  • 1970-01-01
  • 2017-07-15
  • 1970-01-01
  • 1970-01-01
  • 2015-10-24
  • 2021-04-16
相关资源
最近更新 更多