[FIX]make reason fields readonly if in done state

This commit is contained in:
Ruchir Shukla
2020-09-16 11:35:39 +05:30
committed by GuillemCForgeFlow
parent 07b5dd96bf
commit 128b6112d7

View File

@@ -6,8 +6,13 @@ from odoo import api, fields, models
class StockInventory(models.Model):
_inherit = "stock.inventory"
reason = fields.Char(help="Type in a reason for the " "product quantity change")
preset_reason_id = fields.Many2one("stock.inventory.line.reason")
reason = fields.Char(
help="Type in a reason for the " "product quantity change",
states={"done": [("readonly", True)]},
)
preset_reason_id = fields.Many2one(
"stock.inventory.line.reason", states={"done": [("readonly", True)]}
)
def _get_inventory_lines_values(self):
vals = super(StockInventory, self)._get_inventory_lines_values()