mirror of
https://github.com/OCA/account-financial-tools.git
synced 2025-02-02 12:47:26 +02:00
[REF] account_move_name_sequence: Moves with name '/' can not be posted
After remove required=True for journal.sequence_id field it is possible to post an invoice with misconfigured journal with empty sequence So, this constraint will raise an error for this kind of cases since that using '/' could raise the unique constraint for all other moves
This commit is contained in:
committed by
Marcos Oitaben
parent
93547ac668
commit
8f518c23ba
@@ -6,7 +6,7 @@
|
||||
|
||||
{
|
||||
"name": "Account Move Number Sequence",
|
||||
"version": "14.0.1.0.1",
|
||||
"version": "14.0.1.1.0",
|
||||
"category": "Accounting",
|
||||
"license": "AGPL-3",
|
||||
"summary": "Generate journal entry number from sequence",
|
||||
|
||||
@@ -13,6 +13,13 @@ msgstr ""
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Plural-Forms: \n"
|
||||
|
||||
#. module: account_move_name_sequence
|
||||
#: model:ir.model.constraint,message:account_move_name_sequence.constraint_account_move_name_state_diagonal
|
||||
msgid ""
|
||||
"A move can not be posted with name \"/\" or empty value\n"
|
||||
"Check the journal sequence, please"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_move_name_sequence
|
||||
#: model:ir.model.fields,help:account_move_name_sequence.field_account_journal__refund_sequence
|
||||
msgid ""
|
||||
|
||||
@@ -15,6 +15,15 @@ class AccountMove(models.Model):
|
||||
sequence_prefix = fields.Char(compute=False)
|
||||
sequence_number = fields.Integer(compute=False)
|
||||
|
||||
_sql_constraints = [
|
||||
(
|
||||
"name_state_diagonal",
|
||||
"CHECK(COALESCE(name, '') NOT IN ('/', '') OR state!='posted')",
|
||||
'A move can not be posted with name "/" or empty value\n'
|
||||
"Check the journal sequence, please",
|
||||
),
|
||||
]
|
||||
|
||||
@api.depends("state", "journal_id", "date")
|
||||
def _compute_name_by_sequence(self):
|
||||
for move in self:
|
||||
|
||||
Reference in New Issue
Block a user