Skip to content
Snippets Groups Projects
Commit bbe5410a authored by Antony Lesuisse's avatar Antony Lesuisse
Browse files

[FIX] res widget cleanup

bzr revid: al@openerp.com-20101015161725-v90bhsqkw6bfv9pn
parent b669208c
No related branches found
No related tags found
No related merge requests found
......@@ -37,4 +37,17 @@ class res_widget_user(osv.osv):
'widget_id': fields.many2one('res.widget','Widget'),
}
res_widget_user()
class res_widget_wizard(osv.osv_memory):
_name = "res.widget.wizard"
_description = "Add a widget"
_columns = {
'widget_id': fields.one2many("res.widget", 'Widget', required=True),
}
def widget_add(self, cr, uid, ids, context=None):
if context is None:
context = {}
wizard = self.read(cr, uid, ids)[0]
self.pool.get('res.widget.user').create(cr, uid, {'user_id':uid, 'widget_id':wizard['widget_id']})
return {}
res_widget_wizard()
......@@ -39,4 +39,4 @@ new TWTR.Widget({
</script>]]> </field>
</record>
</data>
</openerp>
\ No newline at end of file
</openerp>
......@@ -11,7 +11,6 @@
</search>
</field>
</record>
<record id="res_widget_form" model="ir.ui.view">
<field name="name">res.widget.form</field>
<field name="model">res.widget</field>
......@@ -41,12 +40,7 @@
<field name="view_mode">tree,form</field>
<field name="search_view_id" ref="view_res_widget_search"/>
</record>
<menuitem
action="res_widget_act_window"
id="menu_res_widget_act_window"
parent="base.next_id_2"
/>
<menuitem action="res_widget_act_window" id="menu_res_widget_act_window" parent="base.next_id_2" />
<record id="res_widget_user_tree" model="ir.ui.view">
<field name="name">res.widget.user.tree</field>
......@@ -60,7 +54,6 @@
</tree>
</field>
</record>
<record id="res_widget_user_form" model="ir.ui.view">
<field name="name">res.widget.user.form</field>
<field name="model">res.widget.user</field>
......@@ -73,27 +66,28 @@
</form>
</field>
</record>
<record id="res_widget_user_act_window" model="ir.actions.act_window">
<field name="name">Res user Widgets</field>
<field name="res_model">res.widget.user</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
</record>
<menuitem
action="res_widget_user_act_window"
id="menu_res_widget_user_act_window"
parent="base.menu_users"
/>
<act_window name="Res Widget Wizard"
res_model="res.widget.wizard"
src_model="res.widget.user"
view_mode="form"
target="new"
key2="client_action_multi"
id="action_res_widget_wizard"/>
<menuitem action="res_widget_user_act_window" id="menu_res_widget_user_act_window" parent="base.menu_users" />
<!--
<record id="view_res_widget_wizard" model="ir.ui.view">
<field name="name">Res Widget Wizard</field>
<field name="model">res.widget.wizard</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Res Widget" col="4">
<field name="res_widget"/>
<newline/>
<button name="res_widget_add" string="Add Widget" type="object"/>
</form>
</field>
</record>
<act_window name="Res Widget Wizard" res_model="res.widget.wizard" src_model="res.widget.user" view_mode="form" target="new" key2="client_action_multi" id="action_res_widget_wizard"/>
-->
</data>
</openerp>
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 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_wizard(osv.osv_memory):
_name = "res.widget.wizard"
_description = "Res Widget Wizard"
_columns = {
'res_widget': fields.one2many("res.widget", 'widget_res', 'Res Widget', required=True),
}
def res_widget_add(self, cr, uid, ids, context=None):
if context is None:
context = {}
res_widget = self.read(cr, uid, ids)[0]
self.pool.get('res.widget').write(cr, uid, res_widget['res_widget'],{'widget_res':context['active_ids'][0]})
return {}
res_widget_wizard()
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_res_widget_wizard" model="ir.ui.view">
<field name="name">Res Widget Wizard</field>
<field name="model">res.widget.wizard</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Res Widget" col="4">
<field name="res_widget"/>
<newline/>
<button name="res_widget_add" string="Add Widget" type="object"/>
</form>
</field>
</record>
</data>
</openerp>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment