From 91bcd84a021383ecdd3c78fdd5106176c082b439 Mon Sep 17 00:00:00 2001 From: Duc Dao Date: Wed, 28 Mar 2018 00:42:44 +0700 Subject: [PATCH] [FIX] account: Only allow admin to set the first invoice sequence Purpose ======= When a Access Rights user create the invoice for the first time, when click save it will raise an access right issue A user belong to group Access Rights, when he create a invoice he'll be able to edit 'sequence_number_next' The reason is he belongs to 'group_erp_manager' which makes _is_admin return True. However, he does not have rights to edit on model 'ir.sequence.date_range'. So that we should not allow him to edit the sequence of invoice in any case Specification ============= Since only users belong to 'group_system' can edit model ir.sequence. We should not allow other users edit sequences on invoice form, so the field won't be displayed for them to edit --- addons/account/models/account_invoice.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/models/account_invoice.py b/addons/account/models/account_invoice.py index b13b2cb9b4f..7699ac87723 100644 --- a/addons/account/models/account_invoice.py +++ b/addons/account/models/account_invoice.py @@ -392,7 +392,7 @@ class AccountInvoice(models.Model): """ computes the prefix of the number that will be assigned to the first invoice/bill/refund of a journal, in order to let the user manually change it. """ - if not self.env.user._is_admin(): + if not self.env.user._is_system(): for invoice in self: invoice.sequence_number_next_prefix = False invoice.sequence_number_next = ''