Přejít na obsah
Odoo Menu
  • Přihlásit se
  • Vyzkoušejte zdarma
  • Aplikace
    Finance
    • Účetnictví
    • Fakturace
    • Výdaje
    • Spreadsheet (BI)
    • Dokumenty
    • Podpisy
    Prodej
    • CRM
    • Prodej
    • POS Obchod
    • POS Restaurace
    • Předplatné
    • Pronájem
    Webové stránky
    • Webové stránky
    • E-shop
    • Blog
    • Fórum
    • Živý chat
    • eLearning
    Dodavatelský řetězec
    • Sklad
    • Výroba
    • PLM
    • Nákup
    • Údržba
    • Kvalita
    Lidské zdroje
    • Zaměstnanci
    • Nábor
    • Volno
    • Hodnocení zaměstnanců
    • Doporučení
    • Vozový park
    Marketing
    • Marketing sociálních sítí
    • Emailový marketing
    • SMS Marketing
    • Události
    • Marketingová automatizace
    • Dotazníky
    Služby
    • Projekt
    • Časové výkazy
    • Práce v terénu
    • Helpdesk
    • Plánování
    • Schůzky
    Produktivita
    • Diskuze
    • Schvalování
    • IoT
    • VoIP
    • Znalosti
    • WhatsApp
    Aplikace třetích stran Odoo Studio Odoo cloudová platforma
  • Branže
    Maloobchod
    • Knihkupectví
    • Obchod s oblečením
    • Obchod s nábytkem
    • Potraviny
    • Obchod s hardwarem
    • Hračkářství
    Jídlo a pohostinství
    • Bar a Pub
    • Restaurace
    • Fast Food
    • Penzion
    • Distributor nápojů
    • Hotel
    Nemovitost
    • Realitní kancelář
    • Architektonická firma
    • Stavba
    • Správa nemovitostí
    • Zahradnictví
    • Asociace vlastníků nemovitosti
    Poradenství
    • Účetní firma
    • Odoo Partner
    • Marketingová agentura
    • Právník
    • Akvizice talentů
    • Audit a certifikace
    Výroba
    • Textile
    • Kov
    • Nábytek
    • Jídlo
    • Brewery
    • Korporátní dárky
    Zdraví a fitness
    • Sportovní klub
    • Prodejna brýli
    • Fitness Centrum
    • Wellness praktikové
    • Lékárna
    • Kadeřnictví
    Transakce
    • Údržbář
    • IT hardware a podpora
    • Systémy solární energie
    • Výrobce obuvi
    • Úklidové služby
    • Služby HVAC
    Ostatní
    • Nezisková organizace
    • Agentura pro životní prostředí
    • Pronájem billboardů
    • Fotografování
    • Leasing jízdních kol
    • Prodejce softwaru
    Browse all Industries
  • Komunita
    Edukační program
    • Tutoriály
    • Dokumentace
    • Certifikace
    • Vzdělávání
    • Blog
    • Podcast
    Podpora vzdělávání
    • Vzdělávací program
    • Scale Up! Hra na firmu
    • Navštivte Odoo
    Získat software
    • Stáhnout
    • Porovnejte edice
    • Verze
    Spolupráce
    • Github
    • Fórum
    • Události
    • Překlady
    • Stát se partnerem
    • Services for Partners
    • Registrujte svou účetní firmu
    Získat služby
    • Najít partnera
    • Najít účetní
    • Setkejte se s poradcem
    • Implementační služby
    • Zákaznické reference
    • Podpora
    • Upgrady
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Dohodnout demo
  • Ceník
  • Pomoc

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

  • CRM
  • e-Commerce
  • Účetnictví
  • Sklad
  • PoS
  • Projekty
  • MRP
All apps
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
Pomoc

Model not found when extending views

Odebírat

Get notified when there's activity on this post

This question has been flagged
viewinheritanceodoo11
3 Odpovědi
12739 Zobrazení
Avatar
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
Avatar
Zrušit
Josh

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

Avatar
Cybrosys Techno Solutions Pvt.Ltd
Nejlepší odpověď

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
Avatar
Zrušit
Billy
Autor

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">

Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Přihlásit se
Related Posts Odpovědi Zobrazení Aktivita
View inheritance Vyřešeno
view inheritance
Avatar
Avatar
1
bře 20
4352
Odoo 11: Adding child model to res.partner Vyřešeno
inheritance odoo11
Avatar
Avatar
1
zář 19
4926
How do I remove fields from a view in a custom module? Vyřešeno
view inheritance
Avatar
Avatar
Avatar
Avatar
12
pro 18
36181
Weird error "Expression cannot be located in parent view" in view inheritance Vyřešeno
view inheritance
Avatar
Avatar
1
čvc 16
7902
Two-level view inheritance, what am I missing?
view inheritance
Avatar
Avatar
2
bře 15
6826
Komunita
  • Tutoriály
  • Dokumentace
  • Fórum
Open Source
  • Stáhnout
  • Github
  • Runbot
  • Překlady
Služby
  • Odoo.sh hostování
  • Podpora
  • Upgrade
  • Nestandardní vývoj
  • Edukační program
  • Najít účetní
  • Najít partnera
  • Stát se partnerem
O nás
  • Naše společnost
  • Podklady značky
  • Kontakujte nás
  • Práce
  • Události
  • Podcast
  • Blog
  • Zákazníci
  • Právní dokumenty • Soukromí
  • Zabezpečení
الْعَرَبيّة 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 je balíček open-source aplikací, které pokrývají všechny potřeby vaší společnosti: CRM, e-shop, účetnictví, sklady, kasy, projektové řízení a další.

Unikátní nabídka od Odoo poskytuje velmi jednoduché uživatelské rozhraní a vše je integrované na jednom místě.

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