From 2c760935afa94c0a3017ec2c8ff0243c33785f99 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Thu, 21 Jan 2016 23:15:00 +0100 Subject: [PATCH] FIX access rights because by missing readonly=True on related field --- sale_stock_usability/sale_stock.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/sale_stock_usability/sale_stock.py b/sale_stock_usability/sale_stock.py index 2f706e2..47cb712 100644 --- a/sale_stock_usability/sale_stock.py +++ b/sale_stock_usability/sale_stock.py @@ -28,3 +28,15 @@ class SaleOrder(models.Model): warehouse_id = fields.Many2one(track_visibility='onchange') incoterm = fields.Many2one(track_visibility='onchange') + + +class SaleOrderLine(models.Model): + _inherit = 'sale.order.line' + + # The sale_stock module defines the field product_tmpl_id as related + # field without readonly=True, which causes some access right issues + # when you change the product on a sale.order.line and you don't have + # write access on product.product + product_tmpl_id = fields.Many2one( + 'product.template', related='product_id.product_tmpl_id', + string='Product Template', readonly=True)