diff --git a/mass_mailing_partner/__manifest__.py b/mass_mailing_partner/__manifest__.py index 3c045a7e..096c2cbd 100644 --- a/mass_mailing_partner/__manifest__.py +++ b/mass_mailing_partner/__manifest__.py @@ -7,7 +7,7 @@ { "name": "Link partners with mass-mailing", - "version": "10.0.1.0.0", + "version": "10.0.1.0.1", "author": "Tecnativa, " "Odoo Community Association (OCA)", "website": "https://www.tecnativa.com", diff --git a/mass_mailing_partner/models/res_partner.py b/mass_mailing_partner/models/res_partner.py index 0df7d322..10f07b43 100644 --- a/mass_mailing_partner/models/res_partner.py +++ b/mass_mailing_partner/models/res_partner.py @@ -19,7 +19,8 @@ class ResPartner(models.Model): comodel_name='mail.mass_mailing.contact', inverse_name='partner_id') mass_mailing_contacts_count = fields.Integer( string='Mailing list number', - compute='_compute_mass_mailing_contacts_count', store=True) + compute='_compute_mass_mailing_contacts_count', store=True, + compute_sudo=True) mass_mailing_stats = fields.One2many( string="Mass mailing stats", comodel_name='mail.mail.statistics', inverse_name='partner_id') @@ -30,7 +31,7 @@ class ResPartner(models.Model): @api.constrains('email') def _check_email_mass_mailing_contacts(self): for partner in self: - if partner.mass_mailing_contact_ids and not partner.email: + if partner.sudo().mass_mailing_contact_ids and not partner.email: raise ValidationError( _("This partner '%s' is subscribed to one or more " "mailing lists. Email must be assigned.") % partner.name) diff --git a/mass_mailing_partner/views/res_partner_view.xml b/mass_mailing_partner/views/res_partner_view.xml index 3e38dc14..21bafd7b 100644 --- a/mass_mailing_partner/views/res_partner_view.xml +++ b/mass_mailing_partner/views/res_partner_view.xml @@ -10,6 +10,7 @@ Partner Form with mailing contacts res.partner +