From 36dff47632123d9cc0237ca4e56afb89c4f13fe2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Wed, 26 Oct 2022 23:36:38 +0200 Subject: [PATCH] Import account_invoice exception when needed account_invoice is an extras depend so it can not be imported globally. issue11732 review418511003 --- account.py | 3 ++- purchase.py | 3 ++- sale.py | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/account.py b/account.py index d684a7bf88..e596e75cdc 100644 --- a/account.py +++ b/account.py @@ -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: diff --git a/purchase.py b/purchase.py index f5cab31714..304e2c7f84 100644 --- a/purchase.py +++ b/purchase.py @@ -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: diff --git a/sale.py b/sale.py index 6122a34d84..bc7b1eb913 100644 --- a/sale.py +++ b/sale.py @@ -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: