[FIX] mass_mailing: model declaration order
mail.mass_mailing.contact needs the model mail.mass_mailing.list to be defined before itself, as some fields need this model. opw-643482
This commit is contained in:
parent
b6a580a25d
commit
bae35b20dd
|
@ -24,6 +24,28 @@ class MassMailingCategory(osv.Model):
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class MassMailingList(osv.Model):
|
||||||
|
"""Model of a contact list. """
|
||||||
|
_name = 'mail.mass_mailing.list'
|
||||||
|
_order = 'name'
|
||||||
|
_description = 'Mailing List'
|
||||||
|
|
||||||
|
def _get_contact_nbr(self, cr, uid, ids, name, arg, context=None):
|
||||||
|
result = dict.fromkeys(ids, 0)
|
||||||
|
Contacts = self.pool.get('mail.mass_mailing.contact')
|
||||||
|
for group in Contacts.read_group(cr, uid, [('list_id', 'in', ids), ('opt_out', '!=', True)], ['list_id'], ['list_id'], context=context):
|
||||||
|
result[group['list_id'][0]] = group['list_id_count']
|
||||||
|
return result
|
||||||
|
|
||||||
|
_columns = {
|
||||||
|
'name': fields.char('Mailing List', required=True),
|
||||||
|
'contact_nbr': fields.function(
|
||||||
|
_get_contact_nbr, type='integer',
|
||||||
|
string='Number of Contacts',
|
||||||
|
),
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
class MassMailingContact(osv.Model):
|
class MassMailingContact(osv.Model):
|
||||||
"""Model of a contact. This model is different from the partner model
|
"""Model of a contact. This model is different from the partner model
|
||||||
because it holds only some basic information: name, email. The purpose is to
|
because it holds only some basic information: name, email. The purpose is to
|
||||||
|
@ -79,28 +101,6 @@ class MassMailingContact(osv.Model):
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
|
||||||
class MassMailingList(osv.Model):
|
|
||||||
"""Model of a contact list. """
|
|
||||||
_name = 'mail.mass_mailing.list'
|
|
||||||
_order = 'name'
|
|
||||||
_description = 'Mailing List'
|
|
||||||
|
|
||||||
def _get_contact_nbr(self, cr, uid, ids, name, arg, context=None):
|
|
||||||
result = dict.fromkeys(ids, 0)
|
|
||||||
Contacts = self.pool.get('mail.mass_mailing.contact')
|
|
||||||
for group in Contacts.read_group(cr, uid, [('list_id', 'in', ids), ('opt_out', '!=', True)], ['list_id'], ['list_id'], context=context):
|
|
||||||
result[group['list_id'][0]] = group['list_id_count']
|
|
||||||
return result
|
|
||||||
|
|
||||||
_columns = {
|
|
||||||
'name': fields.char('Mailing List', required=True),
|
|
||||||
'contact_nbr': fields.function(
|
|
||||||
_get_contact_nbr, type='integer',
|
|
||||||
string='Number of Contacts',
|
|
||||||
),
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
class MassMailingStage(osv.Model):
|
class MassMailingStage(osv.Model):
|
||||||
"""Stage for mass mailing campaigns. """
|
"""Stage for mass mailing campaigns. """
|
||||||
_name = 'mail.mass_mailing.stage'
|
_name = 'mail.mass_mailing.stage'
|
||||||
|
|
Loading…
Reference in New Issue