Merge lp:~openerp-dev/openobject-server/trunk-bug-1161881-ishwar into lp:openobject-server

Proposed by Ishwar Malvi(OpenERP)
Status: Needs review
Proposed branch: lp:~openerp-dev/openobject-server/trunk-bug-1161881-ishwar
Merge into: lp:openobject-server
Diff against target: 25 lines (+8/-7)
1 file modified
openerp/osv/orm.py (+8/-7)
To merge this branch: bzr merge lp:~openerp-dev/openobject-server/trunk-bug-1161881-ishwar
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+157847@code.launchpad.net

Description of the change

Hello,

     I have fixed problem in custom model when adding many2many field.

Thank you.
Ishwar Malvi

To post a comment you must log in.

Unmerged revisions

4853. By Ishwar Malvi(OpenERP)

[FIX]Custom model : adding many2many field generates error

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'openerp/osv/orm.py'
--- openerp/osv/orm.py 2013-04-05 11:07:50 +0000
+++ openerp/osv/orm.py 2013-04-09 11:34:23 +0000
@@ -2865,13 +2865,14 @@
2865 Record the creation of a many2many for this model, to make it possible2865 Record the creation of a many2many for this model, to make it possible
2866 to delete it later when the module is uninstalled.2866 to delete it later when the module is uninstalled.
2867 """2867 """
2868 cr.execute("""2868 if self._module:
2869 SELECT 1 FROM ir_model_relation, ir_module_module2869 cr.execute("""
2870 WHERE ir_model_relation.module=ir_module_module.id2870 SELECT 1 FROM ir_model_relation, ir_module_module
2871 AND ir_model_relation.name=%s2871 WHERE ir_model_relation.module=ir_module_module.id
2872 AND ir_module_module.name=%s2872 AND ir_model_relation.name=%s
2873 """, (relation_table, self._module))2873 AND ir_module_module.name=%s
2874 if not cr.rowcount:2874 """, (relation_table, self._module))
2875 if not cr.rowcount and self._module:
2875 cr.execute("""INSERT INTO ir_model_relation (name, date_init, date_update, module, model)2876 cr.execute("""INSERT INTO ir_model_relation (name, date_init, date_update, module, model)
2876 VALUES (%s, now() AT TIME ZONE 'UTC', now() AT TIME ZONE 'UTC',2877 VALUES (%s, now() AT TIME ZONE 'UTC', now() AT TIME ZONE 'UTC',
2877 (SELECT id FROM ir_module_module WHERE name=%s),2878 (SELECT id FROM ir_module_module WHERE name=%s),