diff --git a/addons/marketing_campaign/models/__init__.py b/addons/marketing_campaign/models/__init__.py index d02bca25c43..70b017971bc 100644 --- a/addons/marketing_campaign/models/__init__.py +++ b/addons/marketing_campaign/models/__init__.py @@ -1,4 +1,6 @@ # -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. -import marketing_campaign +import ir_actions +import mail_template +import marketing_campaign \ No newline at end of file diff --git a/addons/marketing_campaign/models/ir_actions.py b/addons/marketing_campaign/models/ir_actions.py new file mode 100644 index 00000000000..5883400f7d0 --- /dev/null +++ b/addons/marketing_campaign/models/ir_actions.py @@ -0,0 +1,15 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +from openerp.osv import osv + +class report_xml(osv.osv): + _inherit = 'ir.actions.report.xml' + def search(self, cr, uid, args, offset=0, limit=None, order=None, context=None, count=False): + if context is None: + context = {} + object_id = context.get('object_id') + if object_id: + model = self.pool.get('ir.model').browse(cr, uid, object_id, context=context).model + args.append(('model', '=', model)) + return super(report_xml, self).search(cr, uid, args, offset=offset, limit=limit, order=order, context=context, count=count) diff --git a/addons/marketing_campaign/models/mail_template.py b/addons/marketing_campaign/models/mail_template.py new file mode 100644 index 00000000000..6a8d1a47d2c --- /dev/null +++ b/addons/marketing_campaign/models/mail_template.py @@ -0,0 +1,14 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +from openerp.osv import osv + +class mail_template(osv.osv): + _inherit = "mail.template" + _defaults = { + 'model_id': lambda obj, cr, uid, context: context.get('object_id',False), + } + + # TODO: add constraint to prevent disabling / disapproving an email account used in a running campaign + + diff --git a/addons/marketing_campaign/models/marketing_campaign.py b/addons/marketing_campaign/models/marketing_campaign.py index 9b1e9bad619..9f2ea252fe0 100644 --- a/addons/marketing_campaign/models/marketing_campaign.py +++ b/addons/marketing_campaign/models/marketing_campaign.py @@ -777,23 +777,3 @@ class marketing_campaign_workitem(osv.osv): raise UserError(_('The current step for this item has no email or report to preview.')) return res - -class mail_template(osv.osv): - _inherit = "mail.template" - _defaults = { - 'model_id': lambda obj, cr, uid, context: context.get('object_id',False), - } - - # TODO: add constraint to prevent disabling / disapproving an email account used in a running campaign - - -class report_xml(osv.osv): - _inherit = 'ir.actions.report.xml' - def search(self, cr, uid, args, offset=0, limit=None, order=None, context=None, count=False): - if context is None: - context = {} - object_id = context.get('object_id') - if object_id: - model = self.pool.get('ir.model').browse(cr, uid, object_id, context=context).model - args.append(('model', '=', model)) - return super(report_xml, self).search(cr, uid, args, offset=offset, limit=limit, order=order, context=context, count=count)