Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
2 Odpovědi
4702 Zobrazení

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
Zrušit
Autor

Please help me!

Nejlepší odpověď

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
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
1
lis 22
3251
2
bře 18
4769
3
zář 19
7383
3
dub 19
3312
4
úno 25
2367