Files
contract/website_portal_contract/models/account_analytic_contract_template.py
Brett Wood bc4d08b9b1 [10.0][ADD] Add website_portal_contract (#62)
* [ADD] Add website_portal_contract

* [ADD] website_portal_contract: Add url test, usage video.

* [FIX] website_portal_contract: Fix controller test.

* [FIX] website_portal_contract: Change all tests to HttpCase.
2017-10-09 08:21:24 -07:00

41 lines
1.1 KiB
Python

# -*- coding: utf-8 -*-
# Copyright 2017 LasLabs Inc.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import api, fields, models
from odoo.tools.translate import html_translate
class AccountAnalyticContractTemplate(models.Model):
_name = 'account.analytic.contract.template'
_description = 'Contract Website Templates'
name = fields.Char(
help='Template name',
)
website_description = fields.Html(
string='Description',
translate=html_translate,
sanitize_attributes=False,
)
analytic_account_id = fields.One2many(
string='Analytic Account',
comodel_name='account.analytic.account',
inverse_name='website_template_id',
)
analytic_contract_id = fields.One2many(
string='Contract Template',
comodel_name='account.analytic.account',
inverse_name='website_template_id',
)
@api.multi
def open_template(self):
self.ensure_one()
return {
'type': 'ir.actions.act_url',
'target': 'self',
'url': '/contract/template/%d' % self.id
}