Skip to content

Missing important information in Chapter 13 #15038

@eximius313

Description

@eximius313

Chapter 13 says:

Image

Unfortunatelly - when _name is ommited (implicit)

from odoo import models
import logging
_logger = logging.getLogger(__name__)

class EstateModel(models.Model):
    _inherit = ["estate_property"]
    _description = "Enhancement of RealEstate Model"

    def action_sold(self):
        _logger.warning("Child Action sold")
        return super().action_sold()

The "Child Action sold" is never invoked (only "Parent Action sold" is displayed).

But when name is explicitly set to the same as "parent model" :

from odoo import models
import logging
_logger = logging.getLogger(__name__)

class EstateModel(models.Model):
    _name = "estate_property"
    _inherit = ["estate_property"]
    _description = "Enhancement of RealEstate Model"

    def action_sold(self):
        _logger.warning("Child Action sold")
        return super().action_sold()

Both "Child Action sold" and "Parent Action sold" are displayed.

I think this should me a warning in the tutorial

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions