Skip to content
Snippets Groups Projects
Commit c3489b66 authored by Denis Ledoux's avatar Denis Ledoux
Browse files

[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
parent a678bd4e
Branches
Tags
No related merge requests found
......@@ -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:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment