コンテンツへスキップ
Odoo メニュー
  • サインイン
  • 無料で15日試す
  • アプリ
    財務
    • 会計
    • 請求
    • 経費
    • スプレッドシート(BI)
    • ドキュメント管理
    • 署名
    販売
    • CRM
    • 販売
    • POS店舗
    • POSレストラン
    • サブスクリプション
    • レンタル
    ウェブサイト
    • ウェブサイトビルダー
    • eコマース
    • ブログ
    • フォーラム
    • ライブチャット
    • eラーニング
    サプライチェーン
    • 在庫
    • 製造
    • 製品ライフサイクル管理 (PLM)
    • 購買
    • 整備
    • 品質
    人事業務
    • 従業員管理
    • 採用
    • 休暇管理
    • 人事評価
    • リファラル
    • フリート
    マーケティング
    • ソーシャルマーケティング
    • メールマーケティング
    • SMSマーケティング
    • イベント
    • マーケティングオートメーション
    • アンケート調査
    サービス
    • プロジェクト管理
    • タイムシート
    • フィールドサービス
    • ヘルプデスク
    • 計画
    • アポイントメント
    生産性向上ツール
    • ディスカッション
    • 承認
    • IoT
    • VoIP
    • ナレッジ
    • WhatsApp
    サードパーティアプリ Odooスタジオ Odooクラウドプラットホーム
  • インダストリー(業種別ソリューション)
    小売
    • 書店
    • アパレルショップ
    • 家具専門店
    • 食料品店
    • 金物店
    • 玩具店
    飲食・ホスピタリティ業界
    • バー・パブ
    • レストラン
    • ファストフード
    • ゲストハウス
    • 飲料販売代理店
    • ホテル
    不動産
    • 不動産会社
    • 建築事務所
    • 建設
    • 不動産管理
    • 造園
    • 住宅所有者組合
    コンサルティング
    • 会計事務所
    • Odooパートナー
    • マーケティングエージェンシー
    • 法律事務所
    • 人材派遣
    • 監査・認証
    製造
    • テキスタイル
    • 金属
    • 家具
    • 飲食
    • 醸造所
    • コーポレートギフト
    ヘルス & フィットネス
    • スポーツクラブ
    • 眼鏡店
    • フィットネスセンター
    • ウェルネス専門家
    • 薬局
    • ヘアサロン
    業種
    • 便利屋
    • IT ハードウェア・サポート
    • 太陽エネルギーシステム
    • 靴メーカー
    • クリーニングサービス
    • 空調設備サービス
    その他
    • 非営利団体
    • 環境機関
    • ビルボードレンタル
    • 写真
    • 自転車リース
    • ソフトウェアリセラー
    すべての業種を見る
  • コミュニティ
    学ぶ
    • チュートリアル
    • ドキュメンテーション
    • 認定
    • トレーニング
    • ブログ
    • ポッドキャスト
    教育サポート
    • 教育プログラム
    • Scale Up! ビジネスゲーム
    • Odooオフィス訪問
    ソフトを入手
    • ダウンロード
    • エディションを比較
    • リリース
    コラボレーション
    • Github
    • フォーラム
    • イベント
    • 翻訳
    • パートナーになる
    • パートナー様向けサービス
    • 会計事務所を登録
    サービス利用
    • パートナー一覧
    • 会計事務所一覧
    • 今すぐ相談する
    • 導入支援サービス
    • お客様一覧
    • サポート
    • アップグレード
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    製品デモを利用する
  • 料金
  • ヘルプ

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • 会計
  • 在庫
  • PoS
  • プロジェクト
  • MRP
All apps
コミュニティで交流するには登録する必要があります。
全てのポスト 人々 バッジ
タグ (全て表示)
odoo accounting v14 pos v15
このフォーラムについて
コミュニティで交流するには登録する必要があります。
全てのポスト 人々 バッジ
タグ (全て表示)
odoo accounting v14 pos v15
このフォーラムについて
ヘルプ

How to add an extra step in the webshop flow?

購読

この投稿に活動があった際に通知を受け取ります

この質問にフラグが付けられました
requestwebshopredirectcontrollerroute
1 返信
8279 ビュー
アバター
Yenthe Van Ginneken (Mainframe Monkey)

Hi guys,

I want to change the default behaviour from the webshop but I'm not entirely sure how to do this.
When the user clicks on 'shop' I want it to redirect to another page, where the user has to choose a value from the dropdown. After the users chooses an item from the dropdown and clicks on the submit button he should be send to the shop and should only see products that meet this criteria.

I've first made a controller that redirects:

 #Make a redirect first.
    @http.route(['/shop'], type='http', auth="public", website=True)
    def redirect(self, **post):
	return request.redirect("/shop/categoryselection")

Then I made a new controller for the new view like this:

 #Page that shows dropdown for all kind of finishing types
    @http.route(['/shop/categoryselection'], type='http', auth="public", website=True)
    def categoryselection(self, **post):
	cr, uid, context, pool = request.cr, request.uid, request.context, request.registry
        order = request.website.sale_get_order()
	finishing_ids = pool['sale.order.finishing'].search(cr, uid, [('website_publish', '=', True)], context=context)
        afwerkingen = pool['sale.order.finishing'].browse(cr, uid, finishing_ids, context=context)
        values = dict(order=order, afwerkingen=afwerkingen)

        if post:
	    _logger.warning("in if post:")
            if post.get('afwerking'):
		_logger.warning("in if post.get")
                order.write({'afwerkingpicker': int(post.get('afwerking'))})
            return request.redirect("/shop")
        return request.website.render("website_sale.products", values)

