[IMP] *: Using class name corresponding to odoo models
closes odoo/documentation#11115 Related: odoo/odoo#178200 Related: odoo/enterprise#69762 Related: odoo/upgrade#6577 Related: odoo/design-themes#988 Related: odoo/upgrade-util#143 Signed-off-by: Christophe Matthieu (chm) <chm@odoo.com>
This commit is contained in:
parent
9368181d04
commit
f1a607a9c7
@ -122,7 +122,7 @@ of global variables.
|
||||
from odoo import models
|
||||
|
||||
class IrHttp(models.AbstractModel):
|
||||
_inherit = 'ir.http'
|
||||
_inherit = ['ir.http']
|
||||
|
||||
@classmethod
|
||||
def _get_translation_frontend_modules_name(cls):
|
||||
|
@ -1123,7 +1123,7 @@ fields, methods and meta-information (defaults & al) from its base.
|
||||
|
||||
class Inheritance1(models.Model):
|
||||
_name = 'inheritance.1'
|
||||
_inherit = 'inheritance.0'
|
||||
_inherit = ['inheritance.0']
|
||||
_description = 'Inheritance One'
|
||||
|
||||
def call(self):
|
||||
@ -1161,8 +1161,8 @@ them (e.g. to change their default sort order)::
|
||||
|
||||
name = fields.Char(default="A")
|
||||
|
||||
class Extension1(models.Model):
|
||||
_inherit = 'extension.0'
|
||||
class Extension0(models.Model):
|
||||
_inherit = ['extension.0']
|
||||
|
||||
description = fields.Char(default="Extended")
|
||||
|
||||
@ -1263,12 +1263,16 @@ and overridden by the ones given in subclasses.
|
||||
For instance, the second class below only adds a tooltip on the field
|
||||
``state``::
|
||||
|
||||
class First(models.Model):
|
||||
_name = 'foo'
|
||||
class FirstFoo(models.Model):
|
||||
state = fields.Selection([...], required=True)
|
||||
|
||||
class Second(models.Model):
|
||||
_inherit = 'foo'
|
||||
class FirstFoo(models.Model):
|
||||
_inherit = ['first.foo']
|
||||
state = fields.Selection(help="Blah blah blah")
|
||||
|
||||
class WrongFirstFooClassName(models.Model):
|
||||
_name = 'first.foo' # force the model name
|
||||
_inherit = ['first.foo']
|
||||
state = fields.Selection(help="Blah blah blah")
|
||||
|
||||
.. _reference/exceptions:
|
||||
|
@ -473,7 +473,7 @@ returned dictionary.
|
||||
from odoo.http import request
|
||||
|
||||
class IrHttp(models.AbstractModel):
|
||||
_inherit = 'ir.http'
|
||||
_inherit = ['ir.http']
|
||||
|
||||
def session_info(self):
|
||||
result = super(IrHttp, self).session_info()
|
||||
|
@ -3251,7 +3251,7 @@ Model Commons
|
||||
-------------
|
||||
|
||||
.. currentmodule:: odoo.addons.base.models.ir_ui_view
|
||||
.. autoattribute:: Model._date_name
|
||||
.. autoattribute:: Base._date_name
|
||||
:noindex:
|
||||
|
||||
.. _reference/view_architectures/activity:
|
||||
|
@ -69,7 +69,7 @@ Fields
|
||||
|
||||
View records expose a number of fields.
|
||||
|
||||
.. autoclass:: odoo.addons.base.models.ir_ui_view.View()
|
||||
.. autoclass:: odoo.addons.base.models.ir_ui_view.IrUiView()
|
||||
|
||||
.. attribute:: name
|
||||
|
||||
@ -363,8 +363,8 @@ specifies how the matched node should be modified.
|
||||
Model commons
|
||||
=============
|
||||
|
||||
.. autoclass:: odoo.addons.base.models.ir_ui_view.View()
|
||||
.. autoclass:: odoo.addons.base.models.ir_ui_view.Base()
|
||||
:noindex:
|
||||
|
||||
.. automethod:: Model.get_views
|
||||
.. automethod:: Model.get_view
|
||||
.. automethod:: Base.get_views
|
||||
.. automethod:: Base.get_view
|
||||
|
@ -134,7 +134,7 @@ existing model, which means we will use the first mechanism. For example::
|
||||
from odoo import fields, models
|
||||
|
||||
class InheritedModel(models.Model):
|
||||
_inherit = "inherited.model"
|
||||
_inherit = ["inherited.model"]
|
||||
|
||||
new_field = fields.Char(string="New Field")
|
||||
|
||||
|
@ -67,7 +67,7 @@ module for the ``estate.property`` model. For now, the overridden action will si
|
||||
from odoo import models
|
||||
|
||||
class InheritedModel(models.Model):
|
||||
_inherit = "inherited.model"
|
||||
_inherit = ["inherited.model"]
|
||||
|
||||
def inherited_action(self):
|
||||
return super().inherited_action()
|
||||
|
@ -801,9 +801,8 @@ scheduling changes or discussions between teachers and assistants:
|
||||
.. code-block:: python
|
||||
:caption: ``academy/models.py``
|
||||
|
||||
class Courses(models.Model):
|
||||
_name = 'academy.courses'
|
||||
_inherit = 'mail.thread'
|
||||
class AcademyCourses(models.Model):
|
||||
_inherit = ['mail.thread']
|
||||
|
||||
name = fields.Char()
|
||||
teacher_id = fields.Many2one('academy.teachers', string="Teacher")
|
||||
|
Loading…
Reference in New Issue
Block a user