Do not change account nor journal of invoice no more draft

Closes #12146
(grafted from 73697963ab5783d8dfe531d0997ac58e48d19994)

--HG--
branch : 6.0
This commit is contained in:
Cédric Krier committed 2023-04-08 16:36:38 +02:00
1 parent b3c85d3189
commit cb4f847845
1 file changed
+4 -1
+4 -1
View File
@@ -436,8 +436,11 @@ class Invoice(Workflow, ModelSQL, ModelView, TaxableMixin):
if self.company:
return self.company.party.id
@fields.depends('party', 'type', 'accounting_date', 'invoice_date')
@fields.depends(
'state', 'account', 'party', 'type', 'accounting_date', 'invoice_date')
def on_change_with_account(self):
if self.state != 'draft':
return self.account
account = None
if self.party:
with Transaction().set_context(