The new page has the following XML to render it:

 <template id="categoryselection">
            <t t-call="website.layout">
              <div id="wrap">
                <div class="container oe_website_sale">
                  <h1 class="mb32">Kies een categorie</h1>
                  <div class="row">
                    <form method="post" class="">
                        <div class="row bg-info" style="padding:15px;margin-top:30px;border-radius:15px;">
                          <div class="form-inline form-group">
                            <label for="afwerking" class="h4">Type afwerking</label>
			    <br />
                            <select id="afwerking" name="afwerking" class="form-control">
                              <t t-foreach="afwerkingen" t-as="afwerking">
                                <option t-att-value='afwerking.id'>
                                  <span t-field="afwerking.name" />
                                </option>
                              </t>
                            </select>
                          </div>
                        </div>
			<input type="submit" class='btn btn-primary pull-right' value='Bevestigen'/>
		   </form>
		  </div>
		</div>
	     </div>
	   </t>
	</template>

 However this request.website.render gives me the following error:

 QWebException: "'NoneType' object is not callable" while evaluating
"keep('/shop'+ ('/category/'+slug(category)) if category else '', search=0)"

I'm not quite sure how I should fix this and then my second question is also.. how can I only show the products that meet the selected value from the dropdown? The selection is filled with data from the model sale.order.finishing and on my product view I made a Many2many that links to sale.order.finishing so that the user can choose which product belongs to which finishing.
The product view:

 <!-- Inherit product view and add Many2many -->
        <record id="product.product_template_only_form_view_inherit" model="ir.ui.view">
            <field name="name">product.template.product.inherit</field>
            <field name="model">product.template</field>
            <field name="inherit_id" ref="product.product_template_only_form_view"/>
            <field name="arch" type="xml">
              <xpath expr="//field[@name='description']" position="before">
		<group>
                  <field name="afwerkingpickerProduct"/>
		</group>
              </xpath>
            </field>
        </record>

and the python code behind this view:

 #Add many2many (for finishing on product) to product.template
class aa_houbolak_finishing_in_product_model(models.Model):
    _inherit = 'product.template'
    afwerkingpickerProduct = fields.Many2many('sale.order.finishing','product_finishing_rel','src_id_finishing','dest_id_finishing',string='Afwerking(en):')

Thanks,
Yenthe

0
アバター
破棄
アバター
Zbik
最善の回答

Probably your problem is related to rendering this template (from website_sale/view/templates.xml):

<template id="search" name="Search hidden fields">
<form t-att-action="keep('/shop'+ ('/category/'+slug(category)) if category else '', search=0)" method="get" t-att-class="search_class">
....
</form>
</template>


UPDATE:

My sugestion, try to override (inherit)  /shop controller like this:

from openerp.addons.website_sale.controllers.main import website_sale
class Extension(website_sale):

@http.route(['/shop',
'/shop/myshop',
'/shop/page/<int:page>',
'/shop/category/<model("product.public.category"):category>',
'/shop/category/<model("product.public.category"):category>/page/<int:page>'
], type='http', auth="public", website=True)

def shop(self, page=0, category=None, search='', **post):
### do_before() !!!
_logger.info('My SHOP')
return super(Extension, self).shop(page=page, category=category, search=search, **post)


1
アバター
破棄
Yenthe Van Ginneken (Mainframe Monkey)
著作者

Hi Zbik! Its indeed related to it but I honestly have no clue how I can redirect it correctly.. It seems to be missing some values or something. That is really the part where I'm stuck. Any ideas?

Zbik

Why do not you start with site /shop/categoryselection, without redirection from /shop? In the current situation, you have a redirect loop... /shop -> /shop/categoryselection -> /shop ->....

Qutechs, Ahmed M.Elmubarak

or you need to change /shop route ...

Yenthe Van Ginneken (Mainframe Monkey)
著作者

@zbik I do start with /shop/selection, I simply redirect when the user clicks on shop (so on the controller I do request.redirect from /shop to /shop/categoryselection) and when the user is done there is a submit button. After clicking on this button the user should see all products that match the filter but I'm not sure how.. By the way you can see the full code here: https://github.com/Yenthe666/Dev/tree/master/aa_houbolak

Zbik

Answer updated

ディスカッションを楽しんでいますか?読むだけでなく、参加しましょう!

今すぐアカウントを作成して、限定機能を利用したり、素晴らしいコミュニティと交流しましょう!

登録
関連投稿 返信 ビュー 活動
Custom form showing 303 Error Code on Submit
request http controller route odoosh
アバター
アバター
1
7月 25
3246
http.route(... auth="none") not working in Odoo11 解決済
controller route
アバター
4
10月 20
6869
Problem with the controller routes
controller route
アバター
アバター
2
3月 16
5150
How to redirect from a component to another?
request components redirect
アバター
0
9月 25
662
How to redirect from one controller to another in the website of odoo 10?
redirect controller odoo10
アバター
アバター
アバター
アバター
3
6月 24
24717
コミュニティ
  • チュートリアル
  • ドキュメンテーション
  • フォーラム
オープンソース
  • ダウンロード
  • Github
  • Runbot
  • 翻訳
サービス
  • Odoo.shホスティング
  • サポート
  • アップグレード
  • カスタム開発
  • 教育プログラム
  • 会計事務所一覧
  • パートナー一覧
  • パートナーになる
企業情報
  • 会社概要
  • ブランドアセット
  • お問い合わせ
  • 採用情報
  • イベント
  • ポッドキャスト
  • ブログ
  • お客様一覧
  • リーガル情報 • プライバシーポリシー
  • セキュリティ
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo(オドゥー)は、CRM、eコマース、会計、在庫管理、POS、プロジェクト管理など、企業のさまざまな業務を一つのシステムで管理できる、ベルギー発のオープンソースのERPソフトウェアです。

高機能で使いやすく、完全に統合されたERPとして、ユニークな価値を提供しています。

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now