コンテンツへスキップ
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 validate required fields on CRM stage change?

購読

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

この質問にフラグが付けられました
validatechangestagecrm_leadodooV12
6 返信
11256 ビュー
アバター
Muhammad Anees

Hii,

I have made some fields as required through xpath in xml on CRM Pipeline form. I dont want to set required in python.
When I change stage this validation dont apply. I tried on stage_id onchange function but crm.lead fields are not available.
I tried overriding write method, in this case when creating new lead in Kanban quick create dont work.

How to validate required fields on CRM stage change?

Thanks,

 


2
アバター
破棄
Ermin Trevisan

Please refrain from obviously boosting your own karma with your "fake" Q&A games, especially when your answers are questionable.

Muhammad Anees
著作者

twanda AG, Ermin Trevisan Switzerland, very disgraceful remarks. I am helping me and the community and for you its answer and question game?

アバター
Muhammad Anees
著作者 最善の回答

I done it by overriding the write() method. Here is the code.

class AbcCrmLead(models.Model):     
    _inherit = 'crm.lead' 
@api.multi
def write(self, values):
result = super(AbcCrmLead, self).write(values)
for record in self:
if not record.partner_id:
raise UserError(_('Customer is required'))
if not record.mobile:
raise UserError(_('Mobile is required'))
if record.stage_id.need_quotation and record.sale_number <= 0:
raise UserError(_('Opportunity with No Quotation can\'t be moved to %s stage. Please add quotation(s) to move to next stage.' % record.stage_id.name))
return result

The issue was when creating new opportunity from Kanban Quick Create Form. So I inherited the Kanban Quick Create Form and added required fields. 

<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record id="abc_quick_create_opportunity_form" model="ir.ui.view">
<field name="name">abc.crm.lead.form.quick_create</field>
<field name="model">crm.lead</field>
<field name="inherit_id" ref="crm.quick_create_opportunity_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='partner_id']" position="attributes">
<attribute name="required">1</attribute>
</xpath>
<xpath expr="//field[@name='partner_id']" position="after">
<field name="mobile" required="1"/>
<field name="date_deadline" required="1"/>
<field name="user_id" required="1"/>
<field name="team_id" required="1"/>
</xpath>
<xpath expr="//field[@name='planned_revenue']" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
<xpath expr="//field[@name='priority']" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
</field>
</record>
</odoo>

Now all validation is working by drag and drop from kanabn view, changing stage from form view.

4
アバター
破棄
アバター
Sudhir Arya (ERP Harbor Consulting Services)
最善の回答

You can use attrs to make the fields required based on condition.

Create a related name field of the stage_id and use it in the attrs.

stage_name = fields.Char(related='stage_id.name', string='Stage') # Create this field in the py file

<field name="stage_name" invisible="1"/>
<field name="field1" attrs="{'required': [('stage_name', '=', 'Draft')]}"/>


5
アバター
破棄
Muhammad Anees
著作者

Thanks Arya,

<xpath expr="//field[@name='partner_id']" position="attributes">

<attribute name="attrs">{'required': [('stage_id.name', '=', 'New')]}</attribute>

</xpath>

Getting following error...

Error: Unknown field stage_id.name in domain

Sudhir Arya (ERP Harbor Consulting Services)

You need to create a related field of the stage name:

stage_name = fields.Char(related="stage_id.name", string='Stage Name')

<field name="stage_name" invisible="1"/>

<field name="field1" attrs="{'required': [('stage_name', '=', 'Draft')]}"/>

Muhammad Anees
著作者

I added the stage_name related field updated required domain as you said. But in following two cases validation dont apply.

1. Drag and Drop from kanban to next stage validation dont apply.

2. On the opportunity form, if I click on the next stage, opportunity stage changes to next and validation dont apply

3. On the opportunity form, if I edit and click on next stage, validation applied, on save also applied

I think solution id somewhere in the python code by overriding write method?

What you say Arya.

Sudhir Arya (ERP Harbor Consulting Services)

Ok in that case, you would need to override the write method, check the stage and the fields values in the vals dict, and raise exception as per your condition.

Muhammad Anees
著作者

Thanks Arya, your support was helpful.

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

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

登録
関連投稿 返信 ビュー 活動
How can I send an email notification when a Document changes stage?
email notification change stage
アバター
アバター
1
8月 22
4241
edited invoice doesn't show the changes when printed
invoice validate print change edit
アバター
アバター
1
3月 15
6061
uniqe phone number odoo v15
crm_lead
アバター
アバター
アバター
2
8月 24
245
uniqe phone number odoo v15
crm_lead
アバター
0
8月 24
12
Data Exceeded error while importing data in Odoo v12 解決済
odooV12
アバター
アバター
アバター
アバター
アバター
4
5月 24
8288
コミュニティ
  • チュートリアル
  • ドキュメンテーション
  • フォーラム
オープンソース
  • ダウンロード
  • 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