Import account_invoice exception when needed

account_invoice is an extras depend so it can not be imported globally.

issue11732
review418511003
This commit is contained in:
Cédric Krier
2022-10-26 23:36:38 +02:00
parent e58bab72d4
commit 36dff47632
3 changed files with 6 additions and 3 deletions
+2 -1
View File
@@ -5,7 +5,6 @@ from decimal import Decimal
from trytond.i18n import gettext
from trytond.model import ModelSQL, fields
from trytond.modules.account.exceptions import AccountMissing
from trytond.modules.account_invoice.exceptions import PaymentTermComputeError
from trytond.modules.company.model import CompanyValueMixin
from trytond.pool import Pool, PoolMeta
from trytond.pyson import Eval
@@ -130,6 +129,8 @@ class Invoice(metaclass=PoolMeta):
'payment_term_date')
def _cash_round_total_amount(self, amount):
"Round total amount according to cash rounding"
from trytond.modules.account_invoice.exceptions import (
PaymentTermComputeError)
pool = Pool()
Date = pool.get('ir.date')
if self.currency:
+2 -1
View File
@@ -1,7 +1,6 @@
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
from trytond.model import fields
from trytond.modules.account_invoice.exceptions import PaymentTermComputeError
from trytond.pool import Pool, PoolMeta
from trytond.pyson import Eval
from trytond.transaction import Transaction
@@ -55,6 +54,8 @@ class Purchase(metaclass=PoolMeta):
@fields.depends('currency', 'payment_term', 'company')
def _cash_round_total_amount(self, amount):
from trytond.modules.account_invoice.exceptions import (
PaymentTermComputeError)
pool = Pool()
Date = pool.get('ir.date')
if self.currency:
+2 -1
View File
@@ -1,7 +1,6 @@
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
from trytond.model import fields
from trytond.modules.account_invoice.exceptions import PaymentTermComputeError
from trytond.pool import Pool, PoolMeta
from trytond.transaction import Transaction
@@ -39,6 +38,8 @@ class Sale(metaclass=PoolMeta):
@fields.depends('currency', 'payment_term', 'company')
def _cash_round_total_amount(self, amount):
from trytond.modules.account_invoice.exceptions import (
PaymentTermComputeError)
pool = Pool()
Date = pool.get('ir.date')
if self.currency: