[FIX] event_sale: update registrations as sudo.

Consequence of 19878d011f
This commit is contained in:
Christophe Simonis
2018-05-15 19:19:51 +02:00
parent f1ae96e389
commit fb17edd0b0
+1 -1
View File
@@ -41,7 +41,7 @@ class SaleOrderLine(models.Model):
order line has a product_uom_qty attribute that will be the number of order line has a product_uom_qty attribute that will be the number of
registrations linked to this line. This method update existing registrations registrations linked to this line. This method update existing registrations
and create new one for missing one. """ and create new one for missing one. """
Registration = self.env['event.registration'] Registration = self.env['event.registration'].sudo()
registrations = Registration.search([('sale_order_line_id', 'in', self.ids), ('state', '!=', 'cancel')]) registrations = Registration.search([('sale_order_line_id', 'in', self.ids), ('state', '!=', 'cancel')])
for so_line in self.filtered('event_id'): for so_line in self.filtered('event_id'):
existing_registrations = registrations.filtered(lambda self: self.sale_order_line_id.id == so_line.id) existing_registrations = registrations.filtered(lambda self: self.sale_order_line_id.id == so_line.id)