mirror of
https://github.com/OCA/account-financial-tools.git
synced 2025-02-02 12:47:26 +02:00
[MIG] account_tax_invoice_required: Migrated to 10.0
This commit is contained in:
@@ -22,7 +22,7 @@ To use this module, you need to:
|
||||
|
||||
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
|
||||
:alt: Try me on Runbot
|
||||
:target: https://runbot.odoo-community.org/runbot/92/9.0
|
||||
:target: https://runbot.odoo-community.org/runbot/92/10.0
|
||||
|
||||
|
||||
Bug Tracker
|
||||
@@ -41,6 +41,7 @@ Contributors
|
||||
|
||||
* Vincent Renaville <vincent.renaville@camptocamp.com>
|
||||
* Angel Moya <odoo@tecnativa.com>
|
||||
* Kitti U. <kittiu@ecosoft.co.th>
|
||||
|
||||
Maintainer
|
||||
----------
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
{
|
||||
'name': "Tax required in invoice",
|
||||
'version': "9.0.1.0.0",
|
||||
'version': "10.0.1.0.0",
|
||||
"author": "Camptocamp,Tecnativa,Odoo Community Association (OCA)",
|
||||
'website': "http://www.camptocamp.com",
|
||||
'category': "Localisation / Accounting",
|
||||
|
||||
@@ -3,15 +3,16 @@
|
||||
# Copyright 2016 - Tecnativa - Angel Moya <odoo@tecnativa.com>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from openerp import models, api, exceptions, _
|
||||
from openerp.tools import config
|
||||
from odoo import models, api, _
|
||||
from odoo.exceptions import UserError
|
||||
from odoo.tools import config
|
||||
|
||||
|
||||
class AccountInvoice(models.Model):
|
||||
_inherit = "account.invoice"
|
||||
|
||||
@api.multi
|
||||
def test_invoice_line_tax(self):
|
||||
def _test_invoice_line_tax(self):
|
||||
errors = []
|
||||
error_template = _("Invoice has a line with product %s with no taxes")
|
||||
for invoice_line in self.mapped('invoice_line_ids'):
|
||||
@@ -19,17 +20,15 @@ class AccountInvoice(models.Model):
|
||||
error_string = error_template % (invoice_line.name)
|
||||
errors.append(error_string)
|
||||
if errors:
|
||||
raise exceptions.Warning(
|
||||
raise UserError(
|
||||
_('%s\n%s') % (_('No Taxes Defined!'),
|
||||
'\n'.join(x for x in errors))
|
||||
)
|
||||
else:
|
||||
return True
|
||||
|
||||
@api.multi
|
||||
def invoice_validate(self):
|
||||
if not (config['test_enable'] and
|
||||
not self.env.context.get('test_tax_required')):
|
||||
self.test_invoice_line_tax()
|
||||
self._test_invoice_line_tax()
|
||||
res = super(AccountInvoice, self).invoice_validate()
|
||||
return res
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
# Copyright 2016 - Tecnativa - Angel Moya <odoo@tecnativa.com>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from openerp.tests.common import TransactionCase
|
||||
from openerp import exceptions
|
||||
from odoo.tests.common import TransactionCase
|
||||
from odoo import exceptions
|
||||
|
||||
|
||||
class TestAccountInvoiceTaxRequired(TransactionCase):
|
||||
|
||||
Reference in New Issue
Block a user