account_chart_template.py 791 B

1234567891011121314151617181920
  1. # Part of Odoo. See LICENSE file for full copyright and licensing details.
  2. from odoo import models, api, fields, _
  3. class AccountChartTemplate(models.Model):
  4. _inherit = 'account.chart.template'
  5. @api.model
  6. def _prepare_all_journals(self, acc_template_ref, company, journals_dict=None):
  7. """ We add use_documents or not depending on the context"""
  8. journal_data = super()._prepare_all_journals(acc_template_ref, company, journals_dict)
  9. # if chart has localization, then we use documents by default
  10. if company._localization_use_documents():
  11. for vals_journal in journal_data:
  12. if vals_journal['type'] in ['sale', 'purchase']:
  13. vals_journal['l10n_latam_use_documents'] = True
  14. return journal_data