Help

0

Odoo 11 - Phone validation module is not inherited

Avatar
alukard990

I want to create my custon and simple app  and I need to import phone_validation module. These module is correctly installed. The module is correctly installed, in fact in Database Structure -> Model is reported as        phone.validation.mixin. But when I try to install my custom module the system informs me that the phone_validation_mixin is not present in the
system. What am I doing wrong?

This is the code

mybooking_view.xml

<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<record
model="ir.ui.view" id="mybooking_task">
<field
name="name">My booking Task Form</field>
<field
name="model">mybooking.task</field>
<field
name="inherit_id" ref="res.company.view.form.phone_validation" />
<field
name="priority" eval="15"/>
<field
name="arch" type="xml">
<xpath
expr="//field[@name='Name']" position="before">
<field
name="name"/>
</xpath>
<xpath
expr="//field[@name='Surname']" position="before">
<field
name="surname"/>
</xpath>
<xpath
expr="//field[@name='Data']" position="after">
<field
name="data"/>
</xpath>
<xpath
expr="//field[@name='Treatment required']" position="after">
<field
name="treatment"/>
</xpath>
<xpath
expr="//field[@name='Additional notes']" position="after">
<field
name="additionalNotes"/>
</xpath>
</field>
</record>
</odoo>
 mybooking_menu.xml
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<act_window id="action_mybooking_task"
name="My booking validation"
res_model="mybooking.task"
view_mode="tree,form" />
<menuitem id="menu_mybooking_task"
name="Booking"
action="action_mybooking_task" />
</odoo>
mybooking_model.py
# coding: utf8
from odoo import models, fields


class MyBooking(models.Model):
_name = 'mybooking.task'
_description = 'my custom booking task'
_inherit = 'phone.validation.mixin'
name = fields.Char('Name', required=True)
surname = fields.Char('Surname', required=True)
data = fields.Datetime('Data', default=fields.Datetime.now())
treatment = fields.Text('Treatment required')
additionalNotes = fields.Text('Additional notes')
1 备注
头像
丢弃
Avatar
alukard990
-

Please help me!

1 答案
0
Avatar
Shurshilov Artem
Best Answer

Because this is abstract model.

https://github.com/odoo/odoo/blob/1868713dbd07e0b518f91dffe73e62d85e6ab9a6/addons/phone_validation/models/phone_validation_mixin.py#L8

You need
class MyBooking(models.AbstractModel):

头像
丢弃