Skip to content
Snippets Groups Projects
Commit 026be48c authored by Kinjal Mehta's avatar Kinjal Mehta Committed by Simon Lejeune
Browse files

[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
parent cc583a4a
No related branches found
No related tags found
No related merge requests found
......@@ -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'))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment