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.

40 lines
1.1 KiB

  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. from odoo.tools.translate import html_translate
  6. class AccountAnalyticContractTemplate(models.Model):
  7. _name = 'account.analytic.contract.template'
  8. _description = 'Contract Website Templates'
  9. name = fields.Char(
  10. help='Template name',
  11. )
  12. website_description = fields.Html(
  13. string='Description',
  14. translate=html_translate,
  15. sanitize_attributes=False,
  16. )
  17. analytic_account_id = fields.One2many(
  18. string='Analytic Account',
  19. comodel_name='account.analytic.account',
  20. inverse_name='website_template_id',
  21. )
  22. analytic_contract_id = fields.One2many(
  23. string='Contract Template',
  24. comodel_name='account.analytic.account',
  25. inverse_name='website_template_id',
  26. )
  27. @api.multi
  28. def open_template(self):
  29. self.ensure_one()
  30. return {
  31. 'type': 'ir.actions.act_url',
  32. 'target': 'self',
  33. 'url': '/contract/template/%d' % self.id
  34. }