This question has been flagged
2 Replies
5161 Views


Odoo 12.0

My app was working fine until this morning, from when I cannot display new models through views. I did create a model with name mixed of "." and "_", i.e, "ex_employees.ex_employees" that i removed since then, and I wonder if it is forbidden to do so and if it didn't break something in the database.

I created a new model with "_inherit" from another model and giving it a new "_name", and as I was not able to display it, I created another model without inheritance just to see if it was working but it did not work either.

No error is triggered, update of the app works but doesn't display the new models. I did look deep into the database, to see if there was a naming problem but I see that records of views and actions are deleted as we remove them. Models and records of models inside ir.model are not deleted when the model is deleted in our code. So I deleted the old models that could cause problems such as "ex_employees.ex_employees". I don't know what's wrong.

Thanks for your help.

Python code:

class ex_employees(models.Model): 
_name = 'exemployees.exemployees' 
_inherit = 'adults.adults'
_description = 'Employés partis'
def move_to_ex_employees(self): 
    pass

class tadam(models.Model):

_name = 'tadam.tadam'
_description = 'tadam'

name = fields.Char()


Xml action menu and views:

<record id="ex_employees" model="ir.actions.act_window">
<field name="name">Xx</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">exemployees.exemployees</field>
<field name="view_mode">tree,form</field>

</record>
<menuitem name="Xxxx" id="menu_16" parent="diderot_root" action="ex_employees" groups="group_administrators" sequence="1"/>

<record id="ex_employees_form_view1" model="ir.ui.view">
<field name="name">exemployees.form</field>
<field name="model">exemployees.exemployees</field>
<field name="arch" type="xml">
<form string="Anciens employés">
<header>
</header>
<sheet>
<group>
<group string="Informations personnelles">

<field name="nom" style="text-transform: uppercase;"/>
<field name="prenom" style="text-transform: capitalize;"/>
<field name="dte_naiss" />
<field name="adresse" widget="adresse" class="o_address_format" placeholder="Adresse..."/>
<field name="email" widget="email" placeholder="votremail@gmail.com"/>
<field name="tel" widget="Phone" placeholder="+212"/>
<field name="cin" style="text-transform: uppercase" colspan="4"/>
<field name="num_cnss" style="text-transform: uppercase;"/>
<field name="statut_marital" widget='radio' style="width:50%%" options="{'horizontal':true}"/>
<field name="nbr_enfants"/>
<field name="civilite"/>
</group>

<group>
<separator string="Informations professionnelles"/>
<field name="company_id" invisible="1"/>
<field name="currency_id" invisible="1"/>
<field name="salaire_init" />
<field name="salaire_actu" />
<field name="catégorie" />
<field name="fonction" />
<field name="classe" widget="selection" />
<field name="dte_embauche"/>
<field name="dte_sortie"/>
</group>
</group>
</sheet>
</form>
</field>
</record>

<record id="ex_employees_tree_view1" model="ir.ui.view">
<field name="name">exemployees.tree</field>
<field name="model">exemployees.exemployees</field>
<field name="arch" type="xml">
<tree string="Anciens employés">

<field name="nom" />
<field name="prenom" />
<field name="dte_naiss" />
<field name="cin"/>
<field name="tel" />
<field name="email" />
<field name="adresse"/>
<field name="num_cnss"/>
<field name="catégorie"/>
<field name="fonction"/>
<field name="dte_embauche"/>

</tree>
</field>
</record>


Avatar
Discard
Author

Solved. Stupid mistake, too much thinking results in such things.


Thanks

Best Answer

Hi,

Make sure that the access rights are given for the newly created models. If the access rights is not set, the views and menu wont become visible. Also you can check the same by switching into the Super User Mode.

1. Super User Mode

2. Create Module in Odoo12

Thanks

Avatar
Discard
Best Answer

@Clément você ainda está no Brasil??? nos contate lliege@lliege.com.br

Avatar
Discard