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

Model not found when extending views

購読

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

この質問にフラグが付けられました
viewinheritanceodoo11
3 返信
12693 ビュー
アバター
Billy

When I try to extend the view of my parent view an error: "Model not found: todo.task" raise here is my code:

my parent Model:

# -*- coding: utf-8 -*-
from odoo import models, fields, api


class TodoTask(models.Model):
_name= 'todo.task'
_description = 'To-do Task'
name= fields.Char('Description', required=True)
is_done= fields.Boolean('Done?')
active = fields.Boolean('Active?', default=True)

@api.multi
def do_toggle_done(self):
for task in self:
task.is_done= not task.is_done
return True



@api.model
def do_clear_done(self):
dones = self.search([('is_done','=',True)])
dones.write({'active':False})
return True

the extending Model:

# -*- coding: utf-8 -*-

from odoo import models, fields,api
from odoo.exceptions import ValidationError

class TodoTask(models.Model):

_inherit = 'todo.task'
user_id= fields.Many2one('res.users', 'Responsible')
date_deadline= fields.Date('Deadline')

@api.multi
def do_clear_done(self):
domain = [('is_done','=',True), '|', ('user_id', '=', self.env.uid),('user_id','=',False)]
dones= self.search(domain)
dones.write({'active': False})
return True

@api.multi
def do_toggle_done(self):
for task in self:
if task.user_id != self.env.user:
raise ValidationError(
'Only the responsible can do this !'
)
return super(TodoTask, self).do_toggle_done()

my parent view:

<odoo>

<record
id="view_form_todo_task" model="ir.ui.view">
<field
name="name"> To-do Task Form</field>
<field
name ="model">todo.task</field>
<field
name="arch" type="xml">


<form >
<header>

<button
name ="do_toggle_done" type="object"
string="Toggle Done"
class="oe_highlight" />

<button
name ="do_clear_done"
type="object"
string="Clear All Done" />

</header>

<sheet>

<group
name="group_top">

<group
name="group-left">
<field
name="name"/>
</group>

<group
name="group_right">
<field
name="is_done"/>
<field
name="active" readonly="1"/>
</group>

</group>

</sheet>
</form>


</field>

</record>


<record
id="view_tree_todo_task" model="ir.ui.view">
<field
name="name">To-do Task Tree</field>
<field
name="model">todo.task</field>
<field
name="arch" type="xml">

<tree
colors="decoration-muted:is_done==True">
<field
name="name"/>
<field
name="is_done"/>
</tree>

</field>
</record>



<record
id="view_filter_todo_task" model="ir.ui.view">
<field
name="name">To-do Task Filter</field>
<field
name="model">todo.task</field>
<field
name="arch" type="xml">

<search>
<field
name="name"/>

<filter
string="Not Done"
domain="[('is_done','=',False)]"/>

<filter
string="Done"
domain="[('is_done','!=',False)]"/>

</search>
</field>
</record>


</odoo>


the extending view:


<odoo>


<record id="view_form_todo_task_inherited"
model="ir.ui.view">

<field name="name">
Todo Task form -User extension
</field>

<field name="model">
todo.task
</field>

<field name="inherit_id"
ref="todo_app.view_form_todo_task"/>

<field name="arch" type="xml">

<field name="name" position="after">

<field name="user_id"></field>

<field name="is_done" position="before">

<field name="date_deadline"/>
</field>

<field name="active" position="attributes">
<attribute name="invisible">1</attribute>

</field>

</field>

</field>


</record>


<record id="view_tree_todo_task_inherited"
model="ir.ui.view">
<field name="name">
Todo Task tree - User extension
</field>

<field name="model">
todo.task
</field>

<field name="inherit_id"
ref="todo_app.view_tree_todo_task"/>

<field name="arch" type="xml">

<field name="name" position="after">
<field name="user_id"/>
</field>


</field>

</record>


<record id="view_filter_todo_task_inherited"
model="ir.ui.view">

<field name="name">
Todo Task tree - User extension
</field>

<field name="model">
todo.task
</field>

<field name="inherited_id"
ref="todo_app.view_filter_todo_task"/>

<field name="arch" type="xml">

<field name="name" position="after">

<field name="user_id"/>
<filter name="filter_my_tasks" string="My Tasks"
domain="[('user_id','in',[uid,False])]"/>

<filter name="filter_not_assigned" string="Not Assigned"
domain="[('user_id','=',False)]"/>

</field>



</field>



</record>



</odoo>



0
アバター
破棄
Josh

Next time, I will review the date of the post before read 

アバター
Cybrosys Techno Solutions Pvt.Ltd
最善の回答

Hi,

Are you defining the model and inheriting the model in the same module itself? if you are doing such rather than inheriting it, add it where you define the model.  Also, you can check the sequence of the python file called in the init. Make sure that first the file where you define the model will get defined.


If it is a separate module, give the module in which you have defined the model as depend for the new module in manifest file.


Thanks

0
アバター
破棄
Billy
著作者

Its a separated one and every thing is set in the manifest file as depends but still shows me the same error:

Model not found:

todo.task

Error context:

View `

Todo Task form -User extension

`

[view_id: 328, xml_id: n/a, model:

todo.task

, parent_id: 228]

None" while parsing /opt/odoo/odoo11/odoo11-custom-addons/todo_user/views/todo_task.xml:6, near

<record id="view_form_todo_task_inherited" model="ir.ui.view">

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

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

登録
関連投稿 返信 ビュー 活動
View inheritance 解決済
view inheritance
アバター
アバター
1
3月 20
4317
Odoo 11: Adding child model to res.partner 解決済
inheritance odoo11
アバター
アバター
1
9月 19
4892
How do I remove fields from a view in a custom module? 解決済
view inheritance
アバター
アバター
アバター
アバター
12
12月 18
36142
Weird error "Expression cannot be located in parent view" in view inheritance 解決済
view inheritance
アバター
アバター
1
7月 16
7878
Two-level view inheritance, what am I missing?
view inheritance
アバター
アバター
2
3月 15
6799
コミュニティ
  • チュートリアル
  • ドキュメンテーション
  • フォーラム
オープンソース
  • ダウンロード
  • 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