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.
37 lines
1.2 KiB
37 lines
1.2 KiB
# -*- coding: utf-8 -*-
|
|
# Copyright 2018 ACSONE SA/NV
|
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
|
|
|
from openerp.tests import common
|
|
|
|
|
|
class TestConfigurator(common.TransactionCase):
|
|
|
|
def test_configurator(self):
|
|
placeholders_obj = self.env['email.template.placeholder']
|
|
templates_obj = self.env['email.template']
|
|
invoice_model = self.env['ir.model'].search([
|
|
('model', '=', 'res.partner'),
|
|
])
|
|
placeholders_vals = [
|
|
{
|
|
'name': 'Invoice partner name',
|
|
'model_id': invoice_model.id,
|
|
'placeholder': '${object.partner_id.name}',
|
|
},
|
|
{
|
|
'name': 'Invoice partner vat',
|
|
'model_id': invoice_model.id,
|
|
'placeholder': '${object.partner_id.vat}',
|
|
},
|
|
]
|
|
for vals in placeholders_vals:
|
|
placeholder = placeholders_obj.create(vals)
|
|
|
|
res = templates_obj.onchange({
|
|
'placeholder_id': placeholder.id,
|
|
'placeholder_value': False,
|
|
}, 'placeholder_id', {
|
|
'placeholder_id': "1",
|
|
})['value']
|
|
self.assertEqual(res['placeholder_value'], vals['placeholder'])
|