You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
1004 B

  1. # -*- coding: utf-8 -*-
  2. # © 2016 Taktik
  3. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
  4. import logging
  5. from openerp import models, api
  6. _logger = logging.getLogger(__name__)
  7. class AccountAccountTemplate(models.Model):
  8. _inherit = "account.account.template"
  9. @api.model
  10. def generate_account(
  11. self,
  12. chart_template_id,
  13. tax_template_ref,
  14. acc_template_ref,
  15. code_digits,
  16. company_id):
  17. res = super(AccountAccountTemplate, self).generate_account(
  18. chart_template_id,
  19. tax_template_ref,
  20. acc_template_ref,
  21. code_digits,
  22. company_id
  23. )
  24. main_company_id = self.env['ir.model.data'].xmlid_to_res_id(
  25. 'base.main_company'
  26. )
  27. if company_id == main_company_id:
  28. account_ids = []
  29. for template_account_id in res:
  30. account_ids.append(res[template_account_id])
  31. return res