diff --git a/bin/addons/base/__openerp__.py b/bin/addons/base/__openerp__.py
index c56bf67a90c..446461323aa 100644
--- a/bin/addons/base/__openerp__.py
+++ b/bin/addons/base/__openerp__.py
@@ -53,12 +53,14 @@
'res/res_log_view.xml',
'res/partner/partner_report.xml',
'res/partner/partner_view.xml',
- 'res/partner/partner_wizard.xml',
'res/bank_view.xml',
'res/country_view.xml',
- 'res/res_currency_view.xml',
+ 'res/res_currency_view.xml',
'res/partner/crm_view.xml',
'res/partner/wizard/partner_sms_send_view.xml',
+ 'res/partner/wizard/partner_wizard_spam_view.xml',
+ 'res/partner/wizard/partner_clear_ids_view.xml',
+# 'res/partner/wizard/partner_wizard_ean_check_view.xml',
'res/partner/partner_data.xml',
'res/ir_property_view.xml',
'security/base_security.xml',
diff --git a/bin/addons/base/res/partner/partner_wizard.xml b/bin/addons/base/res/partner/partner_wizard.xml
deleted file mode 100644
index cc62aa9c7bc..00000000000
--- a/bin/addons/base/res/partner/partner_wizard.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
diff --git a/bin/addons/base/res/partner/wizard/__init__.py b/bin/addons/base/res/partner/wizard/__init__.py
index f1a85740bf4..65869c366c4 100644
--- a/bin/addons/base/res/partner/wizard/__init__.py
+++ b/bin/addons/base/res/partner/wizard/__init__.py
@@ -19,10 +19,10 @@
#
##############################################################################
-import wizard_spam
-import wizard_clear_ids
-import wizard_ean_check
import partner_sms_send
+import partner_wizard_spam
+import partner_clear_ids
+import partner_wizard_ean_check
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/bin/addons/base/res/partner/wizard/wizard_clear_ids.py b/bin/addons/base/res/partner/wizard/partner_clear_ids.py
similarity index 52%
rename from bin/addons/base/res/partner/wizard/wizard_clear_ids.py
rename to bin/addons/base/res/partner/wizard/partner_clear_ids.py
index 083380905f9..880dbaed040 100644
--- a/bin/addons/base/res/partner/wizard/wizard_clear_ids.py
+++ b/bin/addons/base/res/partner/wizard/partner_clear_ids.py
@@ -1,8 +1,8 @@
# -*- coding: utf-8 -*-
##############################################################################
-#
+#
# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2009 Tiny SPRL ().
+# Copyright (C) 2004-2010 Tiny SPRL ().
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
@@ -15,26 +15,38 @@
# 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 .
+# along with this program. If not, see .
#
##############################################################################
-import wizard
import netsvc
+from osv import fields, osv
-class wizard_clear_ids(wizard.interface):
- def _clear_ids(self, cr, uid, data, context):
- service = netsvc.LocalService("object_proxy")
- service.execute(cr.dbname, uid, 'res.partner', 'write', data['ids'], {'ref': False})
- return {}
-
- states = {
- 'init': {
- 'actions': [_clear_ids],
- 'result': {'type':'state', 'state':'end'}
- }
- }
-wizard_clear_ids('res.partner.clear_ids')
+class partner_clear_ids(osv.osv_memory):
+ """ Clear IDs """
+
+ _name = "partner.clear.ids"
+ _description = "Clear IDs"
+
+ def clear_ids(self, cr, uid, ids, context):
+ """
+ Clear Ids
+
+ @param cr: the current row, from the database cursor.
+ @param uid: the current user’s ID for security checks.
+ @param ids: the ID or list of IDs
+ @param context: A standard dictionary
+ """
+
+ partner_pool = self.pool.get('res.partner')
+ active_ids = context and context.get('active_ids', [])
+ res = {}
+ for partner in partner_pool.browse(cr, uid, active_ids, context=context):
+ if active_ids in partner:
+ res.update({'ref': False})
+ return res
+
+partner_clear_ids()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/bin/addons/base/res/partner/wizard/partner_clear_ids_view.xml b/bin/addons/base/res/partner/wizard/partner_clear_ids_view.xml
new file mode 100644
index 00000000000..5bc5d747de2
--- /dev/null
+++ b/bin/addons/base/res/partner/wizard/partner_clear_ids_view.xml
@@ -0,0 +1,32 @@
+
+
+
+
+
+ Clear IDs
+ partner.clear.ids
+ form
+
+
+
+
+
+
+ Clear IDs
+ ir.actions.act_window
+ partner.clear.ids
+ form
+ form
+ new
+
+
+
+
\ No newline at end of file
diff --git a/bin/addons/base/res/partner/wizard/partner_wizard_ean_check.py b/bin/addons/base/res/partner/wizard/partner_wizard_ean_check.py
new file mode 100644
index 00000000000..8ee383c18f5
--- /dev/null
+++ b/bin/addons/base/res/partner/wizard/partner_wizard_ean_check.py
@@ -0,0 +1,77 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL ().
+#
+# 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 .
+#
+##############################################################################
+
+import math
+from osv import osv
+from tools.misc import UpdateableStr
+import pooler
+
+class partner_wizard_ean_check(osv.osv_memory):
+ """ Ean check """
+
+ _name = "partner.wizard.ean.check"
+ _description = "Ean Check"
+
+ def is_pair(x):
+ return not x%2
+
+ def get_ean_key(string):
+ if not string or string=='':
+ return '0'
+ if len(string)!=12:
+ return '0'
+ sum = 0
+ for i in range(12):
+ if is_pair(i):
+ sum = sum + int(string[i])
+ else:
+ sum = sum + 3*int(string[i])
+ return str(int(math.ceil(sum/10.0)*10-sum))
+
+ def default_get(self, cr, fields, context):
+ partner_table = self.pool.get('res.partner')
+ ids = context.get('active_ids')
+ partners = partner_table.browse(cr, uid, ids)
+ _check_arch_lst = ['', '')
+ _check_arch.string = '\n'.join(_check_arch_lst)
+
+ def update_ean(self, cr, uid, ids, context):
+ partner_table = self.pool.get('res.partner')
+ ids = context.get('active_ids')
+ partners = partner_table.browse(cr, uid, ids)
+ for partner in partners:
+ partner_table.write(cr, uid, ids, {
+ 'ean13': "%s%s" % (partner['ean13'][:12], get_ean_key(partner['ean13'][:12]))
+ })
+ return {}
+
+partner_wizard_ean_check()
\ No newline at end of file
diff --git a/bin/addons/base/res/partner/wizard/partner_wizard_ean_check_view.xml b/bin/addons/base/res/partner/wizard/partner_wizard_ean_check_view.xml
new file mode 100644
index 00000000000..9112f2ceed8
--- /dev/null
+++ b/bin/addons/base/res/partner/wizard/partner_wizard_ean_check_view.xml
@@ -0,0 +1,32 @@
+
+
+
+
+ Ean check
+ partner.wizard.ean.check
+ form
+
+
+
+
+
+
+ Ean check
+ ir.actions.act_window
+ partner.wizard.ean.check
+ form
+ form
+ new
+
+
+
+
\ No newline at end of file
diff --git a/bin/addons/base/res/partner/wizard/partner_wizard_spam.py b/bin/addons/base/res/partner/wizard/partner_wizard_spam.py
new file mode 100644
index 00000000000..8f85833d650
--- /dev/null
+++ b/bin/addons/base/res/partner/wizard/partner_wizard_spam.py
@@ -0,0 +1,72 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL ().
+#
+# 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 .
+#
+##############################################################################
+
+import netsvc
+import tools
+from osv import fields, osv
+
+class partner_wizard_spam(osv.osv_memory):
+ """ Mass Mailing """
+
+ _name = "partner.wizard.spam"
+ _description = "Mass Mailing"
+
+ _columns = {
+ 'email_from': fields.char("Sender's email", size=256, required=True),
+ 'subject': fields.char('Subject', size=256,required=True),
+ 'text': fields.text('Message',required=True),
+ }
+
+ def mass_mail_send(self, cr, uid, ids, context):
+ """
+ Send Email
+
+ @param cr: the current row, from the database cursor.
+ @param uid: the current user’s ID for security checks.
+ @param ids: the ID or list of IDs
+ @param context: A standard dictionary
+ """
+
+ nbr = 0
+ partner_pool = self.pool.get('res.partner')
+ data = self.browse(cr, uid, ids, context=context)
+ event_pool = self.pool.get('res.partner.event')
+ active_ids = context and context.get('active_ids', [])
+ partners = partner_pool.browse(cr, uid, active_ids, context)
+ for partner in partners:
+ for adr in partner.address:
+ if adr.email:
+ name = adr.name or partner.name
+ to = '%s <%s>' % (name, adr.email)
+ #TODO: add some tests to check for invalid email addresses
+ #CHECKME: maybe we should use res.partner/email_send
+ tools.email_send(data.email_from, [to], data.subject, data.text,subtype='html')
+ nbr += 1
+ event_pool.create(cr, uid,
+ {'name': 'Email sent through mass mailing',
+ 'partner_id': partner.id,
+ 'description': data.text })
+ #TODO: log number of message sent
+ return {'email_sent': nbr}
+
+partner_wizard_spam()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/bin/addons/base/res/partner/wizard/partner_wizard_spam_view.xml b/bin/addons/base/res/partner/wizard/partner_wizard_spam_view.xml
new file mode 100644
index 00000000000..b7c940b5a22
--- /dev/null
+++ b/bin/addons/base/res/partner/wizard/partner_wizard_spam_view.xml
@@ -0,0 +1,34 @@
+
+
+
+
+
+ Mass Mailing
+ partner.wizard.spam
+ form
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/bin/addons/base/res/partner/wizard/wizard_ean_check.py b/bin/addons/base/res/partner/wizard/wizard_ean_check.py
deleted file mode 100644
index cd757c232f5..00000000000
--- a/bin/addons/base/res/partner/wizard/wizard_ean_check.py
+++ /dev/null
@@ -1,98 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2009 Tiny SPRL ().
-#
-# 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 .
-#
-##############################################################################
-
-import wizard
-import math
-from osv import osv
-from tools.misc import UpdateableStr
-import pooler
-
-def _is_pair(x):
- return not x%2
-
-def _get_ean_key(string):
- if not string or string=='':
- return '0'
- if len(string)!=12:
- return '0'
- sum=0
- for i in range(12):
- if _is_pair(i):
- sum+=int(string[i])
- else:
- sum+=3*int(string[i])
- return str(int(math.ceil(sum/10.0)*10-sum))
-
-#FIXME: this is not concurrency safe !!!!
-_check_arch = UpdateableStr()
-_check_fields = {}
-
-def _check_key(self, cr, uid, data, context):
- partner_table=pooler.get_pool(cr.dbname).get('res.partner')
- partners = partner_table.browse(cr, uid, data['ids'])
- _check_arch_lst=['', '')
- _check_arch.string = '\n'.join(_check_arch_lst)
- return {}
-
-def _update_ean(self, cr, uid, data, context):
- partner_table = pooler.get_pool(cr.dbname).get('res.partner')
- partners = partner_table.browse(cr, uid, data['ids'])
- for partner in partners:
- partner_table.write(cr, uid, data['ids'], {
- 'ean13': "%s%s" % (partner['ean13'][:12], _get_ean_key(partner['ean13'][:12]))
- })
- return {}
-
-class wiz_ean_check(wizard.interface):
- states = {
- 'init': {
- 'actions': [_check_key],
- 'result': {
- 'type': 'form',
- 'arch': _check_arch,
- 'fields': _check_fields,
- 'state': (('end', 'Ignore'), ('correct', 'Correct EAN13'))
- }
- },
- 'correct' : {
- 'actions': [_update_ean],
- 'result': {
- 'type': 'state',
- 'state': 'end'
- }
- }
- }
-
-wiz_ean_check('res.partner.ean13')
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/bin/addons/base/res/partner/wizard/wizard_spam.py b/bin/addons/base/res/partner/wizard/wizard_spam.py
deleted file mode 100644
index c08baa898a4..00000000000
--- a/bin/addons/base/res/partner/wizard/wizard_spam.py
+++ /dev/null
@@ -1,75 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2009 Tiny SPRL ().
-#
-# 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 .
-#
-##############################################################################
-
-import wizard
-import pooler
-import tools
-
-email_send_form = '''
-'''
-
-email_send_fields = {
- 'from': {'string':"Sender's email", 'type':'char', 'size':64, 'required':True},
- 'subject': {'string':'Subject', 'type':'char', 'size':64, 'required':True},
- 'text': {'string':'Message', 'type':'text_tag', 'required':True}
-}
-
-# this sends an email to ALL the addresses of the selected partners.
-def _mass_mail_send(self, cr, uid, data, context):
- nbr = 0
- partners = pooler.get_pool(cr.dbname).get('res.partner').browse(cr, uid, data['ids'], context)
- for partner in partners:
- for adr in partner.address:
- if adr.email:
- name = adr.name or partner.name
- to = '%s <%s>' % (name, adr.email)
-#TODO: add some tests to check for invalid email addresses
-#CHECKME: maybe we should use res.partner/email_send
- tools.email_send(data['form']['from'], [to], data['form']['subject'], data['form']['text'],subtype='html')
- nbr += 1
- pooler.get_pool(cr.dbname).get('res.partner.event').create(cr, uid,
- {'name': 'Email sent through mass mailing',
- 'partner_id': partner.id,
- 'description': data['form']['text'], })
-#TODO: log number of message sent
- return {'email_sent': nbr}
-
-class part_email(wizard.interface):
- states = {
- 'init': {
- 'actions': [],
- 'result': {'type': 'form', 'arch': email_send_form, 'fields': email_send_fields, 'state':[('end','Cancel'), ('send','Send Email')]}
- },
- 'send': {
- 'actions': [_mass_mail_send],
- 'result': {'type': 'state', 'state':'end'}
- }
- }
-part_email('res.partner.spam_send')
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-