This question has been flagged
1 Reply
4750 Views

OpenErp Version 7.0-20130623-231037

When trying to duplicate a company with "More - Duplicate" button, following error occurs:

*OpenERP Warning

Integrity Error
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: y1= - y1=]*

All fields have been entered, except for fax, tagline, website.

How to resolve this error? Thanks Gerard

Avatar
Discard

I have this error too, how to resovle it?

Arrrgggghhhhhh when I saw this titled exactly as my issue I got excited. I should have known it would be just like most of OpenERP bugs and ignored.

They've known about it since 2012 at least. https://bugs.launchpad.net/openobject-server/+bug/1071691 This must be a major issue that has lasted so long in their code. It's just a bug after all, and doesn't align with trying to change the company to Odoo and milk more money from a pricing model. Rest assured everyone, they've worked on their pricing model since 2012 and we will just have to wait for them to work on bugs.

Best Answer

Override Copy method to change the unique field value in res.company.

Example,

class res_company(osv.osv):
    _inherit = "res.company"

    def copy(self, cr, uid, id, default=None, context=None):
        company_name = self.read(cr, uid, [id], ['name'])[0]['name']
        default.update({'name': _('%s (copy)')% company_name})
        return super(res_company, self).copy(cr, uid, id, default, context)

 

 

Avatar
Discard