mirror of
https://github.com/OCA/account-financial-tools.git
synced 2025-02-02 12:47:26 +02:00
[FIX] account_invoice_tax_required: Avoid gaps in sequence
Using `invoice_validate` method for validating invoice, makes the call to the sequence to be done before, and although rollbacking the transaction, the next number is already assigned and then you may have gaps in your numbering. Thus, we do the check before this, on the first executed method.
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
{
|
||||
'name': "Tax required in invoice",
|
||||
'version': "10.0.1.0.1",
|
||||
'version': "10.0.1.0.2",
|
||||
"author": "Camptocamp,Tecnativa,Odoo Community Association (OCA)",
|
||||
'website': "http://www.camptocamp.com",
|
||||
'category': "Localisation / Accounting",
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2015 - Camptocamp SA - Author Vincent Renaville
|
||||
# Copyright 2016 - Tecnativa - Angel Moya <odoo@tecnativa.com>
|
||||
# Copyright 2019 - Tecnativa - Pedro M. Baeza
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import models, api, _
|
||||
@@ -26,7 +27,7 @@ class AccountInvoice(models.Model):
|
||||
)
|
||||
|
||||
@api.multi
|
||||
def invoice_validate(self):
|
||||
def action_invoice_open(self):
|
||||
# Always test if it is required by context
|
||||
force_test = self.env.context.get('test_tax_required')
|
||||
skip_test = any((
|
||||
@@ -40,4 +41,4 @@ class AccountInvoice(models.Model):
|
||||
))
|
||||
if force_test or not skip_test:
|
||||
self._test_invoice_line_tax()
|
||||
return super(AccountInvoice, self).invoice_validate()
|
||||
return super(AccountInvoice, self).action_invoice_open()
|
||||
|
||||
Reference in New Issue
Block a user