# -*- coding: utf-8 -*-
##############################################################################
#
#    OpenERP, Open Source Management Solution
#    Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU Affero General Public License as
#    published by the Free Software Foundation, either version 3 of the
#    License, or (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU Affero General Public License for more details.
#
#    You should have received a copy of the GNU Affero General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################

from osv import fields,osv
class res_widget(osv.osv):
    _name = "res.widget"
res_widget()

class res_widget_user(osv.osv):
    _name="res.widget.user"
    _columns = {
        'sequence': fields.integer('Sequence'),
        'user_id': fields.one2many('res.users', 'widget_user', 'Users'),
        'widget_id': fields.one2many('res.widget', 'widget_res', 'Widgets'),
    }
res_widget_user() 

class res_users(osv.osv):
    _inherit = 'res.users'
    _columns = {
        'widget_user': fields.many2one('res.widget.user', 'Widget User'),
    }
res_users()

class res_widget(osv.osv):
    _inherit = "res.widget"
    _rec_name = "title"
    _columns = {
        'title' : fields.char('Title', size=64, required=True),
        'content': fields.text('Content', required=True),
        'widget_res': fields.many2one('res.widget.user', 'Widget')
    }
res_widget()

@@ -1055,80 +1055,30 @@
 et%22%0A
-res_widget()%0A%0Aclass res_widget_user(osv.osv):%0A    _name=%22res.widget.user
+    _rec_name = %22title
 %22%0A  
@@ -1105,17 +1105,15 @@
    '
-sequenc
+titl
 e'
+ 
 : fi
@@ -1121,99 +1121,44 @@
 lds.
-integer('Sequence'),%0A        'user_id': fields.one2many('res.users', 'widget_user', 'Users'
+char('Title', size=64, required=True
 ),%0A 
@@ -1169,17 +1169,15 @@
    '
-widget_id
+content
 ': f
@@ -1186,54 +1186,37 @@
 lds.
-one2many('res.widget', 'widget_res', 'Widgets'
+text('Content', required=True
 ),%0A 
@@ -1234,16 +1234,10 @@
 dget
-_user
 ()
- 
 %0A%0Acl
@@ -1248,177 +1248,19 @@
 res_
-users(osv.osv):%0A    _inherit = 'res.users'%0A    _columns = %7B%0A        'widget_user': fields.many2one('res.widget.user', 'Widget User'),%0A    %7D%0Ares_users()%0A%0Aclass res_
 widget
+_user
 (osv
@@ -1275,18 +1275,13 @@
    _
-inherit = 
+name=
 %22res
@@ -1291,32 +1291,13 @@
 dget
-%22%0A    _rec_name = %22title
+.user
 %22%0A  
@@ -1312,39 +1312,41 @@
 ns = %7B%0A        '
-titl
+sequenc
 e'
- 
 : fields.char('T
@@ -1342,44 +1342,26 @@
 lds.
-char('Title', size=64, required=True
+integer('Sequence'
 ),%0A 
@@ -1360,39 +1360,39 @@
 nce'),%0A        '
-content
+user_id
 ': fields.text('
@@ -1389,37 +1389,35 @@
 lds.
-text('Content', required=True
+many2one('res.users','User'
 ),%0A 
@@ -1431,19 +1431,18 @@
 'widget_
-res
+id
 ': field
@@ -1467,16 +1467,10 @@
 dget
-.user
 ',
- 
 'Wid
@@ -1474,16 +1474,17 @@
 Widget')
+,
 %0A    %7D%0Ar
@@ -1476,27 +1476,33 @@
 dget'),%0A    %7D%0Ares_widget
+_user
 ()%0A
+%0A

correct and simplify res_widget