0

我無法理解存儲的關鍵字和網址。 例如在模塊網站存在類website_seo_metadata。它有這樣的列:odoo存儲的關鍵字和網址

'website_meta_title': fields.char("Website meta title", translate=True), 
'website_meta_description': fields.text("Website meta description", translate=True), 
'website_meta_keywords': fields.char("Website meta keywords", translate=True), 

當我爲頁面記錄添加了一些關鍵字不存在於數據庫。 我不明白在哪裏存儲網頁的網址。我知道,如果我創建路線:

@http.route('/contacts/', type='http', auth="public", website=True) 

加入這個路徑的sitemap.xml 對於生成的sitemap.xml使用sitemap_xml_index方法:

@http.route('/sitemap.xml', type='http', auth="public", website=True) 
    def sitemap_xml_index(self): 
     current_website = request.website 
     cr, uid, context = request.cr, openerp.SUPERUSER_ID, request.context 
     ira = request.registry['ir.attachment'] 
     iuv = request.registry['ir.ui.view'] 

但在這個表中不存在任何一個網址。我無法理解它如何爲所有頁面生成路徑。數據在哪裏存儲? 我寫了自己的模塊,但其中的頁面沒有出現在sitemap.xml中,並且沒有正確保存和顯示關鍵字。 我想延長我的模型,如:

class pr_info_pages(models.Model): 
    _name = 'pr_filials.pr_info_pages' 
    _inherit = ['mail.thread', 'website.seo.metadata', 'website.published.mixin'] 

,但什麼都沒有改變...... 如何我可以加我的網址,網站地圖,並正常儲存關鍵字?

回答

0

對於需要在模型中使用的關鍵字:

_inherit = ['mail.thread', 'website.seo.metadata'] 

此外,當您生成頁面數據,需要把頁面「main_object」。這是包含模型對象的字典元素。例如:

return http.request.render(_your_template_, { 
      'page_data': page_data, 
      'main_object': _object_ 
     })