[IMP] use model._fields instead of model._all_columns to cover all fields
[odoo/odoo.git] / addons / website_mail / controllers / email_designer.py
index 6116dd3..157b8ef 100644 (file)
@@ -13,10 +13,10 @@ class WebsiteEmailDesigner(http.Controller):
     def index(self, model, res_id, template_model=None, **kw):
         if not model or not model in request.registry or not res_id:
             return request.redirect('/')
-        model_cols = request.registry[model]._all_columns
-        if 'body' not in model_cols and 'body_html' not in model_cols or \
-           'email' not in model_cols and 'email_from' not in model_cols or \
-           'name' not in model_cols and 'subject' not in model_cols:
+        model_fields = request.registry[model]._fields
+        if 'body' not in model_fields and 'body_html' not in model_fields or \
+           'email' not in model_fields and 'email_from' not in model_fields or \
+           'name' not in model_fields and 'subject' not in model_fields:
             return request.redirect('/')
         res_id = int(res_id)
         obj_ids = request.registry[model].exists(request.cr, request.uid, [res_id], context=request.context)
@@ -25,13 +25,13 @@ class WebsiteEmailDesigner(http.Controller):
         # try to find fields to display / edit -> as t-field is static, we have to limit
         # the available fields to a given subset
         email_from_field = 'email'
-        if 'email_from' in model_cols:
+        if 'email_from' in model_fields:
             email_from_field = 'email_from'
         subject_field = 'name'
-        if 'subject' in model_cols:
+        if 'subject' in model_fields:
             subject_field = 'subject'
         body_field = 'body'
-        if 'body_html' in model_cols:
+        if 'body_html' in model_fields:
             body_field = 'body_html'
 
         cr, uid, context = request.cr, request.uid, request.context