[FIX] sale: deposit product auto creation as sudo
By default, users can only create/edit/unlink personal `ir.values`, the values with themself as `user_id`. Setting the default `deposit_product_id` should therefore be done as sudo in case if the `deposit_product_id` default value has already been created before by another user but is no longer valid. opw-660180
This commit is contained in:
@@ -110,7 +110,7 @@ class SaleAdvancePaymentInv(models.TransientModel):
|
||||
if not self.product_id:
|
||||
vals = self._prepare_deposit_product()
|
||||
self.product_id = self.env['product.product'].create(vals)
|
||||
self.env['ir.values'].set_default('sale.config.settings', 'deposit_product_id_setting', self.product_id.id)
|
||||
self.env['ir.values'].sudo().set_default('sale.config.settings', 'deposit_product_id_setting', self.product_id.id)
|
||||
|
||||
sale_line_obj = self.env['sale.order.line']
|
||||
for order in sale_orders:
|
||||
|
||||
Reference in New Issue
Block a user