Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
2 Відповіді
7176 Переглядів

The operation cannot be completed, probably due to the following:


- deletion: you may be trying to delete a record while other records still reference it -


creation/update: a mandatory field is not correctly set


[object with reference: name - name]




class Employee(models.Model):




    _name = "hr.employee"


    _description = "Employee"


    _order = 'name_related'


    _inherits = {'resource.resource': "resource_id"}


    # _inherit = 'res.partner'


    _inherit = ['mail.thread']


    _inherit = 'res.partner'


    firstname = fields.Char("First name")


    lastname = fields.Char("Last name")


    name = fields.Char(compute='comp_name', store=True)


    @api.depends('firstname','lastname')


    def comp_name(self):


        self.name = (self.firstname or '')+' '+(self.lastname or '')




 can i get any solution please??

Аватар
Відмінити
Найкраща відповідь

This because name is defined as required in Python, you can try these two solution

1- Make default value for field name, Example :

_defaults = {

        'name': '/',

        }


2- Check your function:  comp_name

Аватар
Відмінити
Автор Найкраща відповідь

I'm using version odoo 10. so,  what will be the exact thing for the  [object with reference: name - name]


thank you

Аватар
Відмінити
Related Posts Відповіді Переглядів Дія
1
черв. 24
3487
5
груд. 19
6535
1
бер. 15
4625
2
лют. 24
1126
1
серп. 23
2647