From 9fa73d10cf503c72b12d8421193b1981abba66ff Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Wed, 3 Feb 2016 18:31:09 +0100 Subject: [PATCH] [FIX] account: set `payment_method_code` as readonly The payment method code is not supposed to be changed from an `account.payment`. Besides, this field is only used for technical reasons, as stated: ``` Technical field used to adapt the interface to the payment type selected. ``` There is therefore no reason to not set it as readonly. Not setting it as reandonly could lead to a `write` operation on the `account.payment.method` with the value of the code, even if this is already that one set, and such an operation could be prevented by the access rights. opw-668624 --- addons/account/models/account_payment.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/models/account_payment.py b/addons/account/models/account_payment.py index 6da8085e961..d9202d319fe 100644 --- a/addons/account/models/account_payment.py +++ b/addons/account/models/account_payment.py @@ -33,7 +33,7 @@ class account_abstract_payment(models.AbstractModel): payment_type = fields.Selection([('outbound', 'Send Money'), ('inbound', 'Receive Money')], string='Payment Type', required=True) payment_method_id = fields.Many2one('account.payment.method', string='Payment Type', required=True, oldname="payment_method") payment_method_code = fields.Char(related='payment_method_id.code', - help="Technical field used to adapt the interface to the payment type selected.") + help="Technical field used to adapt the interface to the payment type selected.", readonly=True) partner_type = fields.Selection([('customer', 'Customer'), ('supplier', 'Vendor')]) partner_id = fields.Many2one('res.partner', string='Partner')