From 026be48ccbbb15daefda070697b135f089f49564 Mon Sep 17 00:00:00 2001 From: Kinjal Mehta <kme@odoo.com> Date: Thu, 22 Mar 2018 20:18:24 +0530 Subject: [PATCH] [FIX] purchase: "product_type" related field on po line Issue: Currently, since "product_type" is not set readonly, it is triggering write() of product.product model when saving a PO having PO line with product_id. And it is failing by throwing access error for users belonging to purchase "User" group users due to the fact that write() is permissible to purchase "Manager" group users only. Solution: Made the "product_type" related field readonly since it is used in purchase order views domain with lone purpose to set "received_qty" field non-editable when order line product is of type stockable/consumable. task id 1818787 --- addons/purchase/models/purchase.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/purchase/models/purchase.py b/addons/purchase/models/purchase.py index 94b00480bf18..f068dbf9af13 100644 --- a/addons/purchase/models/purchase.py +++ b/addons/purchase/models/purchase.py @@ -647,7 +647,7 @@ class PurchaseOrderLine(models.Model): product_image = fields.Binary( 'Product Image', related="product_id.image", help="Non-stored related field to allow portal user to see the image of the product he has ordered") - product_type = fields.Selection(related='product_id.type') + product_type = fields.Selection(related='product_id.type', readonly=True) move_ids = fields.One2many('stock.move', 'purchase_line_id', string='Reservation', readonly=True, ondelete='set null', copy=False) price_unit = fields.Float(string='Unit Price', required=True, digits=dp.get_precision('Product Price')) -- GitLab