コンテンツへスキップ
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
このフォーラムについて
ヘルプ

[v15] How does one create an automated action (base.automation) via xml?

購読

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

この質問にフラグが付けられました
AutomatedActionsv15
1 返信
11298 ビュー
アバター
Mr Discovery

There's no documentation on creating an automated action.


The one there is, is about scheduled actions (ir.cron)

https://www.odoo.com/documentation/15.0/developer/reference/backend/actions.html#automated-actions-ir-cron


How does one create an automated action via XML?


It used to be something like this:

https://github.com/odoo/odoo/blob/12.0/addons/base_automation/data/base_automation_demo.xml


Bus this file doesn't exists after v12.


So the top entry gives this error in v15:


raise ParseError('while parsing %s:%s, somewhere inside\n%s' % (
odoo.tools.convert.ParseError: while parsing /home/odoo/src/user/module/views/automated_actions.xml:4, somewhere inside
<record id="test_rule_on_create" model="base.automation">
<field name="name">Base Automation: test rule on create</field>
<field name="model_id" ref="base_automation.model_base_automation_lead_test"/>
<field name="state">code</field>
<field name="code" eval="'records.write({\'user_id\': %s})' % ref('base.user_demo')"/>
<field name="trigger">on_create</field>
<field name="active" eval="True"/>
<field name="model_id" ref="base_automation.model_base_automation_lead_test"/>
<field name="filter_domain">[('state', '=', 'draft')]</field>
</record>





Any help would be appreciated.

0
アバター
破棄
Mohammed Amal N

try changing model_id to some other models like purchase.purchase_order. I guess odoo15 don't have this model
Also remove duplicate model_id field.

Mr Discovery
著作者

I did what you proposed, but to no avail.

I guess the problem is even before reading the contents, since it throws a parse error instead of complaining about the actual model.

It seems the XML isn't structured correctly or something.

Mr Discovery
著作者

Ok, I got it working now.

It was indeed being problematic about the external ID of the model.

I got more feedback in the log when I scrolled up in the server log, which was out of view on default.

Thank you for your help  Mohammed Amal N


アバター
Mohammed Amal N
最善の回答

Hi,

Make sure the references used to other models/ data in xml is available.

here is an example:



  

id="test_rule_on_create" model="base.automation">
name="name">Base Automation: test rule on create
name="model_id" ref="purchase.model_purchase_order"/>
name="state">code
name="code" eval="'records.write({\'user_id\': %s})' % ref('base.user_demo')"/>
name="trigger">on_create
name="active" eval="True"/>
name="filter_domain">[('state', '=', 'draft')]





Make sure you have purchase and base_automation modules in your dependencies. And demo data activated for the database for this code to work.

Thank You

0
アバター
破棄
Mohammed Amal N

<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record id="test_rule_on_create" model="base.automation">
<field name="name">Base Automation: test rule on create</field>
<field name="model_id" ref="purchase.model_purchase_order"/>
<field name="state">code</field>
<field name="code" eval="'records.write({\'user_id\': %s})' % ref('base.user_demo')"/>
<field name="trigger">on_create</field>
<field name="active" eval="True"/>
<field name="filter_domain">[('state', '=', 'draft')]</field>
</record>
</odoo>

Added code in comments as there is some problem for me to copy paste in here. don't know why

Mr Discovery
著作者

Even this throws a parse error:

<record id="test_rule_on_create" model="base.automation">
</record>

I think it bumps on the base.automation model. It probably doesn't work anymore to create records in this fashion.

Mohammed Amal N

I just tested this code myself in Odoo 15. Try the code in a new file. Your issue should be coming from some other place

Mr Discovery
著作者

and base_automation is in the depends section of the manifest

Mr Discovery
著作者

side question: do you happen to know how to populate the trigger_field_ids field?
I got so far as to provide something like this:
<field name="trigger_field_ids" eval="[(6, 0, [ ref('sale_subscription.date'), ref('module.x_studio_field')])]"/>

But it complains it can't find the external ID
ValueError: <class 'ValueError'>: "External ID not found in the system: sale_subscription.field_date" while evaluating

Mr Discovery
著作者

I found it: View Metadata after viewing the field in the model, there's the external ID you need to provide

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

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

登録
関連投稿 返信 ビュー 活動
How Can I Automatically Set Two Related Dates?
AutomatedActions v15
アバター
0
3月 22
3507
How to create alerts for expiration dates of products?
alerts AutomatedActions v15
アバター
アバター
アバター
2
5月 24
3452
Problem with parasitic automated actions on products
products AutomatedActions v15
アバター
アバター
1
1月 23
2425
How to obtain Product Category from Automated Action code 解決済
python AutomatedActions v15
アバター
アバター
1
9月 22
4713
Odoo 15: Automated action for send mail after specific days
sendmail AutomatedActions v15
アバター
アバター
1
6月 22
4499
コミュニティ
  • チュートリアル
  • ドキュメンテーション
  • フォーラム
オープンソース
  • ダウンロード
  • 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