Skip to Content
Menu
This question has been flagged
2 Replies
3731 Views

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')
Avatar
Discard
Author

Please help me!

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):

Avatar
Discard
Related Posts Replies Views Activity
1
Nov 22
1955
2
Mar 18
3715
3
Sep 19
6320
3
Apr 19
2473
1
Aug 24
424