From 336b1a8202b54a91dbde70edc81befd1cce388fe Mon Sep 17 00:00:00 2001 From: Andrea Date: Wed, 22 May 2019 13:14:34 +0200 Subject: [PATCH] [FIX] Invoice cost center readonly if not draft --- account_cost_center/models/account_invoice.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/account_cost_center/models/account_invoice.py b/account_cost_center/models/account_invoice.py index fa86d4d25..770ad79ff 100644 --- a/account_cost_center/models/account_invoice.py +++ b/account_cost_center/models/account_invoice.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2015-2018 Onestein () +# Copyright 2015-2019 Onestein () # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). from odoo import api, fields, models @@ -11,7 +11,9 @@ class AccountInvoice(models.Model): cost_center_id = fields.Many2one( 'account.cost.center', string='Cost Center', - help='Default Cost Center' + readonly=True, + states={'draft': [('readonly', False)]}, + help='Default Cost Center', ) @api.model