1
# -*- encoding: utf-8 -*-
2
##############################################################################
4
# Copyright (c) 2005-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
6
# WARNING: This program as such is intended to be used by professional
7
# programmers who take the whole responsability of assessing all potential
8
# consequences resulting from its eventual inadequacies and bugs
9
# End users who are looking for a ready-to-use solution with commercial
10
# garantees and support are strongly adviced to contract a Free Software
13
# This program is Free Software; you can redistribute it and/or
14
# modify it under the terms of the GNU General Public License
15
# as published by the Free Software Foundation; either version 2
16
# of the License, or (at your option) any later version.
18
# This program is distributed in the hope that it will be useful,
19
# but WITHOUT ANY WARRANTY; without even the implied warranty of
20
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
# GNU General Public License for more details.
23
# You should have received a copy of the GNU General Public License
24
# along with this program; if not, write to the Free Software
25
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27
##############################################################################
31
# - Order if the virtual stock of today is bellow the min of the defined order point
37
parameter_form = '''<?xml version="1.0"?>
38
<form string="Campaign Group" colspan="4">
39
<field name="project_id"
44
'project_id': {'string':'Project', 'type':'many2one', 'required':True, 'relation':'project.project', 'domain': [('active','<>',False)]},
47
def _create_duplicate(self, cr, uid, data, context):
48
print context,"---------------------------------------------------------------------"
49
campaign_group_obj=pooler.get_pool(cr.dbname).get('dm.campaign.group')
50
project_obj = pooler.get_pool(cr.dbname).get('project.project')
51
duplicate_project_id= project_obj.copy(cr, uid,data['form']['project_id'], {'active': True})
52
campaign = campaign_group_obj.browse(cr, uid, data['id'])
53
project_obj.write(cr, uid, duplicate_project_id, {'name': project_obj.browse(cr, uid, duplicate_project_id, context).name + " for " + campaign.name})
54
campaign_group_obj.write(cr, uid, [data['id']], {'project_id': duplicate_project_id})
57
class wizard_campaign_group_project(wizard.interface):
61
'result': {'type': 'form', 'arch':parameter_form, 'fields': parameter_fields, 'state':[('end','Cancel'),('done', 'Ok')]}
65
'actions':[_create_duplicate],
66
'result' : {'type':'state', 'state':'end'}
69
wizard_campaign_group_project('campaign.group.project')
71
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: