[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
This commit is contained in:
Duc Dao
2018-06-11 12:44:11 +02:00
committed by Yannick Tivisse
parent 1bf483b047
commit 91bcd84a02
+1 -1
View File
@@ -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 = ''