Odoo Warning - None The record entry is missing or has been deleted. When creating a new customer

Here is a screenshot of the warning that appears when creating clients

I can not create new clients in odoo. At first I made some settings in my module ... after this setting, my code worked absolutely correctly, I also created new clients ... but after I do not know why I can not create new clients ... please offer me some solution. thank

+5
source share
2 answers

I had a similar problem with a configured module in Odoo 10. I did a pretty thorough research, and Odoo ORM does some things that probably shouldn't be, and that I'm not smart enough to figure it out.

Sections in ODO 10 ORM API documentation on creating models and fields was useful, but ORM documentation is severely lacking and in some cases incorrect.

I eventually fixed this by manually inserting with the self.env.cr psycopg2 cursor , available in the user methods of the model.

It would look like

from odoo import models

class your_class(models.Model):
    def custom_create_method(self):
        self.env.cr.execute("""
            INSERT INTO customer_model_name
                (name, value, other_value)
            VALUES
                ('{}', '{}', '{}')
            RETURNING id;
        """)
        new_id = self.env.cr.fetchone()

This has the disadvantage of being able to inject SQL injection into your code, so you need to be careful.

, . , ORM , --- , .

, .

0

- , , / , . res __manifest__.py

:

  'depends': ['base', 'res', 'sale_management', 'account', 'account_payment'],
    #'depends': ['base', 'sale_management', 'account', 'account_payment'],

:

  #'depends': ['base', 'res', 'sale_management', 'account', 'account_payment'],
    'depends': ['base', 'sale_management', 'account', 'account_payment'],

, , , .

0

All Articles