diff --git a/email_template_configurator/models/email_template.py b/email_template_configurator/models/email_template.py index 89504818..6634676a 100644 --- a/email_template_configurator/models/email_template.py +++ b/email_template_configurator/models/email_template.py @@ -19,4 +19,3 @@ class EmailTemplate(models.Model): for tmpl in self: if tmpl.placeholder_id: tmpl.placeholder_value = tmpl.placeholder_id.placeholder - tmpl.placeholder_id = False diff --git a/email_template_configurator/models/email_template_placeholder.py b/email_template_configurator/models/email_template_placeholder.py index a182f1d8..c47fbafc 100644 --- a/email_template_configurator/models/email_template_placeholder.py +++ b/email_template_configurator/models/email_template_placeholder.py @@ -13,5 +13,6 @@ class EmailTemplatePlaceholder(models.Model): name = fields.Char(required=True) model_id = fields.Many2one( 'ir.model', string='Model', required=True) - placeholder = fields.Char(required=True) + placeholder = fields.Char( + required=True, default='${object.}') active = fields.Boolean(default=True) diff --git a/email_template_configurator/tests/__init__.py b/email_template_configurator/tests/__init__.py new file mode 100644 index 00000000..a884a90e --- /dev/null +++ b/email_template_configurator/tests/__init__.py @@ -0,0 +1 @@ +from . import test_configurator diff --git a/email_template_configurator/tests/test_configurator.py b/email_template_configurator/tests/test_configurator.py index 15b1d5a4..22139f1b 100644 --- a/email_template_configurator/tests/test_configurator.py +++ b/email_template_configurator/tests/test_configurator.py @@ -5,13 +5,13 @@ from openerp.tests import common -class test_configurator(common.TransactionCase): +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', '=', 'account.invoice'), + ('model', '=', 'res.partner'), ]) placeholders_vals = [ { @@ -32,6 +32,6 @@ class test_configurator(common.TransactionCase): 'placeholder_id': placeholder.id, 'placeholder_value': False, }, 'placeholder_id', { - 'placeholder_id': 1, + 'placeholder_id': "1", })['value'] self.assertEqual(res['placeholder_value'], vals['placeholder'])