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.

31 lines
954 B

  1. # -*- coding: utf-8 -*-
  2. # Copyright 2017 LasLabs Inc.
  3. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
  4. from odoo import api, fields, models
  5. class AccountAnalyticAccount(models.Model):
  6. _inherit = 'account.analytic.account'
  7. website_template_id = fields.Many2one(
  8. string='Website Template',
  9. comodel_name='account.analytic.contract.template',
  10. help='Website layout for contract',
  11. )
  12. account_invoice_ids = fields.Many2many(
  13. string='Invoices',
  14. comodel_name='account.invoice',
  15. )
  16. @api.model
  17. def _search_contracts(self, domain=None):
  18. partner = self.env.user.partner_id
  19. contract_mod = self.env['account.analytic.account']
  20. if not domain:
  21. domain = [
  22. ('partner_id', 'child_of', [partner.commercial_partner_id.id]),
  23. ('recurring_invoices', '=', True),
  24. ]
  25. return contract_mod.search(domain)