mirror of
https://github.com/NaN-tic/trytond-patches.git
synced 2023-12-14 06:03:03 +01:00
22 lines
921 B
Diff
22 lines
921 B
Diff
diff --git a/tryton/modules/account_invoice/invoice.py b/tryton/modules/account_invoice/invoice.py
|
|
--- a/tryton/modules/account_invoice/invoice.py
|
|
+++ b/tryton/modules/account_invoice/invoice.py
|
|
@@ -514,11 +514,14 @@ class Invoice(Workflow, ModelSQL, ModelView, TaxableMixin):
|
|
Journal = pool.get('account.journal')
|
|
if self.state != 'draft':
|
|
return self.journal
|
|
+ journal_type = {
|
|
+ 'out': 'revenue',
|
|
+ 'in': 'expense',
|
|
+ }.get(self.type)
|
|
+ if self.journal and self.journal.type == journal_type:
|
|
+ return self.journal
|
|
pattern = pattern.copy() if pattern is not None else {}
|
|
- pattern.setdefault('type', {
|
|
- 'out': 'revenue',
|
|
- 'in': 'expense',
|
|
- }.get(self.type))
|
|
+ pattern.setdefault('type', journal_type)
|
|
return Journal.find(pattern)
|
|
|
|
@classmethod
|