Merge lp:~openerp-dev/openobject-server/trunk-bug-753653-nco into lp:openobject-server

Proposed by Nimesh Contractor(Open ERP)
Status: Rejected
Rejected by: Antony Lesuisse (OpenERP)
Proposed branch: lp:~openerp-dev/openobject-server/trunk-bug-753653-nco
Merge into: lp:openobject-server
Diff against target: 17 lines (+6/-0)
1 file modified
openerp/addons/base/ir/ir_model.py (+6/-0)
To merge this branch: bzr merge lp:~openerp-dev/openobject-server/trunk-bug-753653-nco
Reviewer Review Type Date Requested Status
Naresh(OpenERP) (community) Approve
Review via email: mp+66859@code.launchpad.net

Description of the change

Hello sir,

         Problem with duplication of custom object, for that put the _sql_constraints.

Thank You.

To post a comment you must log in.
Revision history for this message
Naresh(OpenERP) (nch-openerp) :
review: Approve
Revision history for this message
Naresh(OpenERP) (nch-openerp) wrote :

override copy method too

3498. By Nimesh Contractor(Open ERP)

[IMP]: added copy method

3499. By Nimesh Contractor(Open ERP)

[IMP]: Change in raise in copy method

Revision history for this message
Antony Lesuisse (OpenERP) (al-openerp) wrote :

Similar patch has been commited in 3615 revid:<email address hidden>

Unmerged revisions

3499. By Nimesh Contractor(Open ERP)

[IMP]: Change in raise in copy method

3498. By Nimesh Contractor(Open ERP)

[IMP]: added copy method

3497. By Nimesh Contractor(Open ERP)

Problem with duplication of custom object

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'openerp/addons/base/ir/ir_model.py'
2--- openerp/addons/base/ir/ir_model.py 2011-06-24 13:33:35 +0000
3+++ openerp/addons/base/ir/ir_model.py 2011-07-06 10:18:33 +0000
4@@ -102,7 +102,13 @@
5 'model': lambda *a: 'x_',
6 'state': lambda self,cr,uid,ctx=None: (ctx and ctx.get('manual',False)) and 'manual' or 'base',
7 }
8+ _sql_constraints = [
9+ ('model_name_uniq', 'unique(name, model)', 'Duplication of models is not allowed, models must be created unique and manually !'),
10+ ]
11
12+ def copy(self, cr, uid, id, default=None, context=None):
13+ raise osv.except_osv (_('Error'), _("Duplicating ir.models is not allowed at all !"))
14+
15 def _check_model_name(self, cr, uid, ids, context=None):
16 for model in self.browse(cr, uid, ids, context=context):
17 if model.state=='manual':