[FIX] account: invoice alias in multi company

Install accounting in a multi company environment.
Configure email server.
Configure an alias for the vendor bill journal per company.

Before this commit, all the invoices were created in the same company,
regardless of the alias used.

Now, the invoice is created in the company of the used alias.

opw-1939909

closes odoo/odoo#31948

Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
This commit is contained in:
Jorge Pinna Puissant
2019-03-19 14:33:07 +00:00
parent 68860fcc9d
commit 577333f548
+1 -2
View File
@@ -580,8 +580,7 @@ class AccountJournal(models.Model):
if self.company_id != self.env.ref('base.main_company'):
alias_name += '-' + str(self.company_id.name)
return {
'alias_defaults': {'type': 'in_invoice'},
'alias_user_id': self.env.user.id,
'alias_defaults': {'type': 'in_invoice', 'company_id': self.company_id.id},
'alias_parent_thread_id': self.id,
'alias_name': re.sub(r'[^\w]+', '-', alias_name)
}