Browse Source

email_template_configurator: updates after review

pull/247/head
andreparames 7 years ago
parent
commit
01798742d6
  1. 1
      email_template_configurator/models/email_template.py
  2. 3
      email_template_configurator/models/email_template_placeholder.py
  3. 1
      email_template_configurator/tests/__init__.py
  4. 6
      email_template_configurator/tests/test_configurator.py

1
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

3
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)

1
email_template_configurator/tests/__init__.py

@ -0,0 +1 @@
from . import test_configurator

6
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'])
Loading…
Cancel
Save