Skip to Content
Odoo Menu
  • Prisijungti
  • Išbandykite nemokamai
  • Programėlės
    Finansai
    • Apskaita
    • Pateikimas apmokėjimui
    • Sąnaudos
    • Skaičiuoklė (BI)
    • Dokumentai
    • Pasirašymas
    Pardavimai
    • CRM
    • Pardavimai
    • Kasų sistema - Parduotuvė
    • Kasų sistema - Restoranas
    • Prenumeratos
    • Nuoma
    Svetainės
    • Svetainių kūrėjimo įrankis
    • El. Prekyba
    • Internetinis Tinklaraštis
    • Forumas
    • Tiesioginis pokalbis
    • eMokymasis
    Tiekimo grandinė
    • Atsarga
    • Gamyba
    • PLM
    • Įsigijimai
    • Priežiūra
    • Kokybė
    Žmogaus ištekliai
    • Darbuotojai
    • Įdarbinimas
    • Atostogos
    • Įvertinimai
    • Rekomendacijos
    • Transporto priemonės
    Rinkodara
    • Socialinė rinkodara
    • Rinkodara el. paštu
    • SMS rinkodara
    • Renginiai
    • Rinkodaros automatizavimas
    • Apklausos
    Paslaugos
    • Projektas
    • Darbo laiko žiniaraščiai
    • Priežiūros tarnyba
    • Pagalbos tarnyba
    • Planavimas
    • Rezervacijos
    Produktyvumas
    • Diskucija
    • Patvirtinimai
    • IoT
    • VoIP
    • Žinių biblioteka
    • WhatsApp
    Trečiųjų šalių programos Odoo Studija Odoo debesijos platforma
  • Pramonės šakos
    Mažmeninė prekyba
    • Knygynas
    • Drabužių parduotuvė
    • Baldų parduotuvė
    • Maisto prekių parduotuvė
    • Techninės įrangos parduotuvė
    • Žaislų parduotuvė
    Food & Hospitality
    • Barai ir pub'ai
    • Restoranas
    • Greitasis maistas
    • Guest House
    • Gėrimų platintojas
    • Hotel
    Nekilnojamasis turtas
    • Real Estate Agency
    • Architektūros įmonė
    • Konstrukcija
    • Estate Managament
    • Sodininkauti
    • Turto savininkų asociacija
    Konsultavimas
    • Accounting Firm
    • Odoo Partneris
    • Marketing Agency
    • Teisinė firma
    • Talentų paieška
    • Auditai & sertifikavimas
    Gamyba
    • Textile
    • Metal
    • Furnitures
    • Maistas
    • Brewery
    • Įmonių dovanos
    Sveikata & Fitnesas
    • Sporto klubas
    • Akinių parduotuvė
    • Fitneso Centras
    • Sveikatos praktikai
    • Vaistinė
    • Kirpėjas
    Trades
    • Handyman
    • IT įranga ir palaikymas
    • Saulės energijos sistemos
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Kiti
    • Nonprofit Organization
    • Aplinkos agentūra
    • Reklaminių stendų nuoma
    • Fotografavimas
    • Dviračių nuoma
    • Programinės įrangos perpardavėjas
    Browse all Industries
  • Bendrija
    Mokykitės
    • Mokomosios medžiagos
    • Dokumentacija
    • Sertifikatai
    • Mokymai
    • Internetinis Tinklaraštis
    • Tinklalaidės
    Skatinkite švietinimą
    • Švietimo programa
    • Scale Up! Verslo žaidimas
    • Aplankykite Odoo
    Gaukite programinę įrangą
    • Atsisiųsti
    • Palyginkite versijas
    • Leidimai
    Bendradarbiauti
    • Github
    • Forumas
    • Renginiai
    • Vertimai
    • Tapkite partneriu
    • Services for Partners
    • Registruokite jūsų apskaitos įmonę
    Gaukite paslaugas
    • Susiraskite partnerį
    • Susirask buhalterį
    • Susitikti su konsultantu
    • Diegimo paslaugos
    • Klientų rekomendavimas
    • Palaikymas
    • Atnaujinimai
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Gaukite demo
  • Kainodara
  • Pagalba

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

  • CRM
  • e-Commerce
  • Apskaita
  • Atsarga
  • PoS
  • Projektas
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Žymos (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Žymos (View all)
odoo accounting v14 pos v15
About this forum
Pagalba

Inheritance : Can't see the new field on the form view

Prenumeruoti

Get notified when there's activity on this post

This question has been flagged
treeviewxmlforminheritanceodoov11
3 Replies
7891 Rodiniai
Portretas
Mohamed Lamine Lalmi

Hello, odoo devs,

I'm trying to learn inheritance using ODOO 11, I built a simple module that displays TODO-List, after that, i developed another module that is responsible for adding new fields on the first module view (form & view) using inheritance mechanism.  The problem the new fields do not show after installing the second module.

Any help, please ?

The first module python & XML files :

# -*- coding: utf-8 -*-
from odoo import models, fields, api
import logging
_logger = logging.getLogger(__name__)
class TodoTask(models.Model):
    _name = 'todo.task'
name = fields.Char("name", required=True)
active = fields.Boolean("Is active ?", default=True)
is_done = fields.Boolean("Is done ?")
@api.multi
def do_toggle_done(self):
for task in self:
task.is_done = not task.is_done
log_data = str(task.name) + (" is done" if task.is_done else " not done yet")
self.show_log(log_data)
return True
@api.multi
def do_clear_done(self):
dones = self.search([('is_done', '=', 'True')])
dones.write({'active': False})
return True
@api.model
def show_log(self, log_data):
_logger.critical(str(log_data))jdf

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<!--Task form view-->
<record model="ir.ui.view" id="view_form_todo_task">
<field name="name">Todo tasks form</field>
<field name="model">todo.task</field>
<field name="arch" type="xml">
<form string="Todo Task">
<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_task_info_top">
<field name="name" placeholder="Task's description" required="True"/>
<group name="group_task_info_right">
<field name="is_done"/>
</group>
<group name='group_task_info_left'>
<field name="active" readonly="1"/>
</group>
</group>
</sheet>
</form>
</field>
</record>
<!--Task tree view-->
<record model="ir.ui.view" id="view_tree_todo_task">
<field name="name">Todo tasks list</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>
<!--Task Search view-->
<record model="ir.ui.view" id="view_search_todo_task">
<field name="name">Todo tasks search</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','=',True)]"/>
</search>
</field>
</record>
</data>
</odoo>

The second module python & XML files:

# -*- coding: utf-8 -*-
from odoo import models, fields, api
from odoo.exceptions import ValidationError
class TodoTask(models.Model):
_inherit = 'todo.task'
# Adding new filed
user = fields.Many2one('res.users', string='Responsible')
deadline = fields.Date("Deadline")
# Modifying existing fields
name = fields.Char(help="What needs to be done ?")
# Overriding methods
@api.multi
def do_clear_done(self):
dones = self.search\
([
('is_done', '=', True),
'|',
('user', '=', self.env.uid),
('user', '=', False)
])
for done in dones:
done.write({'active': False})
return True
@api.multi
def do_toggle_done(self):
for task in self:
if task.user != self.env.uid:
raise ValidationError('Only the responsible van do this !')
return super(TodoTask, self).do_toggle_done()

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<record id="view_form_todo_task_extension" model="ir.ui.view">
<field name="name">Todo Form 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' postion="after">
<field name="deadline"/>
</field>
<field name='active' postion="attributes">
<attribute name="invisible">1</attribute>
</field>
<field name='active' postion="before">
<field name="user"/>
</field>
</field>
</record>
<record id="view_tree_todo_task_extension" model="ir.ui.view">
<field name="name">Todo Tree 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' postion="after">
<field name="deadline"/>
<field name="user"/>
</field>
</field>
</record>
<record id="view_search_todo_task_extension" model="ir.ui.view">
<field name="name">Todo Search Extension</field>
<field name="model">todo.task</field>
<field name="inherit_id" ref="todo_app.view_search_todo_task"/>
<field name="arch" type="xml">
<field name='name' postion="after">
<field name="user"/>
<filter string="All" domain="[('user','in',[uid,False])]"/>
<filter string="My tasks" domain="[('user','in',uid)]"/>
<filter string="Not Assigned" domain="[('user','=',False)]"/>
</field>
</field>
</record>
</data>
</odoo>

0
Portretas
Atmesti
Samo Arko

do you use the default created files or do you use own named files. If you use own don't forget to add them to __manifest__.py and models/__init__.py. If you have 2 different custom modules don't forget on the second to add the 1st custom module to depends in __manifest__.py.

Odoo will use his own view if you don't define your custom view. Where are actions and menu items in your views?

Mohamed Lamine Lalmi
Autorius

I check that, and I think that I did it correctly

Portretas
Sudhir Arya (ERP Harbor Consulting Services)
Best Answer

I think the issue is with a typo error.

Check the XML view of 2nd module. You spell position (postion) wrong.

It should be like this:

<field name='name' position="after">
<field name="deadline"/>
</field>

Hope this will help you.

Sudhir Arya
ERP Harbor Consulting Services
skype: 
sudhir@erpharbor.com  webiste: http://www.erpharbor.com
4
Portretas
Atmesti
Enjoying the discussion? Don't just read, join in!

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

Registracija
Related Posts Replies Rodiniai Veikla
How to create a new tree view for inherited(res.users) model without modifying the original view? v16
treeview xml inheritance odoo16features
Portretas
Portretas
1
spal. 23
3771
how to get current value of a record line in a XML tree view
action module treeview xml odoov11
Portretas
1
spal. 18
8617
Difference between xpath and field with only position="replace"
inheritance odoov11
Portretas
Portretas
1
lapkr. 22
4199
OdooV11 : Hierarchical Tree view in Odoo 11 ?
treeview odoov11
Portretas
Portretas
Portretas
2
liep. 18
10759
Prototype inheritance. Solved
inheritance odoov11
Portretas
Portretas
2
kov. 18
5569
Bendrija
  • Mokomosios medžiagos
  • Dokumentacija
  • Forumas
Atvirasis kodas
  • Atsisiųsti
  • Github
  • Runbot
  • Vertimai
Paslaugos
  • Odoo.sh talpinimas
  • Palaikymas
  • Atnaujinti
  • Pritaikytas programavimo kūrimas
  • Švietimas
  • Susirask buhalterį
  • Susiraskite partnerį
  • Tapkite partneriu
Apie mus
  • Mūsų įmonė
  • Prekės ženklo turtas
  • Susisiekite su mumis
  • Darbo pasiūlymai
  • Renginiai
  • Tinklalaidės
  • Internetinis Tinklaraštis
  • Klientai
  • Teisinis • Privatumas
  • Saugumas
الْعَرَبيّة 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 yra atvirojo kodo verslo programų rinkinys, kuris apima visas įmonės poreikius: CRM, El. Prekybą, Apskaitą, Atsargų, Kasų sistemą, Projektų valdymą ir kt.

Unikali Odoo vertės pasiūla – būti tuo pačiu metu labai lengvai naudojama ir visiškai integruota sistema.

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