[FIX] l10n_mx: company in the journal cash basis configuration

When have more than one company, for all companies, the cash
basis journal  set in accounting configuration will be
always the related to first company.

This issue cause the followiong error trying to validate an
invoice for a company different to fisrt one:

'Cannot create moves for different companies.'

Because exist a 'cross-configuration' in the cash basis
journal.

The solution to this issue is include the company in domain
that does the search for cash basis journal.
This commit is contained in:
Jose Suniaga [Vauxoo]
2017-09-15 10:39:32 +02:00
committed by qdp-odoo
parent 77566f5067
commit 27edcaafd6
+1
View File
@@ -16,6 +16,7 @@ class AccountChartTemplate(models.Model):
if not self == self.env.ref('l10n_mx.mx_coa'):
return res
journal_basis = self.env['account.journal'].search([
('company_id', '=', company.id),
('type', '=', 'general'),
('code', '=', 'CBMX')], limit=1)
company.write({'tax_cash_basis_journal_id': journal_basis.id